Bug #10580 Updated: Access Violation using ADODB
| From: | phanto@php.net | Date: | Wed, 09 May 2001 00:12:03 +0000 |
| Subject: | Bug #10580 Updated: Access Violation using ADODB | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-54454@lists.php.net to get a copy of this message | ||
ID: 10580
Updated by: phanto
Reported By: jason@hspace.net
Old-Status: Open
Status: Closed
Bug Type: COM related
Operating system:
PHP Version: 4.0.6-dev (dated 20010504)
Assigned To:
Comments:
works here.
the only mistake i found was, that if either the connect string or the query was wrong
$conn->execute() returned a nullpointer instead of a valid recordset.
this only produced a warning so there was a nullpointer exception at the first attempt to access
$rs->...
now i produce an error (unfortunatelly this causes the script to stop).
i'll fix this in the code and switch back to a warning, but i think it's ok for now.
Previous Comments:
---------------------------------------------------------------------------
[2001-05-08 19:18:07] jason@hspace.net
Here is a code snippet for testing ADODB:
<?php
define ("DSN_USER", "sa");
define ("DSN_PWD", "");
define ("DB_SERVERNAME", "localhost");
define ("DATABASENAME", "Northwind");
define ("OLEDB_CONNECTION_STRING", "Provider=SQLOLEDB; Data
Source=".DB_SERVERNAME."; Initial Catalog=".DATABASENAME."; User
ID=".DSN_USER."; Password=".DSN_PWD);
$conn = new COM("ADODB.Connection") or die("Cannot start ADO");
$conn->Open(OLEDB_CONNECTION_STRING);
$command = "SELECT * from employees";
$rs = $conn->Execute($command); // Recordset
$num_columns = $rs->Fields->Count();
$this->set_arr($num_columns);
for ($i=0; $i < $num_columns; $i++) {
$fld[$i] = $rs->Fields($i);
}
$rowcount = 0;
while (!$rs->EOF) {
for ($i=0; $i < $num_columns; $i++) {
$arr[$i][$rowcount] = $fld[$i]->value;
}
$rowcount++; // increments rowcount
$rs->MoveNext();
}
$rs->Close();
$conn->Close();
$rs = NULL;
$conn = NULL;
?>
This produces the error: PHP has encountered an Access Violation at 2474FF04
You can also produce an Access Violation by trying to use MSXML Parser 3.0,
and by calling the loadXML() method.
I downloaded php 4.0.6-dev [2001-05-04] build from
php4win32.sourceforge.net/releases/php-4.0.6-dev-20010504.exe
---------------------------------------------------------------------------
[2001-05-08 16:30:55] phanto@php.net
could you provide a short snippet, i can't reproduce this.
are you using the cgi or the isapi version ?
---------------------------------------------------------------------------
[2001-05-04 22:54:14] jason@hspace.net
Same bug, access violation using ADODB and MSXML Parser,
but using a 4.0.6 build, dated 2001-05-04.
---------------------------------------------------------------------------
[2001-05-04 11:29:31] sniper@php.net
This is now fixed in CVS. Fix will be in 4.0.6.
--Jani
---------------------------------------------------------------------------
[2001-05-04 10:28:01] phanto@php.net
same as #10594
---------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view the rest of the comments,
please view the bug report online.
ATTENTION! Do NOT reply to this email!
To reply, use the web interface found at http://bugs.php.net/?id=10580&edit=2