4

I want to use libdbi to make an application database-agnostic. I would like to use prepared statements. How can I use prepared statements with libdbi? All the examples I saw use normal select bla from blub where foo; statements and use escaping functions provided by libdbi for input escaping.

If it is not possible to do this in libdbi, can you recommend another db-abstraction-library that can do that or explain why such a feature does not make sense?

timos
  • 2,637
  • 18
  • 21
  • I'm not sure but I think `dbi_conn_queryf` function does this. – Majid Azimi Aug 07 '12 at 07:17
  • I don't think so. dbi_conn_queryf does the same as dbi_conn_query, except that it uses a printf-like format string, so you don't have to "assemble" your query from individual variables before executing it. – timos Oct 02 '12 at 09:38

1 Answers1

2

Unfortunately, libdbi does NOT support prepared statements. Source: libdbi documentation at http://libdbi.sourceforge.net/docs/programmers-guide Also read this thread at syslog-ng: http://marc.info/?t=129555478500003

If you don't mind C++, SOCI might be an alternative for you: http://soci.sourceforge.net

mvp
  • 111,019
  • 13
  • 122
  • 148