Re: pdo_firebird

From: Date: Sat, 12 Feb 2005 16:35:49 +0000
Subject: Re: pdo_firebird
References: 1  Groups: php.pecl.dev 
Request: Send a blank email to pecl-dev+get-1975@lists.php.net to get a copy of this message
Some things have changed since then (I did say that it was slightly outdated). Consult the manual for more information. Consult the other examples in the other resources I posted for even more information. --Wez. PS: Firebird is the least supported driver so far. On Sat, 12 Feb 2005 16:29:02 +0000, Lester Caine <lester@lsces.co.uk> wrote: > OK I gave in and decided to see who far I could get with converting one > of my simple applications to PDO, but I have not even got out of > 'figure3.php' yet :( > > --------------- > try > { $dbh = new > PDO('firebird:dbname=study:c:\firebird_1_5\examples\employee.fdb' > , 'SYSDBA', 'xxxxxxxx', array(PDO_ATTR_AUTOCOMMIT => true)); > } > catch (PDOException $e) > { echo "Failed to connect " . $e->getMessage(); > exit; > } > --------------- > > This works and opens the example database, but using the default alias > for this database (study:employee) fails. Also providing an invalid path > fails, but neither failures trigger the exception. I just get > > Fatal error: Call to a member function execute() on a non-object > on the next section of code. > > The PDO_ATTR_AUTOCOMMIT does not seem to be set. If I run the next exec > to create the CREDITS table, and then beginTransaction, I get a failure > because there is already an active transaction. > > --------------- > try > { $dbh->beginTransaction(); > $dbh->exec(" > CREATE TABLE CREDITS ( > extension varchar(255), > name varchar(255), > PRIMARY KEY (extension, name) > )"); > $dbh->commit(); > } > catch (PDOException $e) > { echo "Failed to create " . $e->getMessage(); > exit; > } > echo "Created"; > ----------------- > > This should generate an exception, since the PRIMARY KEY is too long, > but instead it just fails silently and exits. > > ----------------- > try > { $dbh->beginTransaction(); > $stmt = $dbh->prepare("INSERT INTO CREDITS (extension, name) VALUES > ('LSCES Special', 'Lester')"); > $stmt->execute(); > $dbh->commit(); > } > catch (PDOException $e) > { echo "Failed to add " . $e->getMessage(); > exit; > } > echo "Add Record"; > ----------------- > > This gives a exception if the beginTransaction/commit are omited from > the create table block - which should have auto commited? > It does not give an exception if the prepare fails, such as when the > table create block is omitted, so that no table to insert into. > > Where is the best place to start documenting the details of this driver. > Ard has set up a number of necessary parameters on the connect, but they > are currently only documented in the driver code? > > -- > Lester Caine > ----------------------------- > L.S.Caine Electronic Services > > -- > PECL development discussion Mailing List (http://pecl.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >

« previous php.pecl.dev (#1975) next »