you should change this:
rc = sqlite3_exec(memdb, "insert into dummy values (\"dummy\", \"user\")",
to this:
rc = sqlite3_exec(memdb, "insert into dummy values ('dummy', 'user')",
You need single quotes for strings



On 5/31/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
I am pretty sure it is something trivial but it does not work for me, can
someone please help me figure out what I may be missing.

What happens is that the call to sqlite3_bind_text returns error 25
(SQLITE_RANGE). This is caused because p->nVar is set to 0 and I am
passing 1.
How can I know how many rows are in my table otherwise ?

Mario Hebert
Legerity
_____________________________________________________________________________________


char query[1024];

rc = sqlite3_open(":memory:", &memdb);
if( rc ) {
          (void)sqlite3_close(memdb);
        return ;
}

rc = sqlite3_exec(memdb, "create table dummy(fielda varchar(32), fieldb
varchar(32) )", NULL, 0, &zErrMsg);
if( rc ) {
       return ;
}

rc = sqlite3_exec(memdb, "insert into dummy values (\"dummy\", \"user\")",
NULL, 0, &zErrMsg);
if( rc ) {
       return ;
}

strcpy( query, "select count(*) from dummy");

rc = sqlite3_prepare( memdb, query, strlen(query), &pStmt, NULL);
if (rc) {
        return;
}

rc = sqlite3_bind_text( pStmt, 1, query, strlen(query), SQLITE_STATIC);
if ( rc) {
        return ;
}



--
SqliteImporter, SqliteReplicator: Command line utilities for Sqlite
http://www.reddawn.net/~jsprenkl/Sqlite

Reply via email to