[sr-dev] [tracker] Task opened: db_postgres: Prepared statements do not work (Attachment added)
bugtracker at sip-router.org
Thu Feb 28 16:29:28 CET 2013
THIS IS AN AUTOMATED MESSAGE, DO NOT REPLY.
A new Flyspray task has been opened. Details are below.
User who did this - Markus Bucher (MarkCDSys)
Attached to Project - sip-router
Summary - db_postgres: Prepared statements do not work
Task Type - Improvement
Category - Module
Status - Unconfirmed
Assigned To -
Operating System - Linux
Severity - Medium
Priority - Normal
Reported Version - Development
Due in Version - Undecided
Due Date - Undecided
Details - Hi,
I recently tried to do some DB-Queries from my PostgreSQL-DB using modules db_postgres and db2_ops, finding out that queries using parameters did not work.
modparam("db2_ops", "declare_query", "sel1=select uid from sip_user where email@example.com");
I looked at the sources and saw that this has not been implemented, yet (PQprepare() is always called with 0 as number of parameters).
Using db_mysql as a draft, I created the attached patch, which fixes the issue for me (tested with PostgreSQL 8.4.16).
Notice that with PostgreSQL the parameters are marked within the SQL-query using '$1', '$2', etc. instead of '?' like it is in MySQL.
This should be mentioned in db2_ops' documentation.
It would be nice if you would consider using my patch.
One or more files have been attached.
More information can be found at the following URL:
You are receiving this message because you have requested it from the Flyspray bugtracking system. If you did not expect this message or don't want to receive mails in future, you can change your notification settings at the URL shown above.
More information about the sr-dev