00001 // generated code -- do not edit 00002 00003 #include "sa_sensor_list_log_db.h" 00004 00005 #include "ld_private.h" 00006 00007 #include "ac_app_context.h" 00008 00009 #include <errno.h> 00010 00011 #include "common/logging.h" 00012 00013 #include "common/assertions.h" 00014 00015 #include "common/threading.h" 00016 00017 #include "common/error_list.h" 00018 00019 static const char create_tables_sql[] = 00020 "create table status_log (unixtime INTEGER, message TEXT);" 00021 "create table mark_log (unixtime INTEGER, message TEXT);" 00022 "create table appmessage_log (unixtime INTEGER, message TEXT);" 00023 "create table timer_scan (unixtime INTEGER);" 00024 "create table flightmode_scan (unixtime INTEGER, value INTEGER);" 00025 "create table battery_scan (unixtime INTEGER, status INTEGER, level INTEGER);" 00026 "create table registration_scan (unixtime INTEGER, status INTEGER);" 00027 "create table signal_scan (unixtime INTEGER, dbm INTEGER, bars INTEGER);" 00028 "create table operator_scan (unixtime INTEGER, name TEXT);" 00029 "create table light_scan (unixtime INTEGER, level INTEGER);" 00030 "create table tap_scan (unixtime INTEGER, direction INTEGER, is_dbl INTEGER);" 00031 "create table proximity_scan (unixtime INTEGER, close INTEGER);" 00032 "create table musicplayer_scan (unixtime INTEGER, event INTEGER, detail TEXT);" 00033 "create table musictrack_scan (unixtime INTEGER, url TEXT, title TEXT, artist TEXT, album TEXT);" 00034 "create table httpurl_scan (unixtime INTEGER, url TEXT);" 00035 "create table weburl_scan (unixtime INTEGER, name TEXT, url TEXT);" 00036 "create table profile_scan (unixtime INTEGER, value INTEGER, name TEXT);" 00037 "create table cellid_scan (unixtime INTEGER, country_code TEXT, network_code TEXT, area_code INTEGER, cell_id INTEGER);" 00038 "create table btprox_scan (unixtime INTEGER, scan_id INTEGER not null primary key AUTOINCREMENT);" 00039 "create table btprox_item (scan_id INTEGER not null, address TEXT not null, name TEXT not null);" 00040 "create table position_scan (unixtime INTEGER, latitude REAL, longitude REAL, altitude REAL, vertical_accuracy REAL, horizontal_accuracy REAL, course TEXT, satellites TEXT);" 00041 "create table appfocus_scan (unixtime INTEGER, uid INTEGER, caption TEXT);" 00042 "create table keypress_scan (unixtime INTEGER, presstimes TEXT);" 00043 "create table inactivity_scan (unixtime INTEGER, value INTEGER);" 00044 "create table indicator_scan (unixtime INTEGER, value INTEGER, caps INTEGER);" 00045 "create table callstatus_scan (unixtime INTEGER not null, value INTEGER not null, number TEXT, contact_name TEXT, starttime INTEGER, osterm INTEGER, netterm INTEGER);" 00046 "create table smsevent_scan (unixtime INTEGER not null, evtype TEXT not null, number TEXT, contact_name TEXT, body TEXT);" 00047 ""; 00048 00049 #if __MARK_ENABLED__ 00050 00051 #endif 00052 00053 #if __APPMESSAGE_ENABLED__ 00054 00055 #endif 00056 00057 #if __TIMER_ENABLED__ 00058 00059 #endif 00060 00061 #if defined(__EPOC32__) 00062 00063 #endif 00064 00065 #if defined(__EPOC32__) 00066 00067 #endif 00068 00069 #if defined(__EPOC32__) 00070 00071 #endif 00072 00073 #if defined(__EPOC32__) 00074 00075 #endif 00076 00077 #if defined(__EPOC32__) 00078 00079 #endif 00080 00081 #if __LIGHT_ENABLED__ 00082 00083 #endif 00084 00085 #if __WITH_TAP_SENSORS__ 00086 00087 #endif 00088 00089 #if __PROXIMITY_ENABLED__ 00090 00091 #endif 00092 00093 #if __MUSIC_ENABLED__ 00094 00095 #endif 00096 00097 #if __MUSIC_ENABLED__ 00098 00099 #endif 00100 00101 #if __HTTPURL_ENABLED__ 00102 00103 #endif 00104 00105 #if __WEBURL_ENABLED__ 00106 00107 #endif 00108 00109 #if __PROFILE_ENABLED__ 00110 00111 #endif 00112 00113 #if __CELLID_ENABLED__ 00114 00115 #endif 00116 00117 #if __POSITION_ENABLED__ 00118 00119 #endif 00120 00121 #if __APPFOCUS_ENABLED__ 00122 00123 #endif 00124 00125 #if __KEYPRESS_ENABLED__ 00126 00127 #endif 00128 00129 #if __INACTIVITY_ENABLED__ 00130 00131 #endif 00132 00133 #if __INDICATOR_ENABLED__ 00134 00135 #endif 00136 00137 #if __CALLSTATUS_ENABLED__ 00138 00139 #endif 00140 00141 #if __SMSEVENT_ENABLED__ 00142 00143 #endif 00144 00145 char const *get_create_tables_sql() 00146 { 00147 return create_tables_sql; 00148 } 00149 00150 gboolean prepare_sql_statements(LogDb *self, GError **error) 00151 { 00152 if (sqlite_prepare(self->db, "begin transaction;", -1, &(self->stmts.transactionBeginStmt), 0)) { goto fail; } 00153 if (sqlite_prepare(self->db, "commit transaction;", -1, &(self->stmts.transactionCommitStmt), 0)) { goto fail; } 00154 if (sqlite_prepare(self->db, "rollback transaction;", -1, &(self->stmts.transactionRollbackStmt), 0)) { goto fail; } 00155 if (sqlite_prepare(self->db, "insert into status_log (unixtime, message) values (?, ?);", -1, &(self->stmts.statusStmt), 0)) { goto fail; } 00156 #if __MARK_ENABLED__ 00157 if (sqlite_prepare(self->db, "insert into mark_log (unixtime, message) values (?, ?);", -1, &(self->stmts.markStmt), 0)) { goto fail; } 00158 #endif 00159 #if __APPMESSAGE_ENABLED__ 00160 if (sqlite_prepare(self->db, "insert into appmessage_log (unixtime, message) values (?, ?);", -1, &(self->stmts.appmessageStmt), 0)) { goto fail; } 00161 #endif 00162 #if __TIMER_ENABLED__ 00163 if (sqlite_prepare(self->db, "insert into timer_scan (unixtime) values (?);", -1, &(self->stmts.timerStmt), 0)) { goto fail; } 00164 #endif 00165 #if defined(__EPOC32__) 00166 if (sqlite_prepare(self->db, "insert into flightmode_scan (unixtime, value) values (?, ?);", -1, &(self->stmts.flightmodeStmt), 0)) { goto fail; } 00167 #endif 00168 #if defined(__EPOC32__) 00169 if (sqlite_prepare(self->db, "insert into battery_scan (unixtime, status, level) values (?, ?, ?);", -1, &(self->stmts.batteryStmt), 0)) { goto fail; } 00170 #endif 00171 #if defined(__EPOC32__) 00172 if (sqlite_prepare(self->db, "insert into registration_scan (unixtime, status) values (?, ?);", -1, &(self->stmts.registrationStmt), 0)) { goto fail; } 00173 #endif 00174 #if defined(__EPOC32__) 00175 if (sqlite_prepare(self->db, "insert into signal_scan (unixtime, dbm, bars) values (?, ?, ?);", -1, &(self->stmts.signalStmt), 0)) { goto fail; } 00176 #endif 00177 #if defined(__EPOC32__) 00178 if (sqlite_prepare(self->db, "insert into operator_scan (unixtime, name) values (?, ?);", -1, &(self->stmts.operatorStmt), 0)) { goto fail; } 00179 #endif 00180 #if __LIGHT_ENABLED__ 00181 if (sqlite_prepare(self->db, "insert into light_scan (unixtime, level) values (?, ?);", -1, &(self->stmts.lightStmt), 0)) { goto fail; } 00182 #endif 00183 #if __WITH_TAP_SENSORS__ 00184 if (sqlite_prepare(self->db, "insert into tap_scan (unixtime, direction, is_dbl) values (?, ?, ?);", -1, &(self->stmts.tapStmt), 0)) { goto fail; } 00185 #endif 00186 #if __PROXIMITY_ENABLED__ 00187 if (sqlite_prepare(self->db, "insert into proximity_scan (unixtime, close) values (?, ?);", -1, &(self->stmts.proximityStmt), 0)) { goto fail; } 00188 #endif 00189 #if __MUSIC_ENABLED__ 00190 if (sqlite_prepare(self->db, "insert into musicplayer_scan (unixtime, event, detail) values (?, ?, ?);", -1, &(self->stmts.musicplayerStmt), 0)) { goto fail; } 00191 #endif 00192 #if __MUSIC_ENABLED__ 00193 if (sqlite_prepare(self->db, "insert into musictrack_scan (unixtime, url, title, artist, album) values (?, ?, ?, ?, ?);", -1, &(self->stmts.musictrackStmt), 0)) { goto fail; } 00194 #endif 00195 #if __HTTPURL_ENABLED__ 00196 if (sqlite_prepare(self->db, "insert into httpurl_scan (unixtime, url) values (?, ?);", -1, &(self->stmts.httpurlStmt), 0)) { goto fail; } 00197 #endif 00198 #if __WEBURL_ENABLED__ 00199 if (sqlite_prepare(self->db, "insert into weburl_scan (unixtime, name, url) values (?, ?, ?);", -1, &(self->stmts.weburlStmt), 0)) { goto fail; } 00200 #endif 00201 #if __PROFILE_ENABLED__ 00202 if (sqlite_prepare(self->db, "insert into profile_scan (unixtime, value, name) values (?, ?, ?);", -1, &(self->stmts.profileStmt), 0)) { goto fail; } 00203 #endif 00204 #if __CELLID_ENABLED__ 00205 if (sqlite_prepare(self->db, "insert into cellid_scan (unixtime, country_code, network_code, area_code, cell_id) values (?, ?, ?, ?, ?);", -1, &(self->stmts.cellidStmt), 0)) { goto fail; } 00206 #endif 00207 #if __BTPROX_ENABLED__ 00208 if (sqlite_prepare(self->db, "insert into btprox_scan (unixtime) values (?);", -1, &(self->stmts.btproxScanStmt), 0)) { goto fail; } 00209 #endif 00210 #if __BTPROX_ENABLED__ 00211 if (sqlite_prepare(self->db, "insert into btprox_item (scan_id, address, name) values (?, ?, ?);", -1, &(self->stmts.btproxItemStmt), 0)) { goto fail; } 00212 #endif 00213 #if __POSITION_ENABLED__ 00214 if (sqlite_prepare(self->db, "insert into position_scan (unixtime, latitude, longitude, altitude, vertical_accuracy, horizontal_accuracy, course, satellites) values (?, ?, ?, ?, ?, ?, ?, ?);", -1, &(self->stmts.positionStmt), 0)) { goto fail; } 00215 #endif 00216 #if __APPFOCUS_ENABLED__ 00217 if (sqlite_prepare(self->db, "insert into appfocus_scan (unixtime, uid, caption) values (?, ?, ?);", -1, &(self->stmts.appfocusStmt), 0)) { goto fail; } 00218 #endif 00219 #if __KEYPRESS_ENABLED__ 00220 if (sqlite_prepare(self->db, "insert into keypress_scan (unixtime, presstimes) values (?, ?);", -1, &(self->stmts.keypressStmt), 0)) { goto fail; } 00221 #endif 00222 #if __INACTIVITY_ENABLED__ 00223 if (sqlite_prepare(self->db, "insert into inactivity_scan (unixtime, value) values (?, ?);", -1, &(self->stmts.inactivityStmt), 0)) { goto fail; } 00224 #endif 00225 #if __INDICATOR_ENABLED__ 00226 if (sqlite_prepare(self->db, "insert into indicator_scan (unixtime, value, caps) values (?, ?, ?);", -1, &(self->stmts.indicatorStmt), 0)) { goto fail; } 00227 #endif 00228 #if __CALLSTATUS_ENABLED__ 00229 if (sqlite_prepare(self->db, "insert into callstatus_scan (unixtime, value, number, contact_name, starttime, osterm, netterm) values (?, ?, ?, ?, ?, ?, ?);", -1, &(self->stmts.callstatusStmt), 0)) { goto fail; } 00230 #endif 00231 #if __SMSEVENT_ENABLED__ 00232 if (sqlite_prepare(self->db, "insert into smsevent_scan (unixtime, evtype, number, contact_name, body) values (?, ?, ?, ?, ?);", -1, &(self->stmts.smseventStmt), 0)) { goto fail; } 00233 #endif 00234 return TRUE; 00235 fail: 00236 if (error) *error = gx_error_new(domain_cl2app, code_database_state_init, "error preparing statements for database '%s': %s (%d)", LOGDB_FILE, sqlite3_errmsg(self->db), sqlite3_errcode(self->db)); 00237 return FALSE; 00238 } 00239 00240 void destroy_sql_statements(LogDb *self) 00241 { 00242 if (self->stmts.transactionBeginStmt) { sqlite3_finalize(self->stmts.transactionBeginStmt); self->stmts.transactionBeginStmt = NULL; } 00243 if (self->stmts.transactionCommitStmt) { sqlite3_finalize(self->stmts.transactionCommitStmt); self->stmts.transactionCommitStmt = NULL; } 00244 if (self->stmts.transactionRollbackStmt) { sqlite3_finalize(self->stmts.transactionRollbackStmt); self->stmts.transactionRollbackStmt = NULL; } 00245 if (self->stmts.statusStmt) { sqlite3_finalize(self->stmts.statusStmt); self->stmts.statusStmt = NULL; } 00246 #if __MARK_ENABLED__ 00247 if (self->stmts.markStmt) { sqlite3_finalize(self->stmts.markStmt); self->stmts.markStmt = NULL; } 00248 #endif 00249 #if __APPMESSAGE_ENABLED__ 00250 if (self->stmts.appmessageStmt) { sqlite3_finalize(self->stmts.appmessageStmt); self->stmts.appmessageStmt = NULL; } 00251 #endif 00252 #if __TIMER_ENABLED__ 00253 if (self->stmts.timerStmt) { sqlite3_finalize(self->stmts.timerStmt); self->stmts.timerStmt = NULL; } 00254 #endif 00255 #if defined(__EPOC32__) 00256 if (self->stmts.flightmodeStmt) { sqlite3_finalize(self->stmts.flightmodeStmt); self->stmts.flightmodeStmt = NULL; } 00257 #endif 00258 #if defined(__EPOC32__) 00259 if (self->stmts.batteryStmt) { sqlite3_finalize(self->stmts.batteryStmt); self->stmts.batteryStmt = NULL; } 00260 #endif 00261 #if defined(__EPOC32__) 00262 if (self->stmts.registrationStmt) { sqlite3_finalize(self->stmts.registrationStmt); self->stmts.registrationStmt = NULL; } 00263 #endif 00264 #if defined(__EPOC32__) 00265 if (self->stmts.signalStmt) { sqlite3_finalize(self->stmts.signalStmt); self->stmts.signalStmt = NULL; } 00266 #endif 00267 #if defined(__EPOC32__) 00268 if (self->stmts.operatorStmt) { sqlite3_finalize(self->stmts.operatorStmt); self->stmts.operatorStmt = NULL; } 00269 #endif 00270 #if __LIGHT_ENABLED__ 00271 if (self->stmts.lightStmt) { sqlite3_finalize(self->stmts.lightStmt); self->stmts.lightStmt = NULL; } 00272 #endif 00273 #if __WITH_TAP_SENSORS__ 00274 if (self->stmts.tapStmt) { sqlite3_finalize(self->stmts.tapStmt); self->stmts.tapStmt = NULL; } 00275 #endif 00276 #if __PROXIMITY_ENABLED__ 00277 if (self->stmts.proximityStmt) { sqlite3_finalize(self->stmts.proximityStmt); self->stmts.proximityStmt = NULL; } 00278 #endif 00279 #if __MUSIC_ENABLED__ 00280 if (self->stmts.musicplayerStmt) { sqlite3_finalize(self->stmts.musicplayerStmt); self->stmts.musicplayerStmt = NULL; } 00281 #endif 00282 #if __MUSIC_ENABLED__ 00283 if (self->stmts.musictrackStmt) { sqlite3_finalize(self->stmts.musictrackStmt); self->stmts.musictrackStmt = NULL; } 00284 #endif 00285 #if __HTTPURL_ENABLED__ 00286 if (self->stmts.httpurlStmt) { sqlite3_finalize(self->stmts.httpurlStmt); self->stmts.httpurlStmt = NULL; } 00287 #endif 00288 #if __WEBURL_ENABLED__ 00289 if (self->stmts.weburlStmt) { sqlite3_finalize(self->stmts.weburlStmt); self->stmts.weburlStmt = NULL; } 00290 #endif 00291 #if __PROFILE_ENABLED__ 00292 if (self->stmts.profileStmt) { sqlite3_finalize(self->stmts.profileStmt); self->stmts.profileStmt = NULL; } 00293 #endif 00294 #if __CELLID_ENABLED__ 00295 if (self->stmts.cellidStmt) { sqlite3_finalize(self->stmts.cellidStmt); self->stmts.cellidStmt = NULL; } 00296 #endif 00297 #if __BTPROX_ENABLED__ 00298 if (self->stmts.btproxScanStmt) { sqlite3_finalize(self->stmts.btproxScanStmt); self->stmts.btproxScanStmt = NULL; } 00299 #endif 00300 #if __BTPROX_ENABLED__ 00301 if (self->stmts.btproxItemStmt) { sqlite3_finalize(self->stmts.btproxItemStmt); self->stmts.btproxItemStmt = NULL; } 00302 #endif 00303 #if __POSITION_ENABLED__ 00304 if (self->stmts.positionStmt) { sqlite3_finalize(self->stmts.positionStmt); self->stmts.positionStmt = NULL; } 00305 #endif 00306 #if __APPFOCUS_ENABLED__ 00307 if (self->stmts.appfocusStmt) { sqlite3_finalize(self->stmts.appfocusStmt); self->stmts.appfocusStmt = NULL; } 00308 #endif 00309 #if __KEYPRESS_ENABLED__ 00310 if (self->stmts.keypressStmt) { sqlite3_finalize(self->stmts.keypressStmt); self->stmts.keypressStmt = NULL; } 00311 #endif 00312 #if __INACTIVITY_ENABLED__ 00313 if (self->stmts.inactivityStmt) { sqlite3_finalize(self->stmts.inactivityStmt); self->stmts.inactivityStmt = NULL; } 00314 #endif 00315 #if __INDICATOR_ENABLED__ 00316 if (self->stmts.indicatorStmt) { sqlite3_finalize(self->stmts.indicatorStmt); self->stmts.indicatorStmt = NULL; } 00317 #endif 00318 #if __CALLSTATUS_ENABLED__ 00319 if (self->stmts.callstatusStmt) { sqlite3_finalize(self->stmts.callstatusStmt); self->stmts.callstatusStmt = NULL; } 00320 #endif 00321 #if __SMSEVENT_ENABLED__ 00322 if (self->stmts.smseventStmt) { sqlite3_finalize(self->stmts.smseventStmt); self->stmts.smseventStmt = NULL; } 00323 #endif 00324 return; 00325 } 00326 00327 #if __MARK_ENABLED__ 00328 00329 gboolean log_db_log_mark(LogDb *self, char const *msgText, GError **error) 00330 { 00331 time_t now = time(NULL); if (now == -1) { goto posix_fail; } 00332 if (sqlite3_bind_int(self->stmts.markStmt, 1, now)) { goto sql_fail; } 00333 if (sqlite3_bind_text(self->stmts.markStmt, 2, msgText, strlen(msgText), SQLITE_STATIC)) { goto sql_fail; } 00334 if (sqlite3_step(self->stmts.markStmt) != SQLITE_DONE) { goto sql_fail; } 00335 if (sqlite3_reset(self->stmts.markStmt)) goto sql_fail; 00336 return TRUE; 00337 posix_fail: if (error) *error = gx_error_new(domain_cl2app, code_time_query, "failed to access current time: %s (%d)", strerror(errno), errno); return FALSE; 00338 sql_fail: if (error) *error = gx_error_new(domain_cl2app, code_database_command, "failed to log mark event: %s (%d)", sqlite3_errmsg(self->db), sqlite3_errcode(self->db)); return FALSE; 00339 } 00340 00341 #endif 00342 00343 #if __APPMESSAGE_ENABLED__ 00344 00345 gboolean log_db_log_appmessage(LogDb *self, char const *msgText, GError **error) 00346 { 00347 time_t now = time(NULL); if (now == -1) { goto posix_fail; } 00348 if (sqlite3_bind_int(self->stmts.appmessageStmt, 1, now)) { goto sql_fail; } 00349 if (sqlite3_bind_text(self->stmts.appmessageStmt, 2, msgText, strlen(msgText), SQLITE_STATIC)) { goto sql_fail; } 00350 if (sqlite3_step(self->stmts.appmessageStmt) != SQLITE_DONE) { goto sql_fail; } 00351 if (sqlite3_reset(self->stmts.appmessageStmt)) goto sql_fail; 00352 return TRUE; 00353 posix_fail: if (error) *error = gx_error_new(domain_cl2app, code_time_query, "failed to access current time: %s (%d)", strerror(errno), errno); return FALSE; 00354 sql_fail: if (error) *error = gx_error_new(domain_cl2app, code_database_command, "failed to log appmessage event: %s (%d)", sqlite3_errmsg(self->db), sqlite3_errcode(self->db)); return FALSE; 00355 } 00356 00357 #endif 00358 00359 #if __TIMER_ENABLED__ 00360 00361 gboolean log_db_log_timer(LogDb *self, GError **error) 00362 { 00363 time_t now = time(NULL); if (now == -1) { goto posix_fail; } 00364 if (sqlite3_bind_int(self->stmts.timerStmt, 1, now)) { goto sql_fail; } 00365 if (sqlite3_step(self->stmts.timerStmt) != SQLITE_DONE) { goto sql_fail; } 00366 if (sqlite3_reset(self->stmts.timerStmt)) goto sql_fail; 00367 return TRUE; 00368 posix_fail: if (error) *error = gx_error_new(domain_cl2app, code_time_query, "failed to access current time: %s (%d)", strerror(errno), errno); return FALSE; 00369 sql_fail: if (error) *error = gx_error_new(domain_cl2app, code_database_command, "failed to log timer event: %s (%d)", sqlite3_errmsg(self->db), sqlite3_errcode(self->db)); return FALSE; 00370 } 00371 00372 #endif 00373 00374 #if defined(__EPOC32__) 00375 00376 gboolean log_db_log_flightmode(LogDb *self, gboolean value, GError **error) 00377 { 00378 time_t now = time(NULL); if (now == -1) { goto posix_fail; } 00379 if (sqlite3_bind_int(self->stmts.flightmodeStmt, 1, now)) { goto sql_fail; } 00380 if (sqlite3_bind_int(self->stmts.flightmodeStmt, 2, (value ? 1 : 0))) { goto sql_fail; } 00381 if (sqlite3_step(self->stmts.flightmodeStmt) != SQLITE_DONE) { goto sql_fail; } 00382 if (sqlite3_reset(self->stmts.flightmodeStmt)) goto sql_fail; 00383 return TRUE; 00384 posix_fail: if (error) *error = gx_error_new(domain_cl2app, code_time_query, "failed to access current time: %s (%d)", strerror(errno), errno); return FALSE; 00385 sql_fail: if (error) *error = gx_error_new(domain_cl2app, code_database_command, "failed to log flightmode event: %s (%d)", sqlite3_errmsg(self->db), sqlite3_errcode(self->db)); return FALSE; 00386 } 00387 00388 #endif 00389 00390 #if defined(__EPOC32__) 00391 00392 gboolean log_db_log_battery(LogDb *self, int status, int level, GError **error) 00393 { 00394 time_t now = time(NULL); if (now == -1) { goto posix_fail; } 00395 if (sqlite3_bind_int(self->stmts.batteryStmt, 1, now)) { goto sql_fail; } 00396 if (sqlite3_bind_int(self->stmts.batteryStmt, 2, status)) { goto sql_fail; } 00397 if (sqlite3_bind_int(self->stmts.batteryStmt, 3, level)) { goto sql_fail; } 00398 if (sqlite3_step(self->stmts.batteryStmt) != SQLITE_DONE) { goto sql_fail; } 00399 if (sqlite3_reset(self->stmts.batteryStmt)) goto sql_fail; 00400 return TRUE; 00401 posix_fail: if (error) *error = gx_error_new(domain_cl2app, code_time_query, "failed to access current time: %s (%d)", strerror(errno), errno); return FALSE; 00402 sql_fail: if (error) *error = gx_error_new(domain_cl2app, code_database_command, "failed to log battery event: %s (%d)", sqlite3_errmsg(self->db), sqlite3_errcode(self->db)); return FALSE; 00403 } 00404 00405 #endif 00406 00407 #if defined(__EPOC32__) 00408 00409 gboolean log_db_log_registration(LogDb *self, int status, GError **error) 00410 { 00411 time_t now = time(NULL); if (now == -1) { goto posix_fail; } 00412 if (sqlite3_bind_int(self->stmts.registrationStmt, 1, now)) { goto sql_fail; } 00413 if (sqlite3_bind_int(self->stmts.registrationStmt, 2, status)) { goto sql_fail; } 00414 if (sqlite3_step(self->stmts.registrationStmt) != SQLITE_DONE) { goto sql_fail; } 00415 if (sqlite3_reset(self->stmts.registrationStmt)) goto sql_fail; 00416 return TRUE; 00417 posix_fail: if (error) *error = gx_error_new(domain_cl2app, code_time_query, "failed to access current time: %s (%d)", strerror(errno), errno); return FALSE; 00418 sql_fail: if (error) *error = gx_error_new(domain_cl2app, code_database_command, "failed to log registration event: %s (%d)", sqlite3_errmsg(self->db), sqlite3_errcode(self->db)); return FALSE; 00419 } 00420 00421 #endif 00422 00423 #if defined(__EPOC32__) 00424 00425 gboolean log_db_log_signal(LogDb *self, int dbm, int bars, GError **error) 00426 { 00427 time_t now = time(NULL); if (now == -1) { goto posix_fail; } 00428 if (sqlite3_bind_int(self->stmts.signalStmt, 1, now)) { goto sql_fail; } 00429 if (sqlite3_bind_int(self->stmts.signalStmt, 2, dbm)) { goto sql_fail; } 00430 if (sqlite3_bind_int(self->stmts.signalStmt, 3, bars)) { goto sql_fail; } 00431 if (sqlite3_step(self->stmts.signalStmt) != SQLITE_DONE) { goto sql_fail; } 00432 if (sqlite3_reset(self->stmts.signalStmt)) goto sql_fail; 00433 return TRUE; 00434 posix_fail: if (error) *error = gx_error_new(domain_cl2app, code_time_query, "failed to access current time: %s (%d)", strerror(errno), errno); return FALSE; 00435 sql_fail: if (error) *error = gx_error_new(domain_cl2app, code_database_command, "failed to log signal event: %s (%d)", sqlite3_errmsg(self->db), sqlite3_errcode(self->db)); return FALSE; 00436 } 00437 00438 #endif 00439 00440 #if defined(__EPOC32__) 00441 00442 gboolean log_db_log_operator(LogDb *self, char const *operatorName, GError **error) 00443 { 00444 time_t now = time(NULL); if (now == -1) { goto posix_fail; } 00445 if (sqlite3_bind_int(self->stmts.operatorStmt, 1, now)) { goto sql_fail; } 00446 if (sqlite3_bind_text(self->stmts.operatorStmt, 2, operatorName, strlen(operatorName), SQLITE_STATIC)) { goto sql_fail; } 00447 if (sqlite3_step(self->stmts.operatorStmt) != SQLITE_DONE) { goto sql_fail; } 00448 if (sqlite3_reset(self->stmts.operatorStmt)) goto sql_fail; 00449 return TRUE; 00450 posix_fail: if (error) *error = gx_error_new(domain_cl2app, code_time_query, "failed to access current time: %s (%d)", strerror(errno), errno); return FALSE; 00451 sql_fail: if (error) *error = gx_error_new(domain_cl2app, code_database_command, "failed to log operator event: %s (%d)", sqlite3_errmsg(self->db), sqlite3_errcode(self->db)); return FALSE; 00452 } 00453 00454 #endif 00455 00456 #if __LIGHT_ENABLED__ 00457 00458 gboolean log_db_log_light(LogDb *self, int level, GError **error) 00459 { 00460 time_t now = time(NULL); if (now == -1) { goto posix_fail; } 00461 if (sqlite3_bind_int(self->stmts.lightStmt, 1, now)) { goto sql_fail; } 00462 if (sqlite3_bind_int(self->stmts.lightStmt, 2, level)) { goto sql_fail; } 00463 if (sqlite3_step(self->stmts.lightStmt) != SQLITE_DONE) { goto sql_fail; } 00464 if (sqlite3_reset(self->stmts.lightStmt)) goto sql_fail; 00465 return TRUE; 00466 posix_fail: if (error) *error = gx_error_new(domain_cl2app, code_time_query, "failed to access current time: %s (%d)", strerror(errno), errno); return FALSE; 00467 sql_fail: if (error) *error = gx_error_new(domain_cl2app, code_database_command, "failed to log light event: %s (%d)", sqlite3_errmsg(self->db), sqlite3_errcode(self->db)); return FALSE; 00468 } 00469 00470 #endif 00471 00472 #if __WITH_TAP_SENSORS__ 00473 00474 gboolean log_db_log_tap(LogDb *self, int direction, gboolean isDouble, GError **error) 00475 { 00476 time_t now = time(NULL); if (now == -1) { goto posix_fail; } 00477 if (sqlite3_bind_int(self->stmts.tapStmt, 1, now)) { goto sql_fail; } 00478 if (sqlite3_bind_int(self->stmts.tapStmt, 2, direction)) { goto sql_fail; } 00479 if (sqlite3_bind_int(self->stmts.tapStmt, 3, isDouble)) { goto sql_fail; } 00480 if (sqlite3_step(self->stmts.tapStmt) != SQLITE_DONE) { goto sql_fail; } 00481 if (sqlite3_reset(self->stmts.tapStmt)) goto sql_fail; 00482 return TRUE; 00483 posix_fail: if (error) *error = gx_error_new(domain_cl2app, code_time_query, "failed to access current time: %s (%d)", strerror(errno), errno); return FALSE; 00484 sql_fail: if (error) *error = gx_error_new(domain_cl2app, code_database_command, "failed to log tap event: %s (%d)", sqlite3_errmsg(self->db), sqlite3_errcode(self->db)); return FALSE; 00485 } 00486 00487 #endif 00488 00489 #if __PROXIMITY_ENABLED__ 00490 00491 gboolean log_db_log_proximity(LogDb *self, gboolean isClose, GError **error) 00492 { 00493 time_t now = time(NULL); if (now == -1) { goto posix_fail; } 00494 if (sqlite3_bind_int(self->stmts.proximityStmt, 1, now)) { goto sql_fail; } 00495 if (sqlite3_bind_int(self->stmts.proximityStmt, 2, isClose)) { goto sql_fail; } 00496 if (sqlite3_step(self->stmts.proximityStmt) != SQLITE_DONE) { goto sql_fail; } 00497 if (sqlite3_reset(self->stmts.proximityStmt)) goto sql_fail; 00498 return TRUE; 00499 posix_fail: if (error) *error = gx_error_new(domain_cl2app, code_time_query, "failed to access current time: %s (%d)", strerror(errno), errno); return FALSE; 00500 sql_fail: if (error) *error = gx_error_new(domain_cl2app, code_database_command, "failed to log proximity event: %s (%d)", sqlite3_errmsg(self->db), sqlite3_errcode(self->db)); return FALSE; 00501 } 00502 00503 #endif 00504 00505 #if __MUSIC_ENABLED__ 00506 00507 gboolean log_db_log_musicplayer(LogDb *self, int eventId, char const *detail, GError **error) 00508 { 00509 time_t now = time(NULL); if (now == -1) { goto posix_fail; } 00510 if (sqlite3_bind_int(self->stmts.musicplayerStmt, 1, now)) { goto sql_fail; } 00511 if (sqlite3_bind_int(self->stmts.musicplayerStmt, 2, eventId)) { goto sql_fail; } 00512 if (sqlite3_bind_text_or_null(self->stmts.musicplayerStmt, 3, detail, strlen(detail), SQLITE_STATIC)) { goto sql_fail; } 00513 if (sqlite3_step(self->stmts.musicplayerStmt) != SQLITE_DONE) { goto sql_fail; } 00514 if (sqlite3_reset(self->stmts.musicplayerStmt)) goto sql_fail; 00515 return TRUE; 00516 posix_fail: if (error) *error = gx_error_new(domain_cl2app, code_time_query, "failed to access current time: %s (%d)", strerror(errno), errno); return FALSE; 00517 sql_fail: if (error) *error = gx_error_new(domain_cl2app, code_database_command, "failed to log musicplayer event: %s (%d)", sqlite3_errmsg(self->db), sqlite3_errcode(self->db)); return FALSE; 00518 } 00519 00520 #endif 00521 00522 #if __MUSIC_ENABLED__ 00523 00524 gboolean log_db_log_musictrack(LogDb *self, char const *url, char const *title, char const *artist, char const *album, GError **error) 00525 { 00526 time_t now = time(NULL); if (now == -1) { goto posix_fail; } 00527 if (sqlite3_bind_int(self->stmts.musictrackStmt, 1, now)) { goto sql_fail; } 00528 if (sqlite3_bind_text_or_null(self->stmts.musictrackStmt, 2, url, strlen(url), SQLITE_STATIC)) { goto sql_fail; } 00529 if (sqlite3_bind_text_or_null(self->stmts.musictrackStmt, 3, title, strlen(title), SQLITE_STATIC)) { goto sql_fail; } 00530 if (sqlite3_bind_text_or_null(self->stmts.musictrackStmt, 4, artist, strlen(artist), SQLITE_STATIC)) { goto sql_fail; } 00531 if (sqlite3_bind_text_or_null(self->stmts.musictrackStmt, 5, album, strlen(album), SQLITE_STATIC)) { goto sql_fail; } 00532 if (sqlite3_step(self->stmts.musictrackStmt) != SQLITE_DONE) { goto sql_fail; } 00533 if (sqlite3_reset(self->stmts.musictrackStmt)) goto sql_fail; 00534 return TRUE; 00535 posix_fail: if (error) *error = gx_error_new(domain_cl2app, code_time_query, "failed to access current time: %s (%d)", strerror(errno), errno); return FALSE; 00536 sql_fail: if (error) *error = gx_error_new(domain_cl2app, code_database_command, "failed to log musictrack event: %s (%d)", sqlite3_errmsg(self->db), sqlite3_errcode(self->db)); return FALSE; 00537 } 00538 00539 #endif 00540 00541 #if __HTTPURL_ENABLED__ 00542 00543 gboolean log_db_log_httpurl(LogDb *self, char const *url, GError **error) 00544 { 00545 time_t now = time(NULL); if (now == -1) { goto posix_fail; } 00546 if (sqlite3_bind_int(self->stmts.httpurlStmt, 1, now)) { goto sql_fail; } 00547 if (sqlite3_bind_text(self->stmts.httpurlStmt, 2, url, strlen(url), SQLITE_STATIC)) { goto sql_fail; } 00548 if (sqlite3_step(self->stmts.httpurlStmt) != SQLITE_DONE) { goto sql_fail; } 00549 if (sqlite3_reset(self->stmts.httpurlStmt)) goto sql_fail; 00550 return TRUE; 00551 posix_fail: if (error) *error = gx_error_new(domain_cl2app, code_time_query, "failed to access current time: %s (%d)", strerror(errno), errno); return FALSE; 00552 sql_fail: if (error) *error = gx_error_new(domain_cl2app, code_database_command, "failed to log httpurl event: %s (%d)", sqlite3_errmsg(self->db), sqlite3_errcode(self->db)); return FALSE; 00553 } 00554 00555 #endif 00556 00557 #if __WEBURL_ENABLED__ 00558 00559 gboolean log_db_log_weburl(LogDb *self, char const *name, char const *url, GError **error) 00560 { 00561 time_t now = time(NULL); if (now == -1) { goto posix_fail; } 00562 if (sqlite3_bind_int(self->stmts.weburlStmt, 1, now)) { goto sql_fail; } 00563 if (sqlite3_bind_text(self->stmts.weburlStmt, 2, name, strlen(name), SQLITE_STATIC)) { goto sql_fail; } 00564 if (sqlite3_bind_text(self->stmts.weburlStmt, 3, url, strlen(url), SQLITE_STATIC)) { goto sql_fail; } 00565 if (sqlite3_step(self->stmts.weburlStmt) != SQLITE_DONE) { goto sql_fail; } 00566 if (sqlite3_reset(self->stmts.weburlStmt)) goto sql_fail; 00567 return TRUE; 00568 posix_fail: if (error) *error = gx_error_new(domain_cl2app, code_time_query, "failed to access current time: %s (%d)", strerror(errno), errno); return FALSE; 00569 sql_fail: if (error) *error = gx_error_new(domain_cl2app, code_database_command, "failed to log weburl event: %s (%d)", sqlite3_errmsg(self->db), sqlite3_errcode(self->db)); return FALSE; 00570 } 00571 00572 #endif 00573 00574 #if __PROFILE_ENABLED__ 00575 00576 gboolean log_db_log_profile(LogDb *self, int profileId, char const *profileName, GError **error) 00577 { 00578 time_t now = time(NULL); if (now == -1) { goto posix_fail; } 00579 if (sqlite3_bind_int(self->stmts.profileStmt, 1, now)) { goto sql_fail; } 00580 if (sqlite3_bind_int(self->stmts.profileStmt, 2, profileId)) { goto sql_fail; } 00581 if (sqlite3_bind_text(self->stmts.profileStmt, 3, profileName, strlen(profileName), SQLITE_STATIC)) { goto sql_fail; } 00582 if (sqlite3_step(self->stmts.profileStmt) != SQLITE_DONE) { goto sql_fail; } 00583 if (sqlite3_reset(self->stmts.profileStmt)) goto sql_fail; 00584 return TRUE; 00585 posix_fail: if (error) *error = gx_error_new(domain_cl2app, code_time_query, "failed to access current time: %s (%d)", strerror(errno), errno); return FALSE; 00586 sql_fail: if (error) *error = gx_error_new(domain_cl2app, code_database_command, "failed to log profile event: %s (%d)", sqlite3_errmsg(self->db), sqlite3_errcode(self->db)); return FALSE; 00587 } 00588 00589 #endif 00590 00591 #if __CELLID_ENABLED__ 00592 00593 gboolean log_db_log_cellid(LogDb *self, char const *countryCode, char const *networkCode, int areaCode, int cellId, GError **error) 00594 { 00595 time_t now = time(NULL); if (now == -1) { goto posix_fail; } 00596 if (sqlite3_bind_int(self->stmts.cellidStmt, 1, now)) { goto sql_fail; } 00597 if (sqlite3_bind_text(self->stmts.cellidStmt, 2, countryCode, strlen(countryCode), SQLITE_STATIC)) { goto sql_fail; } 00598 if (sqlite3_bind_text(self->stmts.cellidStmt, 3, networkCode, strlen(networkCode), SQLITE_STATIC)) { goto sql_fail; } 00599 if (sqlite3_bind_int(self->stmts.cellidStmt, 4, areaCode)) { goto sql_fail; } 00600 if (sqlite3_bind_int(self->stmts.cellidStmt, 5, cellId)) { goto sql_fail; } 00601 if (sqlite3_step(self->stmts.cellidStmt) != SQLITE_DONE) { goto sql_fail; } 00602 if (sqlite3_reset(self->stmts.cellidStmt)) goto sql_fail; 00603 return TRUE; 00604 posix_fail: if (error) *error = gx_error_new(domain_cl2app, code_time_query, "failed to access current time: %s (%d)", strerror(errno), errno); return FALSE; 00605 sql_fail: if (error) *error = gx_error_new(domain_cl2app, code_database_command, "failed to log cellid event: %s (%d)", sqlite3_errmsg(self->db), sqlite3_errcode(self->db)); return FALSE; 00606 } 00607 00608 #endif 00609 00610 #if __POSITION_ENABLED__ 00611 00612 gboolean log_db_log_position(LogDb *self, double latitude, double longitude, double altitude, double verticalAccuracy, double horizontalAccuracy, char const *course, char const *satellites, GError **error) 00613 { 00614 time_t now = time(NULL); if (now == -1) { goto posix_fail; } 00615 if (sqlite3_bind_int(self->stmts.positionStmt, 1, now)) { goto sql_fail; } 00616 if (sqlite3_bind_double(self->stmts.positionStmt, 2, latitude)) { goto sql_fail; } 00617 if (sqlite3_bind_double(self->stmts.positionStmt, 3, longitude)) { goto sql_fail; } 00618 if (sqlite3_bind_double(self->stmts.positionStmt, 4, altitude)) { goto sql_fail; } 00619 if (sqlite3_bind_double(self->stmts.positionStmt, 5, verticalAccuracy)) { goto sql_fail; } 00620 if (sqlite3_bind_double(self->stmts.positionStmt, 6, horizontalAccuracy)) { goto sql_fail; } 00621 if (sqlite3_bind_text(self->stmts.positionStmt, 7, course, strlen(course), SQLITE_STATIC)) { goto sql_fail; } 00622 if (sqlite3_bind_text(self->stmts.positionStmt, 8, satellites, strlen(satellites), SQLITE_STATIC)) { goto sql_fail; } 00623 if (sqlite3_step(self->stmts.positionStmt) != SQLITE_DONE) { goto sql_fail; } 00624 if (sqlite3_reset(self->stmts.positionStmt)) goto sql_fail; 00625 return TRUE; 00626 posix_fail: if (error) *error = gx_error_new(domain_cl2app, code_time_query, "failed to access current time: %s (%d)", strerror(errno), errno); return FALSE; 00627 sql_fail: if (error) *error = gx_error_new(domain_cl2app, code_database_command, "failed to log position event: %s (%d)", sqlite3_errmsg(self->db), sqlite3_errcode(self->db)); return FALSE; 00628 } 00629 00630 #endif 00631 00632 #if __APPFOCUS_ENABLED__ 00633 00634 gboolean log_db_log_appfocus(LogDb *self, sqlite3_int64 appUid, char const *appCaption, GError **error) 00635 { 00636 time_t now = time(NULL); if (now == -1) { goto posix_fail; } 00637 if (sqlite3_bind_int(self->stmts.appfocusStmt, 1, now)) { goto sql_fail; } 00638 if (sqlite3_bind_int64(self->stmts.appfocusStmt, 2, appUid)) { goto sql_fail; } 00639 if (sqlite3_bind_text(self->stmts.appfocusStmt, 3, appCaption, strlen(appCaption), SQLITE_STATIC)) { goto sql_fail; } 00640 if (sqlite3_step(self->stmts.appfocusStmt) != SQLITE_DONE) { goto sql_fail; } 00641 if (sqlite3_reset(self->stmts.appfocusStmt)) goto sql_fail; 00642 return TRUE; 00643 posix_fail: if (error) *error = gx_error_new(domain_cl2app, code_time_query, "failed to access current time: %s (%d)", strerror(errno), errno); return FALSE; 00644 sql_fail: if (error) *error = gx_error_new(domain_cl2app, code_database_command, "failed to log appfocus event: %s (%d)", sqlite3_errmsg(self->db), sqlite3_errcode(self->db)); return FALSE; 00645 } 00646 00647 #endif 00648 00649 #if __KEYPRESS_ENABLED__ 00650 00651 gboolean log_db_log_keypress(LogDb *self, char const *aPressTimes, GError **error) 00652 { 00653 time_t now = time(NULL); if (now == -1) { goto posix_fail; } 00654 if (sqlite3_bind_int(self->stmts.keypressStmt, 1, now)) { goto sql_fail; } 00655 if (sqlite3_bind_text(self->stmts.keypressStmt, 2, aPressTimes, strlen(aPressTimes), SQLITE_STATIC)) { goto sql_fail; } 00656 if (sqlite3_step(self->stmts.keypressStmt) != SQLITE_DONE) { goto sql_fail; } 00657 if (sqlite3_reset(self->stmts.keypressStmt)) goto sql_fail; 00658 return TRUE; 00659 posix_fail: if (error) *error = gx_error_new(domain_cl2app, code_time_query, "failed to access current time: %s (%d)", strerror(errno), errno); return FALSE; 00660 sql_fail: if (error) *error = gx_error_new(domain_cl2app, code_database_command, "failed to log keypress event: %s (%d)", sqlite3_errmsg(self->db), sqlite3_errcode(self->db)); return FALSE; 00661 } 00662 00663 #endif 00664 00665 #if __INACTIVITY_ENABLED__ 00666 00667 gboolean log_db_log_inactivity(LogDb *self, gboolean value, GError **error) 00668 { 00669 time_t now = time(NULL); if (now == -1) { goto posix_fail; } 00670 if (sqlite3_bind_int(self->stmts.inactivityStmt, 1, now)) { goto sql_fail; } 00671 if (sqlite3_bind_int(self->stmts.inactivityStmt, 2, (value ? 1 : 0))) { goto sql_fail; } 00672 if (sqlite3_step(self->stmts.inactivityStmt) != SQLITE_DONE) { goto sql_fail; } 00673 if (sqlite3_reset(self->stmts.inactivityStmt)) goto sql_fail; 00674 return TRUE; 00675 posix_fail: if (error) *error = gx_error_new(domain_cl2app, code_time_query, "failed to access current time: %s (%d)", strerror(errno), errno); return FALSE; 00676 sql_fail: if (error) *error = gx_error_new(domain_cl2app, code_database_command, "failed to log inactivity event: %s (%d)", sqlite3_errmsg(self->db), sqlite3_errcode(self->db)); return FALSE; 00677 } 00678 00679 #endif 00680 00681 #if __INDICATOR_ENABLED__ 00682 00683 gboolean log_db_log_indicator(LogDb *self, guint32 value, guint32 caps, GError **error) 00684 { 00685 time_t now = time(NULL); if (now == -1) { goto posix_fail; } 00686 if (sqlite3_bind_int(self->stmts.indicatorStmt, 1, now)) { goto sql_fail; } 00687 if (sqlite3_bind_int(self->stmts.indicatorStmt, 2, (int)value)) { goto sql_fail; } 00688 if (sqlite3_bind_int(self->stmts.indicatorStmt, 3, (int)caps)) { goto sql_fail; } 00689 if (sqlite3_step(self->stmts.indicatorStmt) != SQLITE_DONE) { goto sql_fail; } 00690 if (sqlite3_reset(self->stmts.indicatorStmt)) goto sql_fail; 00691 return TRUE; 00692 posix_fail: if (error) *error = gx_error_new(domain_cl2app, code_time_query, "failed to access current time: %s (%d)", strerror(errno), errno); return FALSE; 00693 sql_fail: if (error) *error = gx_error_new(domain_cl2app, code_database_command, "failed to log indicator event: %s (%d)", sqlite3_errmsg(self->db), sqlite3_errcode(self->db)); return FALSE; 00694 } 00695 00696 #endif 00697 00698 #if __CALLSTATUS_ENABLED__ 00699 00700 gboolean log_db_log_callstatus(LogDb *self, int value, char const *aNumber, char const *aContactName, int aStartTime, int aOsTerm, int aNetTerm, GError **error) 00701 { 00702 time_t now = time(NULL); if (now == -1) { goto posix_fail; } 00703 if (sqlite3_bind_int(self->stmts.callstatusStmt, 1, now)) { goto sql_fail; } 00704 if (sqlite3_bind_int(self->stmts.callstatusStmt, 2, value)) { goto sql_fail; } 00705 if (sqlite3_bind_text_or_null(self->stmts.callstatusStmt, 3, aNumber, strlen(aNumber), SQLITE_STATIC)) { goto sql_fail; } 00706 if (sqlite3_bind_text_or_null(self->stmts.callstatusStmt, 4, aContactName, strlen(aContactName), SQLITE_STATIC)) { goto sql_fail; } 00707 if (sqlite3_bind_int_neqz(self->stmts.callstatusStmt, 5, aStartTime)) { goto sql_fail; } 00708 if (sqlite3_bind_int_ltez(self->stmts.callstatusStmt, 6, aOsTerm)) { goto sql_fail; } 00709 if (sqlite3_bind_int_ltez(self->stmts.callstatusStmt, 7, aNetTerm)) { goto sql_fail; } 00710 if (sqlite3_step(self->stmts.callstatusStmt) != SQLITE_DONE) { goto sql_fail; } 00711 if (sqlite3_reset(self->stmts.callstatusStmt)) goto sql_fail; 00712 return TRUE; 00713 posix_fail: if (error) *error = gx_error_new(domain_cl2app, code_time_query, "failed to access current time: %s (%d)", strerror(errno), errno); return FALSE; 00714 sql_fail: if (error) *error = gx_error_new(domain_cl2app, code_database_command, "failed to log callstatus event: %s (%d)", sqlite3_errmsg(self->db), sqlite3_errcode(self->db)); return FALSE; 00715 } 00716 00717 #endif 00718 00719 #if __SMSEVENT_ENABLED__ 00720 00721 gboolean log_db_log_smsevent(LogDb *self, char const *aEvType, char const *aNumber, char const *aContactName, char const *aBodyText, GError **error) 00722 { 00723 time_t now = time(NULL); if (now == -1) { goto posix_fail; } 00724 if (sqlite3_bind_int(self->stmts.smseventStmt, 1, now)) { goto sql_fail; } 00725 if (sqlite3_bind_text(self->stmts.smseventStmt, 2, aEvType, strlen(aEvType), SQLITE_STATIC)) { goto sql_fail; } 00726 if (sqlite3_bind_text(self->stmts.smseventStmt, 3, aNumber, strlen(aNumber), SQLITE_STATIC)) { goto sql_fail; } 00727 if (sqlite3_bind_text_or_null(self->stmts.smseventStmt, 4, aContactName, strlen(aContactName), SQLITE_STATIC)) { goto sql_fail; } 00728 if (sqlite3_bind_text_or_null(self->stmts.smseventStmt, 5, aBodyText, strlen(aBodyText), SQLITE_STATIC)) { goto sql_fail; } 00729 if (sqlite3_step(self->stmts.smseventStmt) != SQLITE_DONE) { goto sql_fail; } 00730 if (sqlite3_reset(self->stmts.smseventStmt)) goto sql_fail; 00731 return TRUE; 00732 posix_fail: if (error) *error = gx_error_new(domain_cl2app, code_time_query, "failed to access current time: %s (%d)", strerror(errno), errno); return FALSE; 00733 sql_fail: if (error) *error = gx_error_new(domain_cl2app, code_database_command, "failed to log smsevent event: %s (%d)", sqlite3_errmsg(self->db), sqlite3_errcode(self->db)); return FALSE; 00734 } 00735 00736 #endif
ContextLogger2—ContextLogger2 Logger Daemon Internals—Generated on Mon May 2 13:49:56 2011 by Doxygen 1.6.1