if (sqlite3_prepare_v2(db, query, -1, &stmt, 0) == SQLITE_OK)
{
rs = new Records();
int cols = sqlite3_column_count(stmt);
int result;
do
{
result = sqlite3_step(stmt);
if (result == SQLITE_ROW)
{
r = new Record();
for (int i = 0; i < cols; i++)
{
c = new Column();
c->colName = sqlite3_column_name(stmt, i);
c->data.datai = sqlite3_column_int(stmt, i);
c->data.datal = sqlite3_column_int64(stmt, i);
dataP = sqlite3_column_text(stmt, i);
memcpy((void*)c->data.datac, (void*) dataP, 512);
r->columns.push_back(c);
}
rs->record.push_back(r);
}
} while(result == SQLITE_ROW);
How would I get the current primary key and table name automatically?
I need to know this because I want to implement a delete method into my database wrapper so people can just do record->delete(); nice and easy no query involved.