cubrid_lob2_export
(PECL CUBRID >= 8.4.1)
cubrid_lob2_export — Export the lob object to a file
Description
$lob_identifier
, string $file_name
) : boolThe cubrid_lob2_export() function is used to save the contents of BLOB/CLOB data to a file. To use this function, you must use cubrid_lob2_new() or fetch a lob object from CUBRID database first. If the file already exists, the operation will fail. This function will not influence the cursor position of the lob object. It operates the entire lob object.
Parameters
-
lob_identifier
-
Lob identifier as a result of cubrid_lob2_new() or get from the result set.
-
filename
-
File name you want to store BLOB/CLOB data. It also supports the path of the file.
Examples
Example #1 cubrid_lob2_export() example
<?php
// Table: test_lob (id INT, contents CLOB)
$conn = cubrid_connect("localhost", 33000, "demodb", "dba", "");
cubrid_execute($conn,"DROP TABLE if exists doc");
cubrid_execute($conn,"CREATE TABLE doc (id INT, doc_content CLOB)");
cubrid_execute($conn,"INSERT INTO doc VALUES (5,'hello,cubrid')");
$req = cubrid_prepare($conn, "select * from doc");
cubrid_execute($req);
cubrid_move_cursor($req, 1, CUBRID_CURSOR_FIRST);
$row = cubrid_fetch($req, CUBRID_NUM | CUBRID_LOB);
cubrid_lob2_export($row[1], "doc_3.txt");
cubrid_lob2_close($row[1]);
cubrid_disconnect($conn);
?>
See Also
- cubrid_lob2_new() - Create a lob object
- cubrid_lob2_close() - Close LOB object
- cubrid_lob2_import() - Import BLOB/CLOB data from a file
- cubrid_lob2_bind() - Bind a lob object or a string as a lob object to a prepared statement as parameters
English translation
You have asked to visit this site in English. For now, only the interface is translated, but not all the content yet.If you want to help me in translations, your contribution is welcome. All you need to do is register on the site, and send me a message asking me to add you to the group of translators, which will give you the opportunity to translate the pages you want. A link at the bottom of each translated page indicates that you are the translator, and has a link to your profile.
Thank you in advance.
Document created the 30/01/2003, last modified the 26/10/2018
Source of the printed document:https://www.gaudry.be/en/php-rf-cubrid-lob2-export.html
The infobrol is a personal site whose content is my sole responsibility. The text is available under CreativeCommons license (BY-NC-SA). More info on the terms of use and the author.
References
These references and links indicate documents consulted during the writing of this page, or which may provide additional information, but the authors of these sources can not be held responsible for the content of this page.
The author This site is solely responsible for the way in which the various concepts, and the freedoms that are taken with the reference works, are presented here. Remember that you must cross multiple source information to reduce the risk of errors.