ID:               16720
 Updated by:       [EMAIL PROTECTED]
 Reported By:      [EMAIL PROTECTED]
 Status:           Open
 Bug Type:         COM related
 Operating System: Windows 2000 SP2 German
 PHP Version:      4.1.2
 New Comment:

unfortunately, defining $connection as a global or as local variable
won't work. the same error occured:(


Previous Comments:
------------------------------------------------------------------------

[2002-04-27 06:04:19] [EMAIL PROTECTED]

can you try to define $connection as a global or local variable and not
as a class member. i don't thank that this causes the error but just
lets go for sure ..

------------------------------------------------------------------------

[2002-04-21 09:53:18] [EMAIL PROTECTED]

php binary: v4.1.2 downloaded from www.php4win.de
adodb: ms activex data objects 2.7 library
adox : ms ado ext. 2.5 for dll and security
webserver: apache 1.3.20

......................................................

a fatal error occured with following original message:
"Die Anweisung in '0x100829c3' verweist auf Speicher in 0x00000008. Der
Vorgang 'read' konnte nicht in den Speicher durchgeführt werden."

english (similar):
"Statement at '0x100829c3' refers to memory 0x00000008. memory-process
'read' could not be executed"

error log: Premature end of script headers: path-to/php.exe

......................................................

at the end of this bug-report i post a sample-script, which you can
test it. trivial: the fatal error occured always if the script is
finished.

please look in function tableExists, statement @$cat-ActiveConnection.

the supply of an adodb.connection object
occurs fatal error with an access oledb-provider as sql-server
oledb-provider.


......................................................
<?php


class test {

var $connection;
var $user       = "Admin";
var $pw         = "";
var $connstr    = "Provider=Microsoft.Jet.OLEDB.4.0;
                   Data Source=path-to\Nordwind.mdb;
                   Persist Security Info=False";

    function test()
    {
        $this->connection = new COM("ADODB.Connection");

        if (!$this->connection) {
            die (print "could not create an instance of
adodb.connection");
        }
        @$this->connection->Open($this->connstr, $this->user,
$this->pw);
    }


    function tableExists($value)
    {
        $ok = false;
        $cat = new COM("ADOX.Catalog");

        if ($cat) {
            //@$cat->ActiveConnection = $this->connection; //<-- with
this statement we receive a fatal error
            @$cat->ActiveConnection =
$this->connection->ConnectionString; //<-- but setting the conn-string
works fine

            $tables = @$cat->Tables;
            $count = $tables->Count();
            
            for($i = 0; $i < $count; $i++) {
                $table = $tables->Item($i);
                if (strtolower($table->Type) != "view" &&
                        strtolower($table->Name) == strtolower($value))
{
                    $ok = true;
                    break;
                }
            }
            $table->Release(); $table = null; unset($table);
            $tables->Release(); $tables = null; unset($tables);
            $cat->Release();  $cat = null; unset($cat);
        }
        return $ok;
    }

} // end class


$test = new test();
$ret = $test->tableExists("dummy_table");

echo (integer) ret;
?>

------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=16720&edit=1

Reply via email to