thanks daniel
I guess i have to use two queries here.
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.
As far as i have seen in code file, there is no LIKE operation, only
GT,LT,GET,LET,EQ,NEQ,etc.
--
Regards,
Hemanshu Patel
Senior Software Engg
----------------------------------------------------------------------
Voice and Video Over BroadBand, SIS Ahmedabad
----------------------------------------------------------------------
SIS | Phone +91 9408487040
Gota four cross,S. G. Highway | Fax
Beside Agrawal Mall ,AHMD | mailto: hemanshu.patel at
saicare.com
----------------------------------------------------------------------
P Help the environment – please don't print this email unless you really need to!
----- Original Message -----
From: "Daniel-Constantin Mierla" <miconda(a)gmail.com>
To: "SIP Router - Kamailio (OpenSER) and SIP Express Router (SER) - Users Mailing
List" <sr-users(a)lists.sip-router.org>
Cc: "Hemanshu Patel" <hemanshu.patel(a)saicare.com>
Sent: Thursday, December 6, 2012 6:09:32 PM
Subject: Re: [SR-Users] How to use OR login in DB query in kamailio
Hello,
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).
Alternatives,
- do two queries (probably not that optimal)
- detect which value to use (from/to header) based on direction, which can be detected
using rr module.
Cheers,
Daniel
On 12/6/12 11:08 AM, Hemanshu Patel wrote:
Dear friends,
I have to select entries from table which has a phone nomber in to or from column in a
table.
Say a dialog tables and phone number is 1000.
So i need to fetch all queries where to_uri or from_uri is like 1000.
I have checked the code, but i didnt find any way to do this OR behaviour.
Like in following simple example
db_keys[0] = &str_expires_col;
db_ops[0] = OP_LT;
db_vals[0].type = DB1_INT;
db_vals[0].nul = 0;
db_vals[0].val.int_val = (int)time(NULL);
result_cols[user_col= n_result_cols++] = &str_username_col;
result_cols[domain_col=n_result_cols++] = &str_domain_col;
result_cols[etag_col=n_result_cols++] = &str_etag_col;
result_cols[event_col=n_result_cols++] = &str_event_col;
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?
Should i need to use another db_key with OP_GT value?
What is Operation info we should use for LIKE. I mean i need to select value which is
sip:1000@xx.xx.xx.xx via searching for 1000.
I Hope i had explain the question well. Please let me know in case any confusion in
question.
--
Regards,
Hemanshu Patel
----------------------------------------------------------------------
P Help the environment – please don't print this email unless you really need to!
_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users(a)lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
--
Daniel-Constantin Mierla -
http://www.asipto.com http://twitter.com/#!/miconda -
http://www.linkedin.com/in/miconda