<div dir="ltr">Here [1] is where your issue is. That it simply executes the query but returns no results. I guess we need to have some conditional to run the update function for update statements instead.<div><br></div><div>[1] <a href="https://github.com/OpenSIPS/opensips/blob/98dccc53f4c25da6edf756333ef45a93bc2f41c7/modules/db_sqlite/dbase.c#L336" target="_blank">https://github.com/OpenSIPS/opensips/blob/98dccc53f4c25da6edf756333ef45a93bc2f41c7/modules/db_sqlite/dbase.c#L336</a><br></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Nov 3, 2015 at 1:03 PM, Patrick Wakano <span dir="ltr"><<a href="mailto:pwakano@gmail.com" target="_blank">pwakano@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">I think Opensips lexer is converting your 'yes' to the integer 1 when running the SQL query in your DB.<div>See this thread:<br></div><div><div><a href="http://lists.opensips.org/pipermail/users/2015-February/030946.html" target="_blank">http://lists.opensips.org/pipermail/users/2015-February/030946.html</a><br></div><div><br></div><div>Try to use something different from 'yes' to see what happens.</div><span class="HOEnZb"><font color="#888888"><div><br></div><div>Patrick</div><div><br></div></font></span></div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Nov 3, 2015 at 3:50 PM, Rodrigo Pimenta Carvalho <span dir="ltr"><<a href="mailto:pimenta@inatel.br" target="_blank">pimenta@inatel.br</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">
<div style="font-size:12pt;color:#000000;background-color:#ffffff;font-family:Calibri,Arial,Helvetica,sans-serif">
<p>Hi Aron.</p>
<p><br>
</p>
<p>Do you know whether it is necessary to commit the modifications made by avp_db_query("Update....") ?</p>
<p>Is there some kind of ' commit' command to be executed in the OpenSIPS script?</p><span>
<p><br>
</p>
<p>Any hint will be very helpful!</p>
<p><br>
</p>
</span><p>Thanks a lot.<br>
</p><span>
<p><br>
</p>
<div>
<div name="divtagdefaultwrapper">
<div><font size="2">
<div>RODRIGO PIMENTA CARVALHO<br>
Inatel Competence Center<br>
Software<br>
Ph: <a href="tel:%2B55%2035%203471%209200" value="+553534719200" target="_blank">+55 35 3471 9200</a> RAMAL 979<br>
</div>
</font></div>
</div>
</div>
<br>
<br>
</span><div style="color:rgb(0,0,0)">
<hr style="display:inline-block;width:98%">
<div dir="ltr"><font style="font-size:11pt" color="#000000" face="Calibri, sans-serif"><span><b>De:</b> <a href="mailto:users-bounces@lists.opensips.org" target="_blank">users-bounces@lists.opensips.org</a> <<a href="mailto:users-bounces@lists.opensips.org" target="_blank">users-bounces@lists.opensips.org</a>> em nome de Podrigal, Aron <<a href="mailto:aronp@guaranteedplus.com" target="_blank">aronp@guaranteedplus.com</a>><br>
<b>Enviado:</b> terça-feira, 3 de novembro de 2015 15:26<br>
<b>Para:</b> OpenSIPS users mailling list<br>
</span><b>Assunto:</b> Re: [OpenSIPS-Users] Can I use 'UPDATE' in avp_db_query ?</font>
<div> </div>
</div><div><div>
<div>
<div dir="ltr">Try removing the second argument <i style="color:rgb(0,0,0);font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16px">"$avp(CallMaxDuration)"</i> from avp_db_query() Because the database backend does not return any results.</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">On Tue, Nov 3, 2015 at 8:50 AM, Rodrigo Pimenta Carvalho
<span dir="ltr"><<a href="mailto:pimenta@inatel.br" target="_blank">pimenta@inatel.br</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">
<div style="font-size:12pt;color:#000000;background-color:#ffffff;font-family:Calibri,Arial,Helvetica,sans-serif">
<p>Dear OpenSIPS-users,</p>
<p><br>
</p>
<p>In the OpenSIPS database I have created some new tables, for my project. I can read from such tables successfully. For example, the instruction</p>
<p><br>
</p>
<p> <i>avp_db_query("select Value from GeneralConfigurations where Attribute = 'CallMaxDuration'", "$avp(CallMaxDuration)");</i></p>
<p><br>
</p>
<p>run and works very well. It put the right value in the apv!</p>
<p><br>
</p>
<p>However, when the following instruction is executed, it doesn't take any effect in the database:</p>
<p><br>
</p>
<p><i> avp_db_query("update GeneralConfigurations set Value = 'yes' where Attribute = 'Exists_Intercom_Call'", "$avp(UpdateResult)");</i></p>
<p><br>
</p>
<p>The log says:</p>
<p>-----------------------------------------------------------------------------------------------------------------------------------------------------------------------</p>
<p><br>
</p>
<p>Nov 3 11:32:52 [29114] DBG:avpops:ops_dbquery_avps: query [update GeneralConfigurations set Value = 'yes' where Attribute = 'Exists_Intercom_Call']<br>
Nov 3 11:32:52 [29114] DBG:avpops:db_query_avp: no result after query<br>
Nov 3 11:32:52 [29114] DBG:avpops:db_close_query: close avp query<br>
Nov 3 11:32:52 [29114] ERROR:db_sqlite:db_sqlite_free_result: <font color="#FF0000">
invalid parameter value</font></p>
<p><br>
</p>
<p>------------------------------------------------------------------------------------------------------------------------------------------------------------------------------</p>
<p><br>
</p>
<p>But the query UPDATE is correct, because I have already tested it directly in the database.</p>
<p><br>
</p>
<p>So, am I doing something wrong? What exactly does mean that error "invalid parameter value" in this case? Can I use UPDATE in an avp_db_query?</p>
<p><br>
</p>
<p>Any hint will be very helpful!</p>
<p><br>
</p>
<p>Best regards.<span><font color="#888888"><br>
</font></span></p>
<span><font color="#888888">
<p><br>
</p>
<p><br>
</p>
<p><br>
</p>
<p><br>
</p>
<p><br>
</p>
<p><br>
</p>
<p><br>
</p>
<div>
<div name="divtagdefaultwrapper">
<div><font size="2">
<div>RODRIGO PIMENTA CARVALHO<br>
Inatel Competence Center<br>
Software<br>
Ph: <a href="tel:%2B55%2035%203471%209200" value="+553534719200" target="_blank">
+55 35 3471 9200</a> RAMAL 979<br>
</div>
</font></div>
</div>
</div>
</font></span></div>
</div>
<br>
_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a><br>
<a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" rel="noreferrer" target="_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a><br>
<br>
</blockquote>
</div>
<br>
<br clear="all">
<div><br>
</div>
-- <br>
<div>
<div dir="ltr">
<div>
<div dir="ltr">Aron Podrigal
<div>-</div>
<div>'1000001', '1110010', '1101111', '1101110' '1010000', '1101111', '1100100', '1110010', '1101001', '1100111', '1100001', '1101100'</div>
<div><br>
</div>
<div>P: '2b', '31', '33', '34', '37', '34', '35', '38', '36', '30', '39', '39'<br>
</div>
<div><br>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div></div></div>
</div>
</div>
<br>_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a><br>
<a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" rel="noreferrer" target="_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a><br>
<br></blockquote></div><br></div>
</div></div><br>_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@lists.opensips.org">Users@lists.opensips.org</a><br>
<a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" rel="noreferrer" target="_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr"><div><div dir="ltr">Aron Podrigal<div>-</div><div>'1000001', '1110010', '1101111', '1101110' '1010000', '1101111', '1100100', '1110010', '1101001', '1100111', '1100001', '1101100'</div><div><br></div><div>P: '2b', '31', '33', '34', '37', '34', '35', '38', '36', '30', '39', '39'<br></div><div><br></div></div></div></div></div>
</div>