19 static std::mutex timeMutex;
20 static ossimTrace traceDebug(
"ossimSqliteUtil:debug");
24 int rc = SQLITE_ERROR;
25 if ( db && sql.size() )
30 <<
"sql:\n" << sql <<
"\n";
33 sqlite3_stmt* pStmt = 0;
35 rc = sqlite3_prepare_v2(db,
40 if ( rc == SQLITE_OK )
42 rc = sqlite3_step(pStmt);
47 <<
"ossim_sqlite::exec error: " << sqlite3_errmsg(db) << std::endl;
50 sqlite3_finalize(pStmt);
59 if ( db && tableName.size() )
61 const char *zLeftover;
62 sqlite3_stmt *pStmt = 0;
63 std::string sql =
"SELECT * from ";
66 int rc = sqlite3_prepare_v2(db,
71 if ( rc == SQLITE_OK )
73 int nCol = sqlite3_column_count( pStmt );
79 sqlite3_finalize(pStmt);
87 const std::string& columnName,
92 << module <<
" Unexpected column name or type[" << columnIndex <<
"]: " 93 <<
"name: " << columnName <<
" type: " << type << std::endl;
103 struct tm* timeInfo = gmtime(&rawTime);
108 const size_t STRING_SIZE = 25;
109 char outStr[STRING_SIZE];
111 size = strftime(outStr, STRING_SIZE,
"%Y-%m-%dT%H:%M:%S.000Z", timeInfo );
115 outStr[STRING_SIZE-1] =
'\0';
void warn(const std::string &module, const std::string &columnName, ossim_int32 columnIndex, ossim_int32 type)
Outputs formated warning message.
int exec(sqlite3 *db, const std::string &sql)
Preforms sqlite3_prepare_v2, sqlite3_step and sqlite3_finalize.
bool tableExists(sqlite3 *db, const std::string &tableName)
Checks for existance of table.
void getTime(std::string &result)
Gets time in the form of "%Y-%m-%dT%H:%M:%S.000Z".
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)