Hey Kurt, Have you tried this yet? I was just doing the design for a project and wondered if sqlite3 was reentrant. Can I use the open database connection and execute an sql statement from within the callback of another statement?
--- Kurt Welgehausen <[EMAIL PROTECTED]> wrote: > >> for every testcs in (select checksum from test) do > >> update test set id = > >> (select bucketid from buckets > >> where buckets.checksum = testcs) > >> where test.checksum = testcs > > > ... this is not very efficient way of updating multiple rows. > > It may not be as inefficient as you think, if your host > language is C. SQLite does not do global optimizations, > so breaking a statement into parts doesn't have the effect > it might have in a 'big' database, especially if you put > your loop inside a transaction (I should have mentioned > that before). > > Also, if you have a performance problem, you can try > putting indices on test.checksum and buckets.checksum > (not sure if SQLite will use both, but you can find out > by using explain in the SQLite shell). There's a good > concise explanation of using indices in SQLite in the > slides from the recent PHP conference, accessible from > the main SQLite web page > > > Are there any short/medium-term plans ... ? > > I can't speak for the developers, but I'd be surprised > > Regards, > Kurt Welgehausen > ===== --------------------------------- "Lord Tarlington gazed upon the crazed Egyptian hieroglyphics on the walls of the ancient tomb of the petrified pharaoh, he vowed there would be no curse on him like on that other Lord, unless you count his marriage to Lady Tarlington who, when the lost treasure was found, will be dumped faster than that basket in the bulrushes." Melissa Rhodes --------------------------------- The Castles of Dereth Calendar: a tour of the art and architecture of Asheron's Call http://www.lulu.com/content/77264 __________________________________ Do you Yahoo!? Read only the mail you want - Yahoo! Mail SpamGuard. http://promotions.yahoo.com/new_mail