Menu

#54 [Perl]Add methods for the lob object

open
nobody
None
5
2012-01-06
2012-01-06
Jira Trac
No

Lob object of CUBRID is different from other databases. We didn't support lob object in the first version of Perl driver, so we'll add it.

For CUBRID Perl driver, we assume the following ways to use of the lob object:

1. bind lob object

{code:xml}

# CREATE TABLE test_cubrid (id INT, paper CLOB);

$sth = $dbh-prepare (INSERT INTO test_cubrid VALUES (?, ?));
$sth-bind_param (1, 10);

# use bind_param to bind CLOB/BLOB data
$sth-bind_param (2, HELLO WORLD, DBI::SQL_CLOB);

# use cubrid_lob_import to bind a file
$sth-cubrid_lob_import (2, file.doc, DBI::SQL_CLOB);

$sth-execute;
{code}

2. fetch lob object

{code:xml}

$sth = $dbh-prepare (SELECT * from test_lob);
$sth-execute;

$sth-cubrid_lob_get (2); # fetch the second column
$sth-cubrid_lob_export (3, 1.jpg); # export the third row as 1.jpg
$sth-cubrid_lob_close();
{code}

In summary, we will add four methods:

* cubrid_lob_import: import a file in CUBRID database.
* cubrid_lob_get: get a column of the lob object from CUBRID database.
* cubrid_lob_export: export a lob object as a file.
* cubrid_lob_close: close the lob object that cubrid_lob_get gets.

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.