execute problem when upgraded to 4.1
Posted by:
H Patil
Date: March 17, 2005 03:55AM
Hi:
I don't know if this is the right forum, but, we upgraded to the latest MySql version 4.1.10a, and our perl scripts (which used Perl DBI for accessing mysql) which worked on 4.0.7 stopped working!!! Specifically, all the executes which took parameters were not successful. To give an example, the code inside ===== had to be replaced with the code inside ------ to make it work.
We were surprised to see a mature software like mysql have this kind of problem. Is this a known problem with 4.1.10a? If so, how do we go about resolving it?
- H Patil
=============================================================
$dbh = DBI->connect('DBI:mysql:<database-name>');
$prev_date = "$prev_month\\$prev_day\\$prev_year";
$end_date = "$end_month\\$end_day\\$end_year";
my $prev_date_sql = sprintf"\"%s-%s-%s\"", $prev_year, $prev_month, $prev_day;
my $end_date_sql = sprintf"\"%s-%s-%s\"", $end_year, $end_month, $end_day;
$sql = sprintf("SELECT adj_high,date FROM %s WHERE date<= ? AND date> ? ORDER BY adj_high DESC LIMIT 1", $table_name);
$sth = $dbh->prepare($sql);
$sth->execute($end_date_sql, $prev_date_sql);
=============================================================
--------------------------------------------------------------------------------------------------------------
$dbh = DBI->connect('DBI:mysql:<database-name>');
$prev_date = "$prev_month\\$prev_day\\$prev_year";
$end_date = "$end_month\\$end_day\\$end_year";
my $prev_date_sql = sprintf"\"%s-%s-%s\"", $prev_year, $prev_month, $prev_day;
my $end_date_sql = sprintf"\"%s-%s-%s\"", $end_year, $end_month, $end_day;
# Change for prepare statements not working properly with Mysql 4.1.10a
$sql = sprintf("SELECT adj_high,date FROM %s WHERE date<= $end_date_sql AND date> $prev_date_sql ORDER BY adj_high DESC LIMIT 1", $table_name);
$sth = $dbh->prepare($sql);
# Change for prepare statements not working properly with Mysql 4.1.10a
$sth->execute();
---------------------------------------------------------------------------------------------------------------