[development] DB support as contribute: is it a good idea?

Karoly Negyesi karoly at negyesi.net
Sun Feb 17 19:43:31 UTC 2008


> 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.


More information about the development mailing list