[OpenSER-Devel] FUNCTION ser.bitand does not exist

Dan Pascu dan at ag-projects.com
Tue May 13 12:47:33 CEST 2008


On Tuesday 13 May 2008, Henning Westerholt wrote:
> For postgres in the stable branch a similar approach is used. The
> emulation function (basically a stored procedure) defined for mysql is
> just a small wrapper around the '&' operator. Using a user defined
> procedure could be faster, but its not that easy to deploy them, as its
> necessary to implement them as object files [1]. I found a nice
> benchmark around the different function implementation, stored
> procedures are about 50% slower then using an internal operator (see
> 'adition benchmark', simplifing somewhat..) [2]. But even then its
> possible to execute over 50k of them every second.

My idea was that each db module can offer functions like:

inline str bitand(int a, int b)
{
}

for mysql and postgres they can return "a & b" for oracle they can 
return "bitand(a, b)" and so on. They can be made available on the 
connection structure based on the db connection type

one can use them like:

db.api.bitand(a, b)

whenever such operations that are different between databases are required

>
> The fastest solution would be to implement this bitand in C in the
> usrloc. But i think that the overhead we get for this case is
> managable.

I think the above approach is easier and requires less work.

-- 
Dan



More information about the Devel mailing list