Perl DBI + binary data in psql not working
От | Paul Schilling |
---|---|
Тема | Perl DBI + binary data in psql not working |
Дата | |
Msg-id | Pine.LNX.3.96.991012205132.23056A-100000@anakin.direct-learning.com обсуждение исходный текст |
Ответы |
Re: [GENERAL] Perl DBI + binary data in psql not working
|
Список | pgsql-general |
I am trying to use Apache::Session + psql and ran into a problem with binary data from Storable::nfreeze To demonstrate what is happening I wrote this quick script: #!/usr/bin/perl use DBI; use strict; use Storable qw(nfreeze thaw); my $dbh = DBI->connect("dbi:Pg:dbname=pfschill", '', ''); my $st = $dbh->prepare_cached(' INSERT INTO sessions (id, length, a_session) VALUES (?,?,?)'); my $data = {'stuff' => 'other stuff'}; my $serialized = nfreeze $data; my $session = "1234"; $st->bind_param(1, $session); $st->bind_param(2, length $serialized); $st->bind_param(3, $serialized); $st->execute; Running this you get: DBD::Pg::st execute failed: ERROR: parser: parse error at or near "" Database handle destroyed without explicit disconnect. The sessions table is: +-----------------------------+----------------------------------+-------+ | Field | Type | Length| +-----------------------------+----------------------------------+-------+ | id | char() not null default '' | 16 | | length | int4 not null default 0 | 4 | | a_session | lo | 4 | +-----------------------------+----------------------------------+-------+ I have also tried the text type. I can't tell if this is just a DBD::Pg problem with binary data or if I am having a problem with binary data in psql as well (which is why I am posting this to both lists, sorry.) Does anyone have a solution to this? I can fall back to either using the Apache::Session::File or MySQL for the sessions but I would rather not. Thanks. -- Paul Schilling pfschill@direct-learning.com
В списке pgsql-general по дате отправления: