Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SQLite in Native Client

I am trying to use sqlite3 in a Native Client application. There is a port available in the Chromium project, but I was unable to make it run properly. My problem is that, for some reason, the application is unable to open a DB since a call like sqlite3_open("/filename.db", &db); fails with an I/O error. I mounted / to a html5fs file system.

Has anybody managed to use SQLite with Native Client? If so, I would really like to see a simple code that does something like opening a DB, CREATE a table, INSERT something and do a SELECT.

like image 298
skortzy Avatar asked Mar 15 '26 12:03

skortzy


1 Answers

Struggled for almost a day, I found a workaround to skip the disk I/O error with specifying a VFS parameter.

sqlite3_open_v2(filename, &db, SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE | SQLITE_OPEN_NOMUTEX, "unix-none");

For more information about VFS, please see http://www.sqlite.org/vfs.html My testing environment is on a chrome extension.

like image 134
caffeinic Avatar answered Mar 21 '26 07:03

caffeinic