<html><body><div style="font-family: times new roman, new york, times, serif; font-size: 12pt; color: #000000"><div>thanks daniel<br></div><div>I guess i have to use two queries here.</div><div><br></div><div>By the way is there any LIKE operation, I mean if i want to select sip:1000@xx.xx.xx.xx value by using key 1000, then which DB operation I have to use.</div><div>As far as i have seen in code file, there is no LIKE operation, only GT,LT,GET,LET,EQ,NEQ,etc.</div><div><br></div><div><span name="x"></span><div><b><span><br>--<br>Regards,<br><div><br></div>Hemanshu Patel<br><div><br></div>Senior Software Engg<br>----------------------------------------------------------------------<br><span color="#cc0000" style="color: #cc0000;" data-mce-style="color: #cc0000;">Voice and Video Over BroadBand, SIS Ahmedabad</span><br><span color="#3366ff" style="color: #3366ff;" data-mce-style="color: #3366ff;">----------------------------------------------------------------------<br>SIS | Phone +91 9408487040<br></span></span></b><b><span><span color="#3366ff" style="color: #3366ff;" data-mce-style="color: #3366ff;">Gota four cross,S. G. Highway | Fax<br>Beside Agrawal Mall ,AHMD | mailto: hemanshu.patel at saicare.com<br></span></span></b><div><b><span><span color="#3366ff" style="color: #3366ff;" data-mce-style="color: #3366ff;">----------------------------------------------------------------------</span></span></b><br><div><span style="color: rgb(0, 128, 0); "><strong>P</strong>Help the environment – please don't print this email unless you really need to!</span></div></div></div><span name="x"></span><br></div><hr id="zwchr"><div style="color:#000;font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt;"><b>From: </b>"Daniel-Constantin Mierla" <miconda@gmail.com><br><b>To: </b>"SIP Router - Kamailio (OpenSER) and SIP Express Router (SER) - Users Mailing List" <sr-users@lists.sip-router.org><br><b>Cc: </b>"Hemanshu Patel" <hemanshu.patel@saicare.com><br><b>Sent: </b>Thursday, December 6, 2012 6:09:32 PM<br><b>Subject: </b>Re: [SR-Users] How to use OR login in DB query in kamailio<br><div><br></div>
Hello,<br>
<br>
db api has support only for AND in WHERE for the db_query member.
You can print your own query and ship it to the API via
db_raw_query() (this will work of course only for SQL databases).<br>
<br>
Alternatives,<br>
- do two queries (probably not that optimal)<br>
- detect which value to use (from/to header) based on direction,
which can be detected using rr module.<br>
<br>
Cheers,<br>
Daniel<br>
<br>
<div class="moz-cite-prefix">On 12/6/12 11:08 AM, Hemanshu Patel
wrote:<br>
</div>
<blockquote cite="mid:2063887501.92184.1354788531803.JavaMail.root@saicare.com">
<div style="font-family: times new roman, new york, times, serif;
font-size: 12pt; color: #000000">
<div>Dear friends,</div>
<div><br>
</div>
<div>I have to select entries from table which has a phone
nomber in to or from column in a table.</div>
<div><br>
</div>
<div>Say a dialog tables and phone number is 1000.</div>
<div>So i need to fetch all queries where to_uri or from_uri is
like 1000.</div>
<div>I have checked the code, but i didnt find any way to do
this OR behaviour.</div>
<div>Like in following simple example</div>
<div><br>
</div>
<div>
<p>db_keys[0] = &str_expires_col;<br>
db_ops[0] = OP_LT;<br>
db_vals[0].type = DB1_INT;<br>
db_vals[0].nul = 0;<br>
db_vals[0].val.int_val = (int)time(NULL);</p>
<p>result_cols[user_col= n_result_cols++] =
&str_username_col;<br>
result_cols[domain_col=n_result_cols++] =
&str_domain_col;<br>
result_cols[etag_col=n_result_cols++] = &str_etag_col;<br>
result_cols[event_col=n_result_cols++] = &str_event_col;</p>
<p><br>
</p>
<p>This can be used where expires coloumn is less then current
unix time. But say i want to change the query like expire
value is less then xxxxxx but greater then yyyyy Then how
can i do that?</p>
<p>Should i need to use another db_key with OP_GT value?</p>
<p>What is Operation info we should use for LIKE. I mean i
need to select value which is <a class="moz-txt-link-freetext">sip:1000@xx.xx.xx.xx</a> via
searching for 1000.</p>
<p><br>
</p>
<p>I Hope i had explain the question well. Please let me know
in case any confusion in question.</p>
</div>
<div><br>
</div>
<div><span></span>
<div><b><span><br>
--<br>
Regards,<br>
<div><br>
</div>
Hemanshu Patel<br>
<span style="color: #3366ff;">----------------------------------------------------------------------<br>
</span></span></b>
<div>
<div><span style="color: rgb(0, 128, 0); "><strong>P</strong>Help
the environment – please don't print this email unless
you really need to!</span></div>
</div>
</div>
<span></span></div>
<div><br>
</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre>_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:sr-users@lists.sip-router.org" target="_blank">sr-users@lists.sip-router.org</a>
<a class="moz-txt-link-freetext" href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users" target="_blank">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users</a>
</pre>
</blockquote>
<br>
<pre class="moz-signature">--
Daniel-Constantin Mierla - <a class="moz-txt-link-freetext" href="http://www.asipto.com" target="_blank">http://www.asipto.com</a>
<a class="moz-txt-link-freetext" href="http://twitter.com/#!/miconda" target="_blank">http://twitter.com/#!/miconda</a> - <a class="moz-txt-link-freetext" href="http://www.linkedin.com/in/miconda" target="_blank">http://www.linkedin.com/in/miconda</a></pre>
</div><div><br></div></div></body></html>