From: Felipe Pena Date: Wed, 11 Feb 2009 10:44:27 +0000 (+0000) Subject: Fixed test bug #47311 (PDO::PARAM_LOB columns need to be bound before execute() on... X-Git-Tag: php-5.4.0alpha1~191^2~4297 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=67c51317f503c05cd10de7b5e5476c0f8c8d1063;p=php Fixed test bug #47311 (PDO::PARAM_LOB columns need to be bound before execute() on PgSQL) --- diff --git a/ext/pdo_pgsql/tests/large_objects.phpt b/ext/pdo_pgsql/tests/large_objects.phpt index f6ee9e29c0..316963a383 100644 --- a/ext/pdo_pgsql/tests/large_objects.phpt +++ b/ext/pdo_pgsql/tests/large_objects.phpt @@ -19,7 +19,7 @@ $db->exec('CREATE TABLE test (blobid integer not null primary key, bloboid OID)' $db->beginTransaction(); $oid = $db->pgsqlLOBCreate(); try { -$stm = $db->pgsqlLOBOpen($oid); +$stm = $db->pgsqlLOBOpen($oid, 'w+b'); fwrite($stm, "Hello dude\n"); $stmt = $db->prepare("INSERT INTO test (blobid, bloboid) values (?, ?)"); @@ -34,14 +34,37 @@ $stm = null; /* Pull it out */ $stmt = $db->prepare("SELECT * from test"); -$stmt->execute(); $stmt->bindColumn('bloboid', $lob, PDO::PARAM_LOB); +$stmt->execute(); echo "Fetching:\n"; while (($row = $stmt->fetch(PDO::FETCH_ASSOC))) { var_dump($row['blobid']); var_dump(stream_get_contents($lob)); } echo "Fetched!\n"; + +/* Try again, with late bind */ +$stmt = $db->prepare("SELECT * from test"); +$stmt->execute(); +$stmt->bindColumn('bloboid', $lob, PDO::PARAM_LOB); +echo "Fetching late bind:\n"; +while (($row = $stmt->fetch(PDO::FETCH_ASSOC))) { + var_dump($row['blobid']); + var_dump(is_int($row['bloboid'])); +} +echo "Fetched!\n"; + +/* Try again, with NO bind */ +$stmt = $db->prepare("SELECT * from test"); +$stmt->execute(); +$stmt->bindColumn('bloboid', $lob, PDO::PARAM_LOB); +echo "Fetching NO bind:\n"; +while (($row = $stmt->fetch(PDO::FETCH_ASSOC))) { + var_dump($row['blobid']); + var_dump(is_int($row['bloboid'])); +} +echo "Fetched!\n"; + } catch (Exception $e) { /* catch exceptions so that we can guarantee to clean * up the LOB */ @@ -53,9 +76,18 @@ echo "Fetched!\n"; * linger and clutter up the storage */ $db->pgsqlLOBUnlink($oid); +?> --EXPECT-- Fetching: int(1) string(11) "Hello dude " Fetched! +Fetching late bind: +int(1) +bool(true) +Fetched! +Fetching NO bind: +int(1) +bool(true) +Fetched!