[SR-Users] Storing multiple SQL results in htable/mtree

Robert McGilvray rmcgilvr at globeop.com
Thu Nov 18 15:44:56 CET 2010


Hello, 

 

I'm interested in using the htable and/or mtree modules to keep my
aliases and did lookups in memory to minimize the amount of SQL lookups
that are being performed. It's easy enough to use htable to cache a
single value after it is retrieved but what I'm not clear on is how I
can do it when SQL returns multiple destinations. Consider the following
query and returned results:

 

SELECT username,domain,CAST(q_value AS CHAR) FROM aliases where
alias_username = '10001' AND alias_domain = 'us.sip.globeop.com' AND
active = '1' ORDER by q_value;

 

+----------+--------------------+-----------------------+

| username | domain             | CAST(q_value AS CHAR) |

+----------+--------------------+-----------------------+

| 8500     | us.sip.globeop.com | 1.000                 |

| 3874     | us.sip.globeop.com | 1.000                 |

| 7050     | us.sip.globeop.com | 1.000                 |

| 2100     | us.sip.globeop.com | 1.000                 |

 

 

 

 

 

In my existing script I just append the results as branches and all
works well but I end up with a lot of unnecessary SQL traffic. I see the
htable supports array but I'm not sure how to go about assigning
multiple values to a single key to use later. How can I take the above
results and store them in memory for use by other transactions? 

 

Thanks,

 

Bob


--------------------------------------------------------------------------
This email with all information contained herein or attached hereto may contain confidential and/or privileged information intended for the addressee(s) only. If you have received this email in error, please contact the sender and immediately delete this email in its entirety and any attachments thereto.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20101118/b9798b7c/attachment-0001.htm>


More information about the sr-users mailing list