> <?php
> $db = new PostgreSQLDataSource("host", "port", "user", "pass", "db");
> $db->open();
>
> echo $db->connection;
> ?>
returns :
Resource id #1
... which is what would be expected ...
The wierd thing is the result i get from my test script:
---------------------------------
$manualNameTest = new
AbstractDataSourceManager("PostgreSQLDataSource","","","wwwuser","","rp2");
$result = $manualNameTest->executeQuery("select * from requirements;");
$db = new PostgreSQLDataSource('','','wwwuser','','rp2');
$db->open();
echo $db->connection."<BR>";
echo $db->executeQuery("select * from requirements;");
-------------------------------------
returns:
------------------------------------
The connection in open() is :Resource id #1
connection in executeQuery() is :''
Warning: Supplied argument is not a valid PostgreSQL link resource in
/var/wwwroot/php/PostgreSQLDataSource.php on line 67
The connection in open() is :Resource id #1
Resource id #1
The connection in executeQuery() is :'Resource id #1'
Warning: 1 is not a valid PostgreSQL link resource in
/var/wwwroot/php/PostgreSQLDataSource.php on line 67
Object
------------------------------
WHAT THE HELL IS GOING ON ?!?!?!?! AARGH!
AndrewH
----- Original Message -----
From: "Simon Garner" <[EMAIL PROTECTED]>
To: "Andrew Halliday" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Friday, March 02, 2001 11:15 AM
Subject: Re: [PHP] Loss of connection handle object
> From: "Andrew Halliday" <[EMAIL PROTECTED]>
>
> > Okay - Im writing an object to wrap a database.
> > The key problem is this:
> > - it declares a connection var as an object property
> > - the open() function opens the connection to the database and
stores
> > the handle in $this->connection
> > - the executeQuery() method complains about not having a valid
handle,
> > because by then, somehow, $this->connection==null!!!
> >
> > Any ideas?-i swear its just something stupid ive missed ...
> >
> > HELP!
> >
> > Thanx in advance,
> > AndrewH
> >
> > -------------------------------------------------------------
> > The code following this returns the following to the browser:
> > -------------------------------------------------------------
> > The connection in open() is :Resource id #1
> > The connection in executeQuery() is :''
> >
> > Warning: Supplied argument is not a valid PostgreSQL link resource in
> > /var/wwwroot/php/PostgreSQLDataSource.php on line 67
> >
> >
> > -------------------------------------------------------------
> >
>
>
> What happens if you do:
>
> <?php
> $db = new PostgreSQLDataSource("host", "port", "user", "pass", "db");
> $db->open();
>
> echo $db->connection;
> ?>
>
>
> Cheers
>
> Simon Garner
>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]