#78 Prepared Statement support in avpops

open
nobody
modules (91)
3
2012-03-16
2011-07-26
Anonymous
No

It would be nice if avpops exposed an easy way to use prepared statements with a database.
Prepared statements offer an extra layer of security and increased performance.

You should be able to create prepare statements as part of the configuration:
#Connect to db with id 1
modparam("avpops","db_url","1 mysql://user:passwd@host/database")

#create prepared statement id 0 on database id 1 with one place holder
modparam("avpops","db_prepare","0 1 select password, ha1 from subscriber where username=?");

#Exec prepared statement id 0
#A prepared statement is associated with a database connection so we do not need to specify the database
avp_db_exec("0", $var(username), $avp(password), $avp(ha1));

Of course on database reconnects they statements should be prepared again automatically.

I think this would be a great feature to have, especially for those who have to make repeated queries to a database.

Discussion

    • priority: 5 --> 3