On Tue, May 06, 2008 at 04:26:55PM -0400, cedric tuboeuf scratched on the wall:
> Is there a way of doing that in one single shot :
> UPDATE Contacts SET Age = 30 WHERE ID = 1; UPDATE Contacts SET Age = 30
> WHERE ID = 2; UPDATE Contacts SET Age = 20 WHERE ID = 3; UPDATE Contacts SET
> Age = 10 WHERE ID = 4;

  You should be able to do this in the sqlite3 CLI tool.

  You should also be able to do this sqlite3_exec(), which accepts
  multiple statements in one string.

  You will not be able to do this with sqlite3_prepare*(), however, as
  those functions only accept a single SQL statement.  In specific:
  "These routines only compiles the first statement in zSql, so *pzTail
  is left pointing to what remains uncompiled."  You can use the pzTail
  value to keep calling sqlite3_prepare() to walk through multiple SQL
  statements in the same string.

  If you pass this whole thing as a statement to sqlite3_prepare() and
  step() through it, I would expect the first UPDATE to execute, but none
  of the others.

   -j

-- 
Jay A. Kreibich < J A Y  @  K R E I B I.C H >

"'People who live in bamboo houses should not throw pandas.' Jesus said that."
   - "The Ninja", www.AskANinja.com, "Special Delivery 10: Pop!Tech 2006"
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to