downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

px_set_parameter> <px_retrieve_record
[edit] Last updated: Fri, 10 Feb 2012

view this page in

px_set_blob_file

(PECL paradox >= 1.3.0)

px_set_blob_fileblob を読み込むファイル名を設定する

説明

bool px_set_blob_file ( resource $pxdoc , string $filename )

blob の読み込みあるいは書き込みを行おうとしているファイルの名前を設定します。 この関数をコールしていない場合、もしデータがレコードの一部であるが blob ファイルに保存されていないときには、 px_get_record() あるいは px_retrieve_record() は blob フィールドのデータのみを返します。 blob データが blob フィールドのサイズに収まるほど小さい場合は、 それはレコード内に保存されます。

px_set_blob_file() をコールせずに px_put_record()px_insert_record() あるいは px_update_record() をコールすると、 データベースファイルに収まらない場合にデータが切り詰められます。

この関数を 2 度コールすると、 最初の blob ファイルを閉じて新しいほうをオープンします。

パラメータ

pxdoc

px_new() が返す paradox データベースのリソース ID。

filename

ファイルの名前。拡張子は .MB でなければなりません。

返り値

成功した場合に TRUE を、失敗した場合に FALSE を返します。



add a note add a note User Contributed Notes px_set_blob_file
Anonymous 18-Dec-2011 02:59
Note: Due to the (old) bug https://bugs.php.net/bug.php?id=57141 the database file passed to px_open_fp needs to be opened with write permissions (e.g. using the r+ flag). It will crash with a fatal error if opened in read only mode.
simon at centurioncomputers dot com dot au 22-Apr-2011 08:23
I could not get the OO interface to set_blob_file() to work....

<?php
$fp
= fopen("/home/httpd/vhosts/newjcs/SALLY.DB", "r");
$pxdoc = new paradox_db();
$pxdoc->set_blob_file('/home/httpd/vhosts/newjcs/SALLY.MB');
?>
.............................
Fatal error: paradox_db::set_blob_file(): Paradox database has not been opened or created when setting the blob file
.............................

but worked nicely when called procedurally, so quick example to grab the images from a paradox DB , the field names you will have to change to suit.

<?php
$pxdoc
= px_new();
$fp = fopen("/blah/SALLY.DB", "r");
px_open_fp($pxdoc, $fp);
px_set_blob_file($pxdoc,'/blah/SALLY.MB');
$numrecords=px_numrecords($pxdoc);
for(
$x=1;$x<=$numrecords;++$x){
   
$yaks=px_get_record($pxdoc,$x);
    if(
$yaks['Picture']){
       
file_put_contents("/blah/ims/{$yaks['Val No']}.bmp",$yaks['Picture']);
    }
}
px_close($pxdoc);
px_delete($pxdoc);
fclose($fp);
?>

 
show source | credits | stats | sitemap | contact | advertising | mirror sites