esp32_arduino_sqlite3_lib
esp32_arduino_sqlite3_lib copied to clipboard
Disk I/O Error when creating database table inline with AUTOINCREMENT
Hi,
I'm getting an error "Disk I/O" from sqlite3_exec after attempting a CREATE TABLE statement that has extended attributes, namely trying to define a primary key with auto increment inline as a single statement.
As an example, the following statement works:
CREATE TABLE tblThisWorks (TimeStampUTC TEXT, Condition TEXT);
This statement never works for me:
CREATE TABLE tblThisDoesntWork (ID INTEGER, TimeStampUTC TEXT, Condition TEXT. PRIMARY KEY(ID AUTOINCREMENT));
I'm running this on an ESP32-S2-DevKit using SPIFFS. Everything works except trying to create the table with an extended attribute such as a primary key. Equally strange is the fact that the API returns "Disk I/O Error".
The actual code statement which throws the error looks like this:
rc = sqlite3_exec(db, " tblThisDoesntWork (ID INTEGER, TimeStampUTC TEXT, Condition TEXT. PRIMARY KEY(ID AUTOINCREMENT));", 0, 0, &err_msg);