Olivier FAURAX <[email protected]> wrote:
> I'm beginner and uses sqlite3.
> I'm trying to record informations in a database, but this fails.
> I have followed http://www.sqlite.org/c3ref/stmt.html
>
> rc = sqlite3_open(DB_FILENAME, &metadata_db);
> rc = sqlite3_exec(metadata_db,
>                  "CREATE TABLE IF NOT EXISTS metadata "
>                  "( filename TEXT, key INT, data BLOB, length INT);",
>                  NULL, NULL,
>                  &error);
> rc = sqlite3_prepare_v2(metadata_db,
>                   "INSERT INTO metadata VALUES "
>                   "( ?1, ?2, ?3, ?4 );",
>                   0, &sthl, NULL);

The third parameter (where you pass 0) is the length of the string 
pointed to by second parameter. So, you effectively pass an empty string 
to sqlite3_prepare_v2. You must specify an actual string length, or -1 
to have the function calculate it automatically.

Igor Tandetnik



_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to