I am looking for a simple interface for prepared statements in c that follows the printf structure.
Something along the lines of:
sqlite3 *connection;
sqlite3_open("db", &connection);
char *id = "chacham15";
int count = 5;
ArrayList* results = sqlite3_preparef(connection, "SELECT * FROM Data WHERE id=%s AND count=%d ", id, count);
I was looking at documentation and couldnt find any similar functions. I would rather not rewrite the code if it exists, therefore, does anyone know of such a function? Any help is much appreciated. I know how I can implement this myself if necessary, Im just hoping that its not.
Just use snprintf() then sqlite3_prepare_v2(). If you want to write a wrapper function that does both, look up stdarg (to make a variadic function) and vsnprintf().