Open asbs-eng opened 1 month ago
@asbs-eng
sqlite3_close()
should be executed after sqlite3_finalize()
yes you right i add sqlite3_reset() before sqlite3_finalize() and now it run perfectly , i think it because memory issue so after do select statement i clear memory.
i open database everytime for running SQL because there are more than 1 database each for different user and the code above is just a concise example for the entire program.
In this way, I think the problem has been resolved, thank you
i use esp32 (arduino) after several select command (read_data())
int read_data() { sqlite3 *db1; int rc = sqlite3_open("/sd/test.db", &db1);
if (rc) {
Serial.print("Can't open database ("); Serial.print(String(rc)); Serial.print(") : "); Serial.println(sqlite3_errmsg(db1)); } else {
sqlite3_stmt stmt; String sql = "SELECT FROM tbl_data WHERE tgl>'2024-07-31 08:08:21' AND counter>450 ORDER BY tgl DESC , counter DESC;";
}
return rc; }
i have error 14 (SQLITE_CANTOPEN) unable to open database file int rc = sqlite3_open("/sd/test.db", &db1); where i get rc = 14