Add support for detecting NULL entires to sqlite.

This commit is contained in:
Arthur Britto
2012-04-13 20:40:25 -07:00
parent f4e4ef5bc9
commit d861cf5719
2 changed files with 9 additions and 2 deletions

View File

@@ -120,6 +120,11 @@ bool SqliteDatabase::getNextRow()
} }
} }
bool SqliteDatabase::getNull(int colIndex)
{
return(SQLITE_NULL == sqlite3_column_type(mCurrentStmt, colIndex));
}
char* SqliteDatabase::getStr(int colIndex,std::string& retStr) char* SqliteDatabase::getStr(int colIndex,std::string& retStr)
{ {
retStr=(char*)sqlite3_column_text(mCurrentStmt, colIndex); retStr=(char*)sqlite3_column_text(mCurrentStmt, colIndex);
@@ -172,4 +177,5 @@ void SqliteDatabase::escape(const unsigned char* start, int size, std::string& r
} }
retStr.push_back('\''); retStr.push_back('\'');
} }
// vim:ts=4

View File

@@ -29,6 +29,7 @@ public:
// will return false if there are no more rows // will return false if there are no more rows
bool getNextRow(); bool getNextRow();
bool getNull(int colIndex);
char* getStr(int colIndex,std::string& retStr); char* getStr(int colIndex,std::string& retStr);
int32 getInt(int colIndex); int32 getInt(int colIndex);
float getFloat(int colIndex); float getFloat(int colIndex);
@@ -39,4 +40,4 @@ public:
void escape(const unsigned char* start,int size,std::string& retStr); void escape(const unsigned char* start,int size,std::string& retStr);
}; };