[OpenSIPS-Devel] Understanding MySQL prepared statements: no "SET @variable = XXX" query?
Bogdan-Andrei Iancu
bogdan at voice-system.ro
Tue Sep 8 13:14:29 CEST 2009
Hi Iñaki,
Hmm, hard to tell - what opensips does, is simply to use the API
functions from mysql libraries - these functions are doing the actually
mysql commands (the ones you see on the server side).
I guess the libmysqlclient is handling this references to the prepared
statements in a totally transparent way for the application using the lib.
On the other hand I never used prepared statements in other way than via
the libmysqlclient.
Regards,
Bogdan
Iñaki Baz Castillo wrote:
> Hi, when OpenSIPS uses prepared statements it generates queries as follows:
>
> ------------------------------------
> 259 Connect sip at localhost on opensips
> 259 Query delete from rls_watchers where expires<1252395816
> 259 Prepare [1] delete from active_watchers where expires<?
> 259 Execute [1] delete from active_watchers where expires<1252395816
> ------------------------------------
>
>
> I expected that the above would be in the following way:
>
> ---------------------------------
> 259 Connect sip at localhost on opensips
> 259 Query PREPARE ps_name FROM "delete from active_watchers
> where expires<?"
> 259 Prepare [1] delete from active_watchers where expires<?
> 259 Query SET @var = 1252395816
> 259 Query EXECUTE ps_name USING @var
> 259 Execute [1] delete from active_watchers where expires<1252395816
> ----------------------------------
>
>
> This is, I expected to see a "SET" query as MySQL documentation about
> prepared statements explains:
> http://dev.mysql.com/tech-resources/articles/4.1/prepared-statements.html
>
> Could I know how it works without using "SET" query? Thanks a lot.
>
>
More information about the Devel
mailing list