Hi, first off thank you to all of the regulars who have made my life easier
:).
I have a C program that pulls data from a SQLite3 database into a variable
and then uses that data to do other things. However, when I iterate through
the returns (no matter how many) the data never gets outside of my while
loop. The code below should explain more:
sqlite3_exec(ptrDatabase, "BEGIN TRANSACTION;", 0, 0, 0);
intRc = sqlite3_prepare(ptrDatabase, chQuery,
strlen(chQuery), &ptrSel, NULL);
sqlite3_bind_parameter_count(ptrSel);
intRc = sqlite3_step(ptrSel);
while (intRc == SQLITE_ROW) {
int id;
sqlite3_data_count(ptrSel);
sqlite3_column_count(ptrSel);
sqlite3_column_type(ptrSel, 0);
sqlite3_column_bytes(ptrSel, 0);
id = sqlite3_column_int(ptrSel, 0);
sqlite3_column_type(ptrSel, 2);
sqlite3_column_bytes(ptrSel, 2);
chCommand = (const char
*)calloc(sqlite3_column_bytes(ptrSel, 2)+ 1, sizeof(char));
chCommand = (const char*)sqlite3_column_text(ptrSel,
2);
/* Prints successfully here */
printf("%s\n", chCommand);
intRc = sqlite3_step(ptrSel);
}
sqlite3_exec(ptrDatabase, "COMMIT TRANSACTION;", 0, 0, 0);
/* Does NOT print here */
printf("%s\n",chCommand);
Thanks in advance for any and all help.
--
Sledge