Menu

#319 [Perl]Segment default will appear of cubrid_st_lob_export () method, when export to txt file.

open
nobody
None
5
2012-10-14
2012-10-14
Jira Trac
No

Test Build:CUBRID 2008 R4.1 (9.0.0.0478)
OS: Linux 64
Description:
At first using cubrid_lob_get to get value and getting value will fail.
And then using cubrid_lob_export() method to txt file.
segment default will appeared

Repro steps:
1. exectute:
gdb perl
run test2.pl demodb 33000 localhost
bt

statement in export_2.pl
{noformat}
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;

my $sth=$dbh-prepare(select * from image_t) or die prepare error: $dbh-errstr;
$sth-execute() or die $dbh-errstr. execute error\n;

my $value=$sth-cubrid_lob_get(3) or die $dbh-errstr . lob_get error\n;# fetch the second column
print value: $value\n;

my $export=$sth-cubrid_lob_export(3,null1.txt);# or die $dbh-errstr . cubrid_lob_export error\n;

my $err=$dbh-errstr;
if($err){
print $err\n;
}else{
print no errror\n;
}

my $closeValue=$sth-cubrid_lob_close();
print closeValue: $closeValue\n;

$sth-finish();
$dbh - disconnect();
{noformat}
Actual result:
{noformat}
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;

my $sth=$dbh-prepare(select * from image_t) or die prepare error: $dbh-errstr;
$sth-execute() or die $dbh-errstr. execute error\n;

my $value=$sth-cubrid_lob_get(3) or die $dbh-errstr . lob_get error\n;# fetch the second column
print value: $value\n;

my $export=$sth-cubrid_lob_export(3,null1.txt);# or die $dbh-errstr . cubrid_lob_export error\n;

my $err=$dbh-errstr;
if($err){
print $err\n;
}else{
print no errror\n;
}

my $closeValue=$sth-cubrid_lob_close();
print closeValue: $closeValue\n;

$sth-finish();
$dbh - disconnect();
{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.