Menu

#419 [Perl] cubrid_lob_export throws Segmentation fault when export the second row

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

[Perl] cubrid_lob_export throws Segmentation fault when export the second row

Test case: http://svn.cubrid.org/cubridapis/perl/branches/RB-9.1.0/t2/Perl/_38_cubrid_lob_export/cases/cubrid_lob_export_01.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}
use DBI;
use Test::More;
use strict;
use Cwd;
use File::Basename;
my $cwd;
if ($0 =~ m{^/}) {
$cwd = dirname($0);
} else {
$cwd = dirname(getcwd()./$0);
}

use vars qw($db $port $hostname);

$db=$ARGV[0];
$port=$ARGV[2];
$hostname=$ARGV[1];
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 doc_t;) or die drop error: $dbh-errstr;
$dbh-do(CREATE TABLE doc_t (doc_id VARCHAR(64) PRIMARY KEY, content CLOB);) or die create error: $dbh-errstr;
$dbh-do(INSERT INTO doc_t (doc_id, content) VALUES ('doc-1', CHAR_TO_CLOB('This is a Dog'));) or die insert error: $dbh-errstr;
$dbh-do(INSERT INTO doc_t (doc_id, content) VALUES ('doc-2', CHAR_TO_CLOB('This is a Cat'));) or die insert error: $dbh-errstr;

my $sth=$dbh-prepare(select * from doc_t) or die prepare error: $dbh-errstr;
$sth-execute() or die execute error: $dbh-errstr;
my $curpath=$cwd./export2.txt;
#print $curpath;
$sth-cubrid_lob_get (2) or die cubrid_lob_get error: $dbh-errstr\n;
$sth-cubrid_lob_export(1,$cwd./export1.txt) or die cubrid_lob_export error: $dbh-errstr;
$sth-cubrid_lob_export(2,$curpath) or die cubrid_lob_export error: $dbh-errstr;
{noformat}

I found the last line of codes above throws the Segmentation fault . And export2.txt has been exported successfully.

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.