[SR-Users] PostgreSQL - module sqlops - working with prepared statements ?

Chaigneau, Nicolas nicolas.chaigneau at capgemini.com
Tue Apr 19 18:25:28 CEST 2022


Hello,


Trying again, in case this got unnoticed the first time.
I hope that by doing so I'm not breaching the rules of the mailing list.

If nobody answers, then I'll conclude that nobody knows about that, and shall not insist anymore. :)


Regards,
Nicolas.

De : sr-users <sr-users-bounces at lists.kamailio.org> De la part de Chaigneau, Nicolas
Envoyé : vendredi 8 avril 2022 17:01
À : sr-users at lists.kamailio.org
Objet : [SR-Users] PostgreSQL - module sqlops - working with prepared statements ?

Hello,


I'm using sql_xquery from sqlops module to execute requests on a PostgreSQL database.
This work fine.

Now, for performance reasons, I would like to use prepared statements.
I'm wondering if this is possible using sql_xquery. I've looked at the code and documentation, it seems it is not supported.
Can you confirm ?

If not possible with sql_xquery, is it possible with another existing function ?

In the code, I've searched for « PQprepare » / « PQexecPrepared ».
These can be found only in « modules/db_postgres/pg_cmd.c », in function « pg_cmd_exec » which is exported from « modules/db_postgres/pg_mod.c » (see below).
I have no idea how to use these though... :/

Any ideas ?



/*
* Postgres module interface
*/
static cmd_export_t cmds[] = {
       {"db_ctx", (cmd_function)NULL, 0, 0, 0, 0},
       {"db_con", (cmd_function)pg_con, 0, 0, 0, 0},
       {"db_uri", (cmd_function)pg_uri, 0, 0, 0, 0},
       {"db_cmd", (cmd_function)pg_cmd, 0, 0, 0, 0},
       {"db_put", (cmd_function)pg_cmd_exec, 0, 0, 0, 0},
       {"db_del", (cmd_function)pg_cmd_exec, 0, 0, 0, 0},
       {"db_get", (cmd_function)pg_cmd_exec, 0, 0, 0, 0},
       {"db_upd", (cmd_function)pg_cmd_exec, 0, 0, 0, 0},
       {"db_sql", (cmd_function)pg_cmd_exec, 0, 0, 0, 0},
       {"db_res", (cmd_function)pg_res, 0, 0, 0, 0},
       {"db_fld", (cmd_function)pg_fld, 0, 0, 0, 0},
       {"db_first", (cmd_function)pg_cmd_first, 0, 0, 0, 0},
       {"db_next", (cmd_function)pg_cmd_next, 0, 0, 0, 0},
       {"db_setopt", (cmd_function)pg_setopt, 0, 0, 0, 0},
       {"db_getopt", (cmd_function)pg_getopt, 0, 0, 0, 0},
       {"db_bind_api", (cmd_function)db_postgres_bind_api, 0, 0, 0, 0},
       {0, 0, 0, 0, 0, 0}
};



Regards,
Nicolas.

This message contains information that may be privileged or confidential and is the property of the Capgemini Group. It is intended only for the person to whom it is addressed. If you are not the intended recipient, you are not authorized to read, print, retain, copy, disseminate, distribute, or use this message or any part thereof. If you receive this message in error, please notify the sender immediately and delete all copies of this message.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-users/attachments/20220419/7c53d4d2/attachment.htm>


More information about the sr-users mailing list