Hi monks
I want to store some binary data in sql database (actually postgresql) produced by Storable::nfreeze(). How can I do it?
Test table have following structure
Attribute | Type | Modifier -----------+------------------------+---------- pkey | character varying(255) | not null pvalue | bytea | Index: demo_pkey
Following test code fails with error 'Unterminated quoted string at ...' for line with execute call.
#!/usr/bin/perl -w use strict; use Storable qw(nfreeze thaw); use DBI; use DBD::Pg; # database settings my $db_name = 'unicode'; my $db_host = 'localhost'; my $db_user = 'elric'; my $db_pass = 'test01'; my $dbh = DBI->connect("dbi:Pg:dbname=$db_name;host=$db_host;", "$db_user", "$db_pass"); my $test = { 'ahoj svete...', [ 1, 23, 'ttt' ], }; my $sth = $dbh->prepare("insert into demo values (?, ?)"); $sth->execute('test', nfreeze($test)); $dbh->disconnect(); exit 0;
I need to have similar functionality like MLDBM module, but for sql database. The modules Tie::RDBM, Tie::MLDBM looks buggy for me.
How can I solve this. What I'm doing wrong? or is there already preset other module for doing this?
In reply to postgresql: store binary data? by ph0enix
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |