Hello,
The following code is part of my sqlite extension code I used to persist the 
‘locale’ setting for a database. Based on this, I’ve build a sqlite shell that 
I can set the locale value using pragma statement. The question is:  how to 
raise errors instead of using ‘printf("SQL error: %s\n", sqlite3_errmsg(db))’ 
in the extension code, so the locale setting and error catching can be used at 
the situations other than sqlite shell.  Thanks.


static void getLocale(sqlite3 *db) {
   sqlite3_stmt *stmt;
   int rc = 0;

   rc = sqlite3_prepare_v2(db, "SELECT col_locale FROM locale", -1, &stmt, 0);
   if( rc ) {
      printf("SQL error: %s\n", sqlite3_errmsg(db));
   }
   else {
         ......
   }
   sqlite3_finalize(stmt);

   return;
}

static void setLocale(sqlite3* db, char* zLocale, int flag){
  ......
}

_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to