Hi NK,

[EMAIL PROTECTED] wrote:

Hi,
what is the correct syntax to use for WHERE expression:

   if (sqlite3_exec(test_db, "CREATE TABLE ana_db (item1 integer, item2 integer, 
item3 integer, item4 integer, item5 integer);", NULL, 0, NULL))
     sqlite_error(test_db);

// create index
if (sqlite3_exec(test_db, "CREATE INDEX item1idx ON ana_db (item1);", NULL, 0, 
NULL))
     sqlite_error(test_db);

     // insert values for 1000 records
     for (ii=0; ii< 1000; ii++)
        {
          if (error_code = sqlite3_exec(test_db, "INSERT INTO ana_db VALUES ('ii', 
1, 0, 1, 100);", NULL, 0, NULL))
            {
              sqlite_error(test_db);
              return (-1);
            }
        }

// update values for 1000 records
     for (ii=0; ii< 1000; ii++)
        {
          if (error_code = sqlite3_exec(test_db, "UPDATE ana_db SET item2=item2+1 
WHERE item1='ii';", NULL, 0, NULL))
            {
              sqlite_error(test_db);
              return (-1);
            }
       }

It looks like I'm not using the right syntax in UPDATE statement, I tried with: WHERE item1 = $ii, w/out success. What am I doing wrong?

Thanks,

NK



you want the sqlite3_bind_int API. Look it up on the www.sqlite.org website.


HTH

Ulrik



--
Ulrik Petersen, MA, B.Sc.
University of Aalborg, Denmark
Homepage: http://ulrikp.org




Reply via email to