DBD-MaxDB-7.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.6.00.27.origin/dbdimp.c DBD-MaxDB-7.6.00.27/dbdimp.c
--- DBD-MaxDB-7.6.00.27.origin/dbdimp.c 2006-05-03 21:17:51.000000000 +0900
+++ DBD-MaxDB-7.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/[EMAIL PROTECTED]