We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hi
I am trying to port sqlite3 VFS implementation on freertos with stm32. I have created an amalgamation with sqlite3 version 3.12 base code.
When I run the below code it runs to create a database and a query "create a table cars". But when query "insert" is run then fails with following error:-
error no: 26(SQLITE_NOTADB) error: "file is encrypted or is not a database"
I have given following options during compile:
SQLITE_THREADSAFE=0 SQLITE_OS_OTHER=1 SQLITE_OMIT_WAL=1
Any pointer would really help.
Have a sample code as below:
sqlite3 *db = NULL; char *zErrMsg = 0; int rc; char *sql; rc = sqlite3_vfs_register(sqlite3_demovfs(), 1); /* Register a VFS */ if(rc != SQLITE_OK) { abort(); } rc = sqlite3_open_v2("testsql.db", &db, SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE , "demo" );/* Create a SQL table */ if( rc ) { abort(); } sql = "PRAGMA journal_mode=OFF";/* Create SQL statement */ rc = sqlite3_exec(db, sql, NULL, NULL, &zErrMsg);/* Execute SQL statement */ if( rc != SQLITE_OK ) { sqlite3_free(zErrMsg); abort(); } sql ="CREATE TABLE Cars(Id INT, Name TEXT, Price INT);" ;/* Create SQL statement */ rc = sqlite3_exec(db, sql, NULL, NULL, &zErrMsg);/* Execute SQL statement */ if( rc != SQLITE_OK ) { sqlite3_free(zErrMsg); abort(); } sql = "INSERT INTO Cars VALUES(1, 'Audi', 52642);"/* Create SQL statement */ "INSERT INTO Cars VALUES(2, 'Skoda', 9000);"; rc = sqlite3_exec(db, sql, NULL, NULL, &zErrMsg);/* Execute SQL statement */ if( rc != SQLITE_OK ) { sqlite3_free(zErrMsg); abort(); } sql = "SELECT * from Cars";/* Create SQL statement */ const char* data = "Callback function called"; rc = sqlite3_exec(db, sql, callback, (void *)data, &zErrMsg);/* Execute SQL statement */ if( rc != SQLITE_OK ) { sqlite3_free(zErrMsg); abort(); } sqlite3_close(db);
I am not sure if this is a right forum to ask this amalgamation.
Hi,
Any progress in your port ? I'am interested to have a feedback of your work.
Thanks, BR.
Hi Nitin
I too am trying to use sqLite with STM Cortex processors.
I am using the H7 which has 2 MByte flash and 1 MByte of ram, which should be plenty for sqLite, freeRTOS and Fatfs.
I tried using the amalgamation of sqLite, but couldn't get the thing to even compile let alone run. I have the following questions:
- What IDE are you using? I'm using Keil uVision 5
- What did you have to do to get it to compile?
- Did you get your system up and running.
Best regards
Rob
I am trying filezillao port sqlite3 VFS implementation o rufus n freertos with stm32. uc browserI have created an amalgamation with sqlite3 version 3.12 base code.