Menu

#420 [Perl] cubrid_lob_get and cubrid_lob_export throw exception when type is BLOB

open
nobody
None
5
2013-02-20
2013-02-20
Jira Trac
No

[Perl] cubrid_lob_get and cubrid_lob_export throw exception when type is BLOB

Test case: http://svn.cubrid.org/cubridapis/perl/branches/RB-9.1.0/t2/Perl/_38_cubrid_lob_export/cases/cubrid_lob_export_03.pl

Test Environment:
{noformat}
cubrid_rel: 9.1.0.0201
perl driver: http://svn.cubrid.org/cubridapis/perl/branches/RB-9.1.0 1499
perl: 5.14.2
{noformat}

Test codes:
{noformat}
my $user=dba;
my $pass=;

my $dsn=dbi:cubrid:database=$db;host=$hostname;port=$port;
my $dbh;
$dbh=DBI-connect($dsn, $user, $pass,{RaiseError = 1}) or die connect error: $dbh-errstr;
$dbh - do(drop table if EXISTS image_t;) or die drop error: $dbh-errstr;
$dbh-do(CREATE TABLE image_t (image_id VARCHAR(36) PRIMARY KEY, doc_id VARCHAR(64) NOT NULL, image BLOB);) or die create error: $dbh-er
rstr;
$dbh-do(INSERT INTO image_t VALUES ('image-0', 'doc-0', BIT_TO_BLOB(X'000001'));) or die insert error: $dbh-errstr;
$dbh-do(INSERT INTO image_t VALUES ('image-1', 'doc-1', BIT_TO_BLOB(X'000010'));) or die insert error: $dbh-errstr;
$dbh-do(INSERT INTO image_t VALUES ('image-2', 'doc-2', BIT_TO_BLOB(X'000100'));) or die insert error: $dbh-errstr;

my $sth=$dbh-prepare( select BLOB_TO_BIT (image) from image_t; ) or die prepare error: $dbh-errstr;
$sth-execute() or die execute error: $dbh-errstr;

$sth-cubrid_lob_get (1) or die cubrid_lob_get error: $dbh-errstr\n;
$sth-cubrid_lob_export(1,$cwd/export1B.txt) or die cubrid_lob_export error: $dbh-errstr;
$sth-cubrid_lob_export(2,$cwd/export2B.jpg) or die cubrid_lob_export error: $dbh-errstr;
$sth-cubrid_lob_export(3,$cwd/export3B.jpg) or die cubrid_lob_export error: $dbh-errstr;
{noformat}

Test Result:
I found $sth-cubrid_lob_get (1) or die cubrid_lob_get error: $dbh-errstr\n; executed failed:
{noformat}
cubrid_lob_get error: DBI::db=HASH(0xc6d5140)-errstr
{noformat}

If I comment the line which containscubrid_lob_get (1),
$sth-cubrid_lob_export(1,$cwd/export1B.txt) or die cubrid_lob_export error: $dbh-errstr; throws this error
{noformat}
cubrid_lob_export error: DBI::db=HASH(0x5bacc20)-errstr at Perl/_38_cubrid_lob_export/cases/cubrid_lob_export_03.pl line 37.
{noformat}

Discussion

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.