Changeset 95d7add in network-game for server/DataAccess.cpp


Ignore:
Timestamp:
May 17, 2014, 6:52:34 PM (11 years ago)
Author:
Dmitry Portnoy <dmp1488@…>
Branches:
master
Children:
a9e808e
Parents:
84f9797
Message:

more rebust error handling in the data-access code, specifically in cases where the initial database connection failes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • server/DataAccess.cpp

    r84f9797 r95d7add  
    144144   ostringstream oss;
    145145
     146   if (connection == NULL) {
     147       cout << "Error: non database connection exists" << endl;
     148       return -1;
     149   }
     150
    146151   oss << "INSERT into " << table << " (" << columns << ") VALUES (" << values << ")";
    147152   cout << "query: " << oss.str() << endl;
     
    162167   ostringstream oss;
    163168
     169   if (connection == NULL) {
     170       cout << "Error: non database connection exists" << endl;
     171       return -1;
     172   }
     173
    164174   oss << "UPDATE " << table << " SET " << values << " WHERE " << where;
    165175   cout << "query: " << oss.str() << endl;
     
    179189   int query_state;
    180190   ostringstream oss;
     191
     192   if (connection == NULL) {
     193       cout << "Error: non database connection exists" << endl;
     194       return NULL;
     195   }
    181196
    182197   oss << "SELECT * FROM " << table;
Note: See TracChangeset for help on using the changeset viewer.