update trail ready
This commit is contained in:
parent
29ce8ac9d9
commit
2bd028910f
|
@ -142,6 +142,35 @@ int insertTrailElement(char *position, int start, double frequency)
|
|||
sqlite3_close(db);
|
||||
}
|
||||
|
||||
int updateTrailElement(int id, char *position, int start, double frequency)
|
||||
{
|
||||
|
||||
sqlite3 *db;
|
||||
sqlite3_stmt *stmt;
|
||||
|
||||
char *err_msg;
|
||||
int rc;
|
||||
int idx;
|
||||
|
||||
rc = sqlite3_open("robotgowest.db", &db);
|
||||
|
||||
rc = sqlite3_prepare_v2(db, "UPDATE Trials SET Position = :position, Start = :start, Frequency = :frequency WHERE Id = :id", -1, &stmt, NULL);
|
||||
if (rc != SQLITE_OK)
|
||||
return 1;
|
||||
|
||||
sqlite3_bind_text(stmt, 1, position, -1, SQLITE_STATIC);
|
||||
|
||||
sqlite3_bind_int(stmt, 2, start);
|
||||
|
||||
sqlite3_bind_double(stmt, 3, frequency);
|
||||
|
||||
sqlite3_bind_int(stmt, 4, id);
|
||||
|
||||
rc = sqlite3_step(stmt);
|
||||
rc = sqlite3_finalize(stmt);
|
||||
sqlite3_close(db);
|
||||
}
|
||||
|
||||
int insertCaptorMetadataElement(int captorNumber, int trialId)
|
||||
{
|
||||
|
||||
|
@ -203,12 +232,13 @@ int main(void)
|
|||
{
|
||||
sqlite3_initialize();
|
||||
|
||||
// initializeTrailsTable();
|
||||
initializeTrailsTable();
|
||||
// initializeCaptorMetadataTable();
|
||||
// createCaptorDataTable(12, 8);
|
||||
// insertTrailElement("test", 1, 3.0, 9);
|
||||
// insertTrailElement("test", 1, 3.0);
|
||||
// insertCaptorMetadataElement(1, 2);
|
||||
// insertCaptorDataElement(12, 8, 10, 121, 1513);
|
||||
updateTrailElement(1, "test2", 122, 22);
|
||||
|
||||
sqlite3_shutdown();
|
||||
}
|
BIN
Db-Script/db
BIN
Db-Script/db
Binary file not shown.
Binary file not shown.
Loading…
Reference in a new issue