Darren,
Eventually, we could possibly have a method to detect version the best way I know of to get mysql version is in an SQL call via DBD:
"show global variables like 'version'" in the database, or
$database_version = $dbh->get_info(18) (more info on this in 'perldoc DBI')
The version that supports server prepare is 4.1.1 and above.
As far as making server side prepare default, a lot of developers don't want this behaviour and the maintainer, Rudy Lippan doesn't want this as well, so we leave it optional.
Hope this answers your question(s),
regards,
Patrick
On Sep 4, 2004, at 11:24 AM, Darren Duncan wrote:
Hello Patrick,
Is it possible for you to automatically detect what version of the MySQL database server or embedded version you have, and then just automatically use server-side prepared statements if the version supports them? I think this would be the best option. If you wanted to give people something to customize, you could give a switch to force client-side handling, like was used before. But people who don't say that simply get the best available option.
Also, since I'm writing you anyway, can you please tell me if there is a quick and simple way for me as a DBI user to query for what MySQL version I am connected to, so my code can automatically make use of newer features when possible (eg: subqueries), or emulate them for older versions?
Please reply asap.
Thank you very much. -- Darren Duncan
Hello Users/Developers,
I have just committed support for prepared statements and MySQL embedded server support to CVS development branch Dev-2_9 (based off of 2.900x code) for DBD::mysql. You can get this code to try out via:
cvs -d :pserver:[EMAIL PROTECTED]:/cvs/public login
cvs -d :pserver:[EMAIL PROTECTED]:/cvs/public co -rDev-2_9 modules/DBD-mysql
To use server side prepare statements, all you really need to do is set the value "mysql_server_prepare" in the connect string:
my $dbh = DBI->connect("DBI:mysql:database=test;host=localhost: mysql_server_prepare=1", "","");
When you build DBD::mysql and run make test, after you first test without server side prepare statements, you can test with by exporting the environment variable MYSQL_SERVER_PREPARE
export MYSQL_SERVER_PREPARE=1
and then run 'make test' again. This stage will be improved in the future.
Also, for information about using the embedded server, please read the pod documentation found in the perl module itself.
For more information about prepared statements and how you can take advantage of them, please feel free to read my OSCON presentation:
http://patg.net/DBD.pdf
Kind regards,
Patrick Galbraith
Patrick Galbraith Senior Software Developer [EMAIL PROTECTED] http://www.mysql.com
"Whatever action a great man performs, common men follow. Whatever standards he sets by exemplary acts, all the world pursues" -- Bhagavad Gita
Patrick Galbraith Senior Software Developer [EMAIL PROTECTED] http://www.mysql.com
"Whatever action a great man performs, common men follow. Whatever standards he sets by exemplary acts, all the world pursues" -- Bhagavad Gita
