I have the following code, which when executed, crashes the esp32 with Guru Meditation Error: Core 1 panic'ed (Unhandled debug exception)
. I'm wondering if there is something wrong with this code that I have overlooked. It produces valid sql that can be executed directly in Sqlite.
sqlite3 *db;
sqlite3_open("db.db", db);
sqlite3_stmt *res;
int rc;
char *sql = "INSERT INTO messages ( \"port\", \"to\", \"status\" ) VALUES ( @port, @to, 'outbox' )";
rc = sqlite3_prepare_v2(db, sql, -1, &res, 0);
if (rc == SQLITE_OK) {
int portBind = sqlite3_bind_parameter_index(res, "@port");
int toBind = sqlite3_bind_parameter_index(res, "@to");
sqlite3_bind_int(res, portBind, 1);
sqlite3_bind_text(res, toBind, "test", -1, SQLITE_TRANSIENT);
Serial.println(sqlite3_expanded_sql(res)); //This is valid sql.
int step = sqlite3_step(res); //This line crasehs
}