Hi Martin,

second answer.

Martin Bartosch wrote:

and SQL statement concatenation with ";" as seperator does not

as I said in another post: don't do it. Use the prepare() method
or better yet the prepare_cached() method of DBI.

Ok, I understand it. The actual version in CVS does not include such "tricks" (";" and prepare_cached). I will implement a hash with the cashed statements and I will start reading some docs about prepare_cached(). Any interest in programming the database interface? Looks like you have some experience.


You can store the prepared handles in a member variable for later
use. Using 'prepared' statements repeatedly is extremely efficient,
it should be even more efficient than using do() or similar.
Remember that initially parsing the SQL is expensive, calling the
DB on a prepared statement with the appropriate parameters is not.

I don't know do(). So I cannot do something wrong ;)

Oh, and always use bind_param() or execute().

I don't use bind_param because I can give the paramters to execute too. Does this be a bad idea?


Suggestions:
- Never insert variables directly into the SQL prepare statement.
- Don't use do()
  If you have to use either, remember to quote each single variable
  using DBI::quote() to prevent SQL injection attacks.
- Always use prepare(), bind_param() and execute(), even for single
  queries.

All already done.

Michael
--
_______________________________________________________________

Michael Bell                    Humboldt-Universitaet zu Berlin

Tel.: +49 (0)30-2093 2482       ZE Computer- und Medienservice
Fax:  +49 (0)30-2093 2704       Unter den Linden 6
[EMAIL PROTECTED]   D-10099 Berlin
_______________________________________________________________


------------------------------------------------------- This SF.Net email is sponsored by: Sybase ASE Linux Express Edition - download now for FREE LinuxWorld Reader's Choice Award Winner for best database on Linux. http://ads.osdn.com/?ad_id=5588&alloc_id=12065&op=click _______________________________________________ OpenCA-Devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/openca-devel

Reply via email to