17 Feb
2008
17 Feb
'08
8:43 p.m.
delegation (including asking Karoly to write pg drivers <g>)... but
$db = new PDO('pgsql:dbname=drupal', 'drupal', 'drupal'); $binarydata = "abcdefg\x00a\x00\x01\x02"; $db->exec('CREATE TABLE test (data bytea, comment varchar(64), len integer)'); $db->beginTransaction(); $stmt = $db->prepare("INSERT INTO test (data, comment, len) VALUES (:data, :comment, :len)"); $stmt->bindParam(':len', $len); $stmt->bindParam(':data', $blob, PDO::PARAM_LOB); $blob = fopen('php://memory', 'a'); $len = fwrite($blob, $binarydata); rewind($blob); $comment = 'lob'; $stmt->bindParam(':comment', $comment); $stmt->execute(); $db->commit(); Like that? I *did* write the skeleton of LOB handling for postgresql, mind ya.