<html>
 <body>
  <div style="font-family: Verdana, Arial, Helvetica, Sans-Serif;">
   <table bgcolor="#f9f3c9" width="100%" cellpadding="8" style="border: 1px #c9c399 solid;">
    <tr>
     <td>
      This is an automatically generated e-mail. To reply, visit:
      <a href="https://reviewboard.asterisk.org/r/3841/">https://reviewboard.asterisk.org/r/3841/</a>
     </td>
    </tr>
   </table>
   <br />





<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
 <p style="margin-top: 0;">On July 23rd, 2014, 2:58 p.m. EDT, <b>Tilghman Lesher</b> wrote:</p>
 <blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
  <pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">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.</pre>
 </blockquote>







</blockquote>

<pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">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.</pre>
<br />










<p>- Michael</p>


<br />
<p>On July 23rd, 2014, 1:21 p.m. EDT, Michael Young wrote:</p>








<table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="8" style="background-image: url('https://reviewboard.asterisk.org/static/rb/images/review_request_box_top_bg.ab6f3b1072c9.png'); background-position: left top; background-repeat: repeat-x; border: 1px black solid;">
 <tr>
  <td>

<div>Review request for Asterisk Developers and Joshua Colp.</div>
<div>By Michael Young.</div>


<p style="color: grey;"><i>Updated July 23, 2014, 1:21 p.m.</i></p>







<div style="margin-top: 1.5em;">
 <b style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Bugs: </b>


 <a href="https://issues.asterisk.org/jira/browse/ASTERISK-24050">ASTERISK-24050</a>


</div>



<div style="margin-top: 1.5em;">
 <b style="color: #575012; font-size: 10pt;">Repository: </b>
Asterisk
</div>


<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Description </h1>
 <table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: 1px solid #b8b5a0">
 <tr>
  <td>
   <pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">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.</pre>
  </td>
 </tr>
</table>


<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Testing </h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: 1px solid #b8b5a0">
 <tr>
  <td>
   <pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">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.</pre>
  </td>
 </tr>
</table>


<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Diffs</b> </h1>
<ul style="margin-left: 3em; padding-left: 0;">

 <li>/trunk/main/db.c <span style="color: grey">(419309)</span></li>

</ul>

<p><a href="https://reviewboard.asterisk.org/r/3841/diff/" style="margin-left: 3em;">View Diff</a></p>







  </td>
 </tr>
</table>








  </div>
 </body>
</html>