I posted this question earlier, but as it is pointed to one person there is no response.
I'm trying to get the sqlite3 database working but I get stuck on the sqlite3_prepare_V2 statement.
This the relevant code:
Code: [Select]
#include <string.h>
#include <stdlib.h>
#include <sqlite3.h>
int main(int argc, const char * argv[])
{
sqlite3 *db;
if (sqlite3_open("the_insert.db", &db))
{
printf("Could not open the.db\n");
exit(-1);
}
printf("Database %s is open\n", "the_insert.db");
//
// Prepare a statement for multiple use:
// =====================================
//
char sqlQuery[] = "INSERT INTO someTable (second, third) VALUES (?,?)";
sqlite3_stmt *stmt;
if (sqlite3_prepare_v2(db, sqlQuery, -1, &stmt, NULL))
{
printf("Error executing prepare statement\n");
sqlite3_close(db);
exit(-1);
}
The message is:
Database the_insert.db is open
Error executing prepare statement.
Rest asure that someTable is in place and with the expected structure.
What is going on with that statement: "sqlite3_prepare_v2"?
I've searched all I can with mr G. but no luck.
Any help will be welcome.
I found 3 different GitHub repositories that contain a file named "sqlite3.h". Perhaps you'd be kind enough to tell us which one YOU'RE using. Provide a clickable link to the GitHub.
@wildbill,
When I use "sqlite3_errmsg(db)" I only get the table name, which is of no use in this case.
Are there more specific codes in sqlite3_errmsg(...)?
@gfvalvo
I use the library <sqlite3.h> that comes with Xcode. Oh, Oh, do I have to distrust Xcode in this way?
pagemaker:
When I use "sqlite3_errmsg(db)" I only get the table name, which is of no use in this case.
Are there more specific codes in sqlite3_errmsg(...)?
I don't know, but I do note that the call to prepare returns a numeric error which might give a clue as to what's failing.