Mailing List
Home
Forum Home
MySQL General - General MySQL discussion
MaxDB - Everything about MaxDB, formerly known as SAP DB
MySQL++ - Programming with the C++ API to MySQL
MySQL on Win32 - Runing MySQL on Windows 9x/Me/NT/2000/XP
ODBC - ODBC with the MySQL Connector/ODBC driver
Java Help - Mostly related to the MySQL Connector/J driver
Perl - Perl support for MySQL with DBI and DBD::mysql
GUI - MySQL GUI Tools
Announcement
Subjects
mysql openssl Question
mysql:it 's a db not a dbms how it 's possible?!
Does the binary log enabling affect the MySQL performances?
Strange behavior, Table Level Permission
FULLTEXT query format question
Preventing Duplicate Entries
Comparing and writing out BLOBS
Executing MySQL Commands From Within C Program
Can 't access mysql after kernel upgrade
Mysql 4 0 Oracle Stored Procedure Trigger Conversion
Downgrade Mysql from 4 to 3 23
MySQL Cluster Software
mysql test 4 1 fails with the gis test
ERROR 2002: Can 't connect to local MySQL server through socket
Getting Identity after INSERT
Update one field with more fields from another table
ERROR 1045: Access denied for user: 'root@localhost ' (Using
password: NO)
mysql have same function mthod as Oracle decode()
 
problem in DBD-MaxDB-7.6.00.27

problem in DBD-MaxDB-7.6.00.27

2006-05-22       - By Alexey Gaidukov

 Back
DBD-MaxDB-7 (See http://xDB-7.ora-code.com).6.00.27 still contains the bug which I posted before. The
simple testcase


CREATE DBPROC UTILS.TEST(
   IN otd varchar(4))
RETURNS CURSOR AS
BEGIN
   TRY
       DECLARE :$CURSOR CURSOR FOR
           SELECT id,name
               FROM test
               WHERE id like :otd;
   CATCH
       IF $rc <> 100 THEN
           STOP($rc, $errmsg);
END;



#!/usr/bin/perl -w
use strict;
use Fcntl;
use DBI;

binmode(STDOUT, ":utf8");
my $dbi = DBI->connect("dbi:MaxDB:maxdb2/DCDB?unicode=true", "test",
"1") or die "connecting: $DBI::errstr";
my $doctors_sth = $dbi->prepare("call utils.test('%')") or die
"preparing: $DBI::errstr";
$doctors_sth->execute or die "executing: $DBI::errstr";
my $hash_ref;
while($hash_ref = $doctors_sth->fetchrow_hashref) {
   print "'$hash_ref->{ID}' '$hash_ref->{NAME}'";
}
$doctors_sth->finish;




The result:


DBD::MaxDB::st execute failed: Initialization failed [Wrong number of
columns]. at test.pl line 13.
executing: Initialization failed [Wrong number of columns]. at test.pl
line 13.


The proposed patch


diff -uNr DBD-MaxDB-7 (See http://xDB-7.ora-code.com).6.00.27.origin/dbdimp.c DBD-MaxDB-7 (See http://xDB-7.ora-code.com).6.00.27/dbdimp.c
--- DBD-MaxDB-7 (See http://xDB-7.ora-code.com).6.00.27.origin/dbdimp.c 2006-05-03 21:17:51.000000000 +0900
+++ DBD-MaxDB-7 (See http://xDB-7.ora-code.com).6.00.27/dbdimp.c        2006-05-22 12:28:55.000000000 +0900
@@ -1466,15 +1466,14 @@
      dbd_maxdb_sqldbc_error(sth,
SQLDBC_PreparedStatement_getError(imp_sth->m_prepstmt)) ;
      DBD_MAXDB_METHOD_RETURN(imp_sth, dbd_maxdb_st_execute,
DBD_MAXDB_ERROR_RETVAL);
    }
-    if (!imp_sth->m_rsmd){
-      imp_sth->m_rsmd =
SQLDBC_PreparedStatement_getResultSetMetaData(imp_sth->m_prepstmt);
-      if (!imp_sth->m_rsmd) {
-        dbd_maxdb_internal_error(sth, DBD_ERR_INITIALIZATION_FAILED_S,
"Cannot get resultset metadata");
-        DBD_MAXDB_METHOD_RETURN(imp_sth, dbd_maxdb_st_execute,
DBD_MAXDB_ERROR_RETVAL);
-      }
+    imp_sth->m_rsmd =
SQLDBC_ResultSet_getResultSetMetaData(imp_sth->m_resultset);
+    if (!imp_sth->m_rsmd) {
+       dbd_maxdb_internal_error(sth, DBD_ERR_INITIALIZATION_FAILED_S,
"Cannot get resultset metadata");
+       DBD_MAXDB_METHOD_RETURN(imp_sth, dbd_maxdb_st_execute,
DBD_MAXDB_ERROR_RETVAL);
    }
-    DBIc_NUM_FIELDS(imp_sth) = SQLDBC_ResultSetMetaData_getColumnCount
(imp_sth->m_rsmd);
-
+    if (DBIc_NUM_FIELDS(imp_sth) < 0)
+        DBIc_NUM_FIELDS(imp_sth) =
SQLDBC_ResultSetMetaData_getColumnCount (imp_sth->m_rsmd);
+
    if (exec_rc == SQLDBC_NO_DATA_FOUND){
      imp_sth->m_rowNotFound= SQLDBC_TRUE;
      DBD_MAXDB_METHOD_RETURN(imp_sth, dbd_maxdb_st_execute, 0);


--
MaxDB Discussion Mailing List
For list archives: http://lists.mysql.com/maxdb
To unsubscribe:    http://lists.mysql.com/maxdb?unsub=mysql@(protected)