ID: 22911
Comment by: m dot tschursch at ic3s dot de
Reported By: wbarnett at ncta dot com
Status: Open
Bug Type: ODBC related
Operating System: Windows 2000
PHP Version: 4.3.2RC1
New Comment:
hit exactly the same problem while trying to connect to MSSQL Server !
my software:
PHP: php 4.3.2
unixODBC: 2.2.5
freeTDS: 0.6.1
on Linux
the problem was, that the result-struct was reused
for all queries i send to db ... so i didnt run into
any problem, till the next querie had more or same count
of columns, but it crashed as i tried to fetch data
for a 3-column query right after i executed a
18-column query. doh.
hunted it till i found a solution:
in ext/odbc/php_odbc.c i added a line in function
=========================================================
PHP_FUNCTION(odbc_execute) {
....
/* Close cursor, needed for doing multiple selects */
rc = SQLFreeStmt(result->stmt, SQL_CLOSE);
if (rc == SQL_ERROR) {
odbc_sql_error(result->conn_ptr, result->stmt, "SQLFreeStmt");
}
rc = SQLExecute(result->stmt);
//
// IMPORTANT !! driver dont seems to set numcols here ..
result->numcols = 0;
========================================================
perhaps this should be done in SQLFreeStmt ...
i dont know exactly
finaly this works for me ... perhaps this can help you
Previous Comments:
------------------------------------------------------------------------
[2003-05-18 23:07:05] wbarnett at ncta dot com
Not with SQL server, although I can test there too. It happened with an
Access DB I was using for development purposes.
WWB
------------------------------------------------------------------------
[2003-05-18 22:32:41] [EMAIL PROTECTED]
Can you tell me if this is with SQL Server, and which MDAC is being
used?
------------------------------------------------------------------------
[2003-03-26 16:18:11] wbarnett at ncta dot com
Error:
CGI Error
The specified CGI application misbehaved by not returning a complete
set of HTTP headers. The headers it did return are:
FATAL: emalloc(): Unable to allocate 2012964085 bytes
Note that setting the Setting odbc.defaultlrl = 131072 (as high as I
needed to go methinks) works just fine.
Cant get a GDB Backtrace.
Script that generates:
<?php
$DBName='SpamGenerator';
$DBUser='Admin';
$DBPass='';
function ODBCConnect(){
global $DBName;
global $DBUser;
global $DBPass;
$cnx=odbc_connect($DBName, $DBUser, $DBPass);
return $cnx;
}
function GenerateMainTable(){
$cnx=ODBCConnect();
$strSQL="SELECT MailID, MailName, MailDate FROM sysMail";
if (isset($_GET['SortOrder'])){
$SortOrder=$_GET['SortOrder'];
$strSQL.=" ORDER BY $SortOrder";
}
$cur=odbc_exec($cnx, $strSQL);
$TableDef="<td class=\"Main\">";
while (odbc_fetch_row($cur)){
$MailID=odbc_result($cur, "MailID");
$MailName=odbc_result($cur, "MailName");
$MailDate=date('m.d.y', strtotime(odbc_result($cur, "MailDate")));
echo "<tr>$TableDef<center><a
href=\"MailDetail.php?MailID=$MailID\">$MailID</center></td>$TableDef
$MailName </td>$TableDef<center>$MailDate</center></td></tr>";
}
odbc_close($cnx);
}
GenerateMainTable();
?>
Data it is pulling is pretty simple--an integer ID, a string for name
and a date value.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=22911&edit=1