Menu

#324 [PHP][Windows] the export lob file from db is not correct after import the lob fie into db successfully

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

[PHP][Windows] the export lob file from db is not correct after import the lob fie into db successfully
1. import the lob files
2. export the lob files to local system
3. check whether the export files can open successfully and the size of it is equal with import files

Test verion:
{noformat}
Cubrid: CUBRID 9.0 (9.0.0.0478)
PHP Driver:
CUBRID-PHP5-5.3-WIN32-VC9-TS-9.0.0.0001.bin.zip
{noformat}

codes:
{noformat}
$exportName=array(php/_15_newLob/blob/export/export00.jpg, php/_15_newLob/blob/export/export04.jpg, php/_15_newLob/blob/export/export05.jpg);
for($i=0; $icount($exportName); $i++){
$lob= cubrid_lob2_new();
if ($lob === FALSE) {
printf(%d--Error:[%d] [%s]\n,__LINE__,cubrid_error_code(),cubrid_error_msg());
}elseif(is_null($lob)){
printf(%d--there is maybe some error\n, __LINE__);
}else{
printf(%d--ok\n, __LINE__);
}

$lob=$row[$i+1];
$tmp=cubrid_lob2_export($lob, $exportName[$i]);
if ($tmp === FALSE) {
printf(%d--Error: [%d] [%s]\n,__LINE__,cubrid_error_code(),cubrid_error_msg());
}elseif(is_null($tmp)){
printf(%d--there is maybe some error\n, __LINE__);
}else{
printf(%d--ok\n, __LINE__);
}

$tmp=cubrid_lob2_close($lob);
if ($tmp === FALSE) {
printf(%d--Error:[%d] [%s]\n,__LINE__,cubrid_error_code(),cubrid_error_msg());
}
}

cubrid_disconnect($conn);

//judge that the importing file size is equal to the exporting file size.
for($i=0; $icount($importName); $i++){
$tmp=file_exists($exportName[$i]);
if ($tmp === FALSE) {
printf(%d--Error:[%d] [%s]\n,__LINE__,cubrid_error_code(),cubrid_error_msg());
}
$importSize=filesize($importName[$i]);
$exportSize=filesize($exportName[$i]);
if( $importSize === $exportSize){
printf(file size: %d\n, $importSize);
printf(%d--Expect result.\n, __LINE__);
}else{
printf(%d--Not expect result.\n, __LINE__);
}
}
{noforamt}

Result:
{noformat}
Warning: cubrid_lob2_export(): The file that you want to export lob object may have existed. in D:\work\Project\Cubrid_interface\environment_deploy\php_windows\php\_15_newLob\blob\blob01.php on line 134
136--Error: [0] []
164--Not expect result.
164--Not expect result.
164--Not expect result.
Finished!
{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.