Uploaded image for project: 'CUBRID APIs'
  1. CUBRID APIs
  2. APIS-359

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

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: Perl-Apricot
    • Fix Version/s: Perl-Aprium
    • Component/s: Perl Driver
    • Labels:
    • Environment:

      CUBRID-9.0.0.0478
      Perl 9.0.0.0001

      Description

      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

       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();
      

      Actual result:

      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();
      
      1. APIS-359_FIX01.creview
        20 kB
        李金虎
      2. APIS-359_FIX02.creview
        17 kB
        李金虎
      3. export_2.pl
        1 kB
        高艳铭

        Activity

        Hide
        gaoyanming 高艳铭 (Inactive) added a comment -

        Related case:
        perlNoSvn/_38_cubrid_lob_export/cases

        Show
        gaoyanming 高艳铭 (Inactive) added a comment - Related case: perlNoSvn/_38_cubrid_lob_export/cases
        Hide
        jinhu 李金虎 added a comment - - edited

        Fix in Trunk, revision: 1451, 1457

        The first argument in cubrid_lob_get() is the col you wants to get.
        The first argument in the cubrid_lob_export() is the row index you want to export.
        The guidline is as below:
        http://search.cpan.org/dist/DBD-cubrid/cubrid.pm#cubrid_lob_get

        The below clause can be used for fetching the number of affected rows.
        my $num = $sth->rows();

        Show
        jinhu 李金虎 added a comment - - edited Fix in Trunk, revision: 1451, 1457 The first argument in cubrid_lob_get() is the col you wants to get. The first argument in the cubrid_lob_export() is the row index you want to export. The guidline is as below: http://search.cpan.org/dist/DBD-cubrid/cubrid.pm#cubrid_lob_get The below clause can be used for fetching the number of affected rows. my $num = $sth->rows();
        Hide
        jinhu 李金虎 added a comment -

        Resolved

        Show
        jinhu 李金虎 added a comment - Resolved
        Hide
        cn14130 欧明宝[Bom Owen] added a comment -

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

        Test Build: 9.1.0.0204
        Test OS: Linux 64
        perl driver: 9.1.0.001
        Test Result: pass

        Show
        cn14130 欧明宝[Bom Owen] added a comment - test case: http://svn.cubrid.org/cubridapis/perl/branches/RB-9.1.0/t2/Perl/_38_cubrid_lob_export/cases/export_2.pl Test Build: 9.1.0.0204 Test OS: Linux 64 perl driver: 9.1.0.001 Test Result: pass
        Hide
        cn14130 欧明宝[Bom Owen] added a comment -

        Test Build: 9.1.0.0204
        Test OS: Linux 64
        perl driver: 9.1.0.001
        Test Result: pass

        Show
        cn14130 欧明宝[Bom Owen] added a comment - Test Build: 9.1.0.0204 Test OS: Linux 64 perl driver: 9.1.0.001 Test Result: pass

          People

          • Assignee:
            jinhu 李金虎
            Reporter:
            gaoyanming 高艳铭 (Inactive)
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Due:
              Created:
              Updated:
              Resolved: