Esempio n. 1
0
sqlg_handle_t sqlg_db_prepare_st(sqlg_handle_t db, const char *sql)
{
  sqlite3 *mydb = HANDLE_TO_VP(db);
  sqlite3_stmt *s;
  int rv;

  __android_log_print(ANDROID_LOG_VERBOSE, "sqlg", "prepare db %p sql %s", mydb, sql);

  rv = sqlite3_prepare_v2(mydb, sql, -1, &s, NULL);

  return (rv == 0) ? HANDLE_FROM_VP(s) : -rv;
}
sqlc_handle_t sqlc_db_prepare_st(sqlc_handle_t db, const char *sql)
{
  sqlite3 *mydb = HANDLE_TO_VP(db);
  sqlite3_stmt *s;
  int rv;

  MYLOG("prepare db %p sql %s", mydb, sql);

  rv = sqlite3_prepare_v2(mydb, sql, -1, &s, NULL);

  return (rv == 0) ? HANDLE_FROM_VP(s) : -rv;
}
sqlc_handle_t sqlc_db_open(const char *filename, int flags)
{
  sqlite3 *d1;
  int r1;

  MYLOG("db_open %s %d", filename, flags);

  r1 = sqlite3_open_v2(filename, &d1, flags, NULL);

  MYLOG("db_open %s result %d ptr %p", filename, r1, d1);

  return (r1 == 0) ? HANDLE_FROM_VP(d1) : -r1;
}
Esempio n. 4
0
sqlg_handle_t sqlg_db_open(const char *filename, int flags)
{
  sqlite3 *d1;
  int r1;

  // see http://stackoverflow.com/questions/7030760/how-to-print-log-address-of-a-variable-in-ndk
  // and http://www.ibm.com/developerworks/opensource/tutorials/os-androidndk/section5.html

  __android_log_print(ANDROID_LOG_VERBOSE, "sqlg", "db_open %s %d", filename, flags);

  r1 = sqlite3_open_v2(filename, &d1, flags, NULL);

  __android_log_print(ANDROID_LOG_VERBOSE, "sqlg", "db_open %s result %d ptr %p", filename, r1, d1);

  return (r1 == 0) ? HANDLE_FROM_VP(d1) : -r1;
}