MySQL Forums
Forum List  »  Perl

Re: How to use Query Cache with Perl DBI
Posted by: David Shrewsbury
Date: September 03, 2006 11:15AM

Well, now that I look at it again, I'm not 100% sure. I thought it would always force a server side prepare, even for statements with no parameter markers. But now that I look at it more closely, it looks like the DBD::mysql driver will not send any statement to be prepared on the server unless this is set. I tested a prepare() with a parameter marker without setting mysql_server_prepare and when I executed it, I saw that it used the query cache:

$dbh= DBI->connect("dbi:mysql:database=test;host=localhost", "", "");
$sth= $dbh->prepare("select * from testaa where b=?");
$sth->execute(1);

This seems to indicate that without this option set, the driver will not prepare the statement, but instead substitute the values in the statement and executes the statement that way. You guys may want to do your own tests to validate what I'm seeing.

-Dave

Options: ReplyQuote


Subject
Written By
Posted
September 01, 2006 10:20AM
Re: How to use Query Cache with Perl DBI
September 03, 2006 11:15AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.