> On July 23, 2014, 2:58 p.m., Tilghman Lesher wrote: > > As long as you're doing multiple statements, might it be faster to do a > > SELECT first and then conditionally do an INSERT or UPDATE, depending upon > > the results of that SELECT? It would seem as if one read and one write > > operation should always be faster than two write operations.
It does seem that it is faster to do a SELECT first. My theory (which was back by some errors that have come to light) was that an attempted write that didn't actually write and was ignored would be faster. But, with some testing I see now that this thinking was wrong on my part. - Michael ----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviewboard.asterisk.org/r/3841/#review12839 ----------------------------------------------------------- On July 23, 2014, 1:21 p.m., Michael Young wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://reviewboard.asterisk.org/r/3841/ > ----------------------------------------------------------- > > (Updated July 23, 2014, 1:21 p.m.) > > > Review request for Asterisk Developers and Joshua Colp. > > > Bugs: ASTERISK-24050 > https://issues.asterisk.org/jira/browse/ASTERISK-24050 > > > Repository: Asterisk > > > Description > ------- > > The CI testing found a regression with the last patch. Yea! The UPDATE was > not functioning as expected. I am pretty sure I tested UPDATES but obviously > missed something. > > sqlite3_prepare() does not handle multiple SQL statements in a single call. > If there are more than one present, it will only use the first statement and > ignore the rest. > > This patch separates the INSERT INTO and the UPDATE into two separate > statements for use by sqlite3_prepare. These two statements are then run > when ast_db_put() is called. > > > Diffs > ----- > > /trunk/main/db.c 419309 > > Diff: https://reviewboard.asterisk.org/r/3841/diff/ > > > Testing > ------- > > I turned on tracing in order to see this problem and also to confirm that > this patch was functioning again as expected. > > I ran the testsuite test that was failing before the patch and then after the > patch to confirm that the test no passes as well. > > > Thanks, > > Michael Young > >
-- _____________________________________________________________________ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- asterisk-dev mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-dev