[ 永遠的UNIX::UNIX技術資料的寶庫 ]   GB | BIG5

首頁 > 編程技術 > Php > 正文
PHP4手冊:函數庫及函數(二十二) Informix 資料庫函式庫
http://netleader.126.com 星空浪子 (2001-04-18 14:20:43)

--------------------------------------------------------------------------------
 Informix 資料庫函式庫 
--------------------------------------------------------------------------------
 


本函式庫共有 38 個函式
目前支援的 Informix 版本為 ODS 7.x、SE 7.x 與 Universal Server (IUS) 9.x 三種。在 ODS 7.x 的版本中,完全支援所有的資料型態,而在 IUS 9.x 中,不支援 SLOB 與 CLOB 二種型態。
要在 Web Server 上安裝 Informix Client 端,在編譯 PHP 之前 (configure 之前),要先設好 IFX_LIBDIR、IFX_LIBS 及 IFX_INCDIR 三種環境變數,若是 9.x 版尚要設定 HAVE_IFX_IUS 環境變數。同時在設定時要加入 --with_informix=yes 的選項。 
 


ifx_connect: 開啟 Informix 伺服器連線。 
ifx_pconnect: 開啟 Informix 伺服器長期連線。 
ifx_close: 關閉 Informix 伺服器連線。 
ifx_query: 送出一個 query 字串。 
ifx_prepare: 準備 query 字串。 
ifx_do: 執行已準備 query 字串。 
ifx_error: 取得 Informix 最的錯誤。 
ifx_errormsg: 取得 Informix 最錯誤訊息。 
ifx_affected_rows: 得到 Informix 最操作影響的列數目。 
ifx_getsqlca: 取得 query 的 sqlca 資訊。 
ifx_fetch_row: 傳回單列的各欄位。 
ifx_htmltbl_result: 將 query 傳回資料轉成 HTML 表格。 
ifx_fieldtypes: 列出 Informix 的 SQL 欄位。 
ifx_fieldproperties: 列出 Informix 的 SQL 欄位屬性。 
ifx_num_fields: 取得傳回欄位的數目。 
ifx_num_rows: 取得傳回列的數目。 
ifx_free_result: 釋放傳回佔用記憶體。 
ifx_create_char: 建立字元物件。 
ifx_free_char: 刪除字元物件。 
ifx_update_char: 更改字元物件。 
ifx_get_char: 取得字元物件。 
ifx_create_blob: 建立長位元物件。 
ifx_copy_blob: 復制長位元物件。 
ifx_free_blob: 刪除長位元物件。 
ifx_get_blob: 取得長位元物件。 
ifx_update_blob: 更改長位元物件。 
ifx_blobinfile_mode: 設定長位元物件模式。 
ifx_textasvarchar: 設定文字模式內定值。 
ifx_byteasvarchar: 設定位元組模式內定值。 
ifx_nullformat: 設定空字元模式內定值。 
ifxus_create_slob: 建立 slob 物件。 
ifx_free_slob: 刪除 slob 物件。 
ifxus_close_slob: 刪除 slob 物件。 
ifxus_open_slob: 開啟 slob 物件。 
ifxus_tell_slob: 傳回目前檔案或找尋位置。 
ifxus_seek_slob: 設定目前檔案或找尋位置。 
ifxus_read_slob: 讀取指定數目的 slob 物件。 
ifxus_write_slob: 將字串寫入 slob 物件中。 

--------------------------------------------------------------------------------
 函式:ifx_connect() 
--------------------------------------------------------------------------------
 


Informix 資料庫函式庫


ifx_connect
開啟 Informix 伺服器連線。

語法: int ifx_connect(string [database], string [userid], string [password]);

傳回值: 整數

函式種類: 資料庫功能


 
 
內容說明 


本函式建立與 Informix 伺服器的連線。其中所有的參數都可省略。若全部參數都省略時,使用系統的 php3.ini 或是 php.ini (視 PHP 版本決定) 中 ifx.default_host 指定的機器,或是環境變數 $INFORMIXSERVER;ifx.default_user 為使用者帳號;ifx.default_password 為使用者密碼。而參數 database、userid 及 password 分別為資料庫的名字、登入帳號及使用密碼。當然,在使用本函式之,盡早使用 ifx_close() 關閉 Informix 資料庫比較好。連線成功則傳回連線代碼,失敗則傳回 false 值。


 
 
使用范例 


本例只有連上資料庫,什事都沒做。

$conn_id = ifx_pconnect("mydb@ol_srv1", "imyself", "mypassword");
ifx_close($conn_id);
?> 

 
 
參考 


ifx_pconnect()  ifx_close()  


--------------------------------------------------------------------------------
 函式:ifx_pconnect() 
--------------------------------------------------------------------------------
 


Informix 資料庫函式庫


ifx_pconnect
開啟 Informix 伺服器長期連線。

語法: int ifx_pconnect(string [database], string [userid], string [password]);

傳回值: 整數

函式種類: 資料庫功能


 
 
內容說明 


本函式與 ifx_connect() 很類似。不同的地方在使用本函式開啟資料庫時,程式會先尋找是否曾經執行過本函式,若執行過則傳回先前執行的 ID。另一個不同的地方是本函式無法使用 ifx_close() 關閉資料庫。


 
 
參考 


ifx_connect()  ifx_close()  
 

--------------------------------------------------------------------------------
 函式:ifx_close() 
--------------------------------------------------------------------------------
 


Informix 資料庫函式庫


ifx_close
關閉 Informix 伺服器連線。

語法: boolean ifx_close(int [link_identifier]);

傳回值: 布林值

函式種類: 資料庫功能


 
 
內容說明 


本函式關閉與 Informix 資料庫伺服器的連線。若無指定參數 link_identifier 則會關閉最的一筆連線。用 ifx_pconnect() 連線則無法使用本函式關閉。本函式可以省略,當 PHP 整頁程式結束,將會自動關閉與資料庫的非永久性 (non-persistent) 連線。傳回值均為 true。
 

--------------------------------------------------------------------------------
 函式:ifx_query() 
--------------------------------------------------------------------------------
 


Informix 資料庫函式庫


ifx_query
送出一個 query 字串。

語法: int ifx_query(string query, int [link_identifier], int [cursor_type], mixed [blobidarray]);

傳回值: 整數

函式種類: 資料庫功能


 
 
內容說明 


本函式送出 query 字串供 Informix 做相關的處理動作。若沒有指定 link_identifier 參數,則程式會自動尋找最近開啟的 ID。參數 cursor_type 可省略,其值有 IFX_SCROLL 與 IFX_HOLD 二種。若有 BLOB 的欄位要加在 query 指令之中,可使用 blobidarray 參數,指定 BLOB 的代碼。


 
 
使用范例 


例一:

// 之前的程式省略
ifx_textasvarchar(1);      // 使用文字模式 (text mode) 的 blobs
$res_id = ifx_query("select * from orders", $conn_id);
if (! $res_id) {
  printf("無法取出 orders 資料表 : %s\n
%s
\n", ifx_error());
  ifx_errormsg();
  die;
}
ifx_htmltbl_result($res_id, "border=\"1\"");
ifx_free_result($res_id);
// 之的程式省略
?>


例二:

// 之前的程式省略
//
// 為二進位及文字建立 BLOB 代碼
$textid = ifx_create_blob(0, 0, "Text column in memory");
$byteid = ifx_create_blob(1, 0, "Byte column in memory");

$blobidarray[] = $textid;
$blobidarray[] = $byteid;

$query = "insert into catalog (stock_num, manu_code, " ."cat_descr,cat_picture) values(1,'HRO',?,?)";
$res_id = ifx_query($query, $conn_id, $blobidarray);
if (! $res_id) {
  // 錯誤處理
}
ifx_free_result($res_id);
// 之程式省略
?> 



--------------------------------------------------------------------------------
 函式:ifx_prepare() 
--------------------------------------------------------------------------------
 


Informix 資料庫函式庫


ifx_prepare
準備 query 字串。

語法: int ifx_prepare(string query, int link_identifier, int [cursor_type], mixed blobidarray);

傳回值: 整數

函式種類: 資料庫功能


 
 
內容說明 


本函式準備 query 字串供 Informix 接著做相關的處理。若沒有指定 link_identifier 參數,則程式會自動尋找最近開啟的 ID。參數 cursor_type 可省略,其值有 IFX_SCROLL 與 IFX_HOLD 二種。若有 BLOB 的欄位要加在 query 指令之中,可使用 blobidarray 參數,指定 BLOB 的代碼。傳回值可供 ifx_do() 使用。
 

--------------------------------------------------------------------------------
 函式:ifx_do() 
--------------------------------------------------------------------------------
 


Informix 資料庫函式庫


ifx_do
執行已準備 query 字串。

語法: boolean ifx_do(int result_id);

傳回值: 布林值

函式種類: 資料庫功能


 
 
內容說明 


本函式用來執行已經由 ifx_prepare() 函式所準備的字串。參數 result_id 即為 ifx_prepare() 所傳回的待執行代碼。成功則傳回 true,失敗傳回 false 值。

 

--------------------------------------------------------------------------------
 函式:ifx_error() 
--------------------------------------------------------------------------------
 


Informix 資料庫函式庫


ifx_error
取得 Informix 最的錯誤。

語法: string ifx_error(void);

傳回值: 字串

函式種類: 資料庫功能


 
 
內容說明 


本函式用來取得 Informix 資料庫最的錯誤資訊,本函式無須加入任何參數。傳回的字串如以下的格式

X [SQLSTATE=aa bbb SQLCODE=c]

其中的 X 代表錯誤訊息的種類,見下表

字元 代表種類 
空格 無錯誤 
E 錯誤 (Error) 
N 無資料 
W 警告 (Warning) 
? 其它未定義 


至 aa、bbb、c 表示數字資料,並分別為二位、三位及一位數。更多有關細節參考 Informix 手冊中有關 SQLSTATE 與 SQLCODE 的資訊。


 
 
參考 


ifx_errormsg()  


--------------------------------------------------------------------------------
 函式:ifx_errormsg() 
--------------------------------------------------------------------------------
 


Informix 資料庫函式庫


ifx_errormsg
取得 Informix 最錯誤訊息。

語法: string ifx_errormsg(int [errorcode]);

傳回值: 字串

函式種類: 資料庫功能


 
 
內容說明 


本函式用來取得 Informix 資料庫最的錯誤訊息字串。參數 errorcode 代表錯誤代碼。


 
 
使用范例 


本例為部份程式

printf("%s\n
", ifx_errormsg(-201));
?> 

 
 
參考 


ifx_error()  


--------------------------------------------------------------------------------
 函式:ifx_affected_rows() 
--------------------------------------------------------------------------------
 


Informix 資料庫函式庫


ifx_affected_rows
得到 Informix 最操作影響的列數目。

語法: int ifx_affected_rows(int result_id);

傳回值: 整數

函式種類: 資料庫功能


 
 
內容說明 


本函式可得到 Informix 最查詢操作 INSERT、UPDATE 或 DELETE 所影響的列 (row) 數目。若最使用的是 SELECT,則用本函式得到的數目為估計值,而非精確的數目,欲得到 SELECT 傳回的數目需使用 ifx_num_rows() 函式。


 
 
使用范例 


本例為部份程式

$rid = ifx_prepare ("select * from userinfo where name like " . $name, $connid);
if (! $rid) {
  // 錯誤處理的部份
}
$rowcount = ifx_affected_rows ($rid);
if ($rowcount > 1000) {
  printf ("傳回資料太多,共 %d 筆\n
", $rowcount);
  die ("請重新執行 SQL 指令
\n");
}
?> 

 
 
參考 


ifx_num_rows()  


--------------------------------------------------------------------------------
 函式:ifx_getsqlca() 
--------------------------------------------------------------------------------
 


Informix 資料庫函式庫


ifx_getsqlca
取得 query 的 sqlca 資訊。

語法: array ifx_getsqlca(int result_id);

傳回值: 陣列

函式種類: 資料庫功能


 
 
內容說明 


本函式可得到 Informix 最查詢操作的 sqlca 結構 (struct) 中的相關資訊。參數 result_id 是經過 ifx_query() 及 ifx_prepare() 的傳回代號。本函式傳回的陣列其實就是 sqlca.sqlerrd[0] 到 sqlca.sqlerrd[5] 等六個元素的陣列。


 
 
使用范例 


下例為部份程式

$qid = ifx_query("insert into sometable values(0, '2nd column', 'another column' ", $connid);
if (! $qid) {
  // 錯誤處理
}
$sqlca = ifx_getsqlca ($qid);
$serial_value = $sqlca["sqlerrd1"];
echo "插入列序號為: " . $serial_value
n";
?> 



--------------------------------------------------------------------------------
 函式:ifx_fetch_row() 
--------------------------------------------------------------------------------
 


Informix 資料庫函式庫


ifx_fetch_row
傳回單列的各欄位。

語法: array ifx_fetch_row(int result_id, mixed [position]);

傳回值: 陣列

函式種類: 資料庫功能


 
 
內容說明 


本函式用來將查詢結果 result 之單列拆到陣列變數中。陣列的索引是數字索引,第一個的索引值是 0。若 result 沒有資料,則傳回 false 值。參數 position 可省略,是所謂的卷動遊標 (scroll cursor),可能值為:NEXT、PREVIOUS、CURRENT、FIRST 或者 LAST;亦可能為數字,表示指定為第幾列。


 
 
使用范例 


以下的范例為連上 Informix 資料庫的動作

$rid = ifx_prepare("select * from emp where name like ".$name, $connid, IFX_SCROLL);
if (! $rid) {
  // 錯誤處理
}
$rowcount = ifx_affected_rows($rid);
if ($rowcount > 1000) {
  printf ("傳回資料太多,共 %d 筆\n
", $rowcount);
  die ("請重新執行 SQL 指令
\n");
}
if (! ifx_do ($rid)) {
  // 錯誤處理
}
$row = ifx_fetch_row($rid, "NEXT");
while (is_array($row)) {
  for(reset($row); $fieldname=key($row); next($row)) {
    $fieldvalue = $row[$fieldname];
    printf("%s = %s,", $fieldname, $fieldvalue);
  }
  printf("\n
");
  $row = ifx_fetch_row($rid, "NEXT");
}
ifx_free_result($rid);
?> 


--------------------------------------------------------------------------------
 函式:ifx_htmltbl_result() 
--------------------------------------------------------------------------------
 


Informix 資料庫函式庫


ifx_htmltbl_result
將 query 傳回資料轉成 HTML 表格。

語法: int ifx_htmltbl_result(int result_id, string [html_table_options]);

傳回值: 整數

函式種類: 資料庫功能


 
 
內容說明 


本函式用來將 query 查詢結果格式化成 HTML 標記格式的表格形式。參數 html_table_options 可省略,為  標記中的參數選項。成功則傳回列數,失敗則傳回 false 值。


 
 
使用范例 


以下的范例中,
 標記的參數設表格邊寬為 2。

$rid = ifx_prepare("select * from emp where name like ".$name, $connid, IFX_SCROLL);
if (! $rid) {
  // 錯誤處理
}
$rowcount = ifx_affected_rows($rid);
if ($rowcount > 1000) {
  printf ("傳回資料太多,共 %d 筆\n
", $rowcount);
  die ("請重新執行 SQL 指令
\n");
}
if (! ifx_do($rid) {
  // 錯誤處理
}
ifx_htmltbl_result($rid, "border=\"2\"");
ifx_free_result($rid);
?> 


--------------------------------------------------------------------------------
 函式:ifx_fieldtypes() 
--------------------------------------------------------------------------------
 


Informix 資料庫函式庫


ifx_fieldtypes
列出 Informix 的 SQL 欄位。

語法: array ifx_fieldtypes(int result_id);

傳回值: 陣列

函式種類: 資料庫功能


 
 
內容說明 


本函式可以獲得 Informix 的 SQL 指令傳回的欄位。參數 result_id 是經過 ifx_query() 或 ifx_prepare() 的傳回代號。


 
 
使用范例 


本例為程式的一部份

$types = ifx_fieldtypes($resultid);
if (! isset($types)) {
  // 錯誤處理
}
for ($i = 0; $i < count($types); $i++) {
  $fname = key($types);
  printf("%s :\t 型態為: %s\n", $fname, $types[$fname]);
  next($types);
}
?> 


--------------------------------------------------------------------------------
 函式:ifx_fieldproperties() 
--------------------------------------------------------------------------------
 


Informix 資料庫函式庫


ifx_fieldproperties
列出 Informix 的 SQL 欄位屬性。

語法: array ifx_fieldproperties(int result_id);

傳回值: 陣列

函式種類: 資料庫功能


 
 
內容說明 


本函式可以獲得 Informix 的 SQL 指令傳回欄位的屬性。參數 result_id 是經過 ifx_query() 或 ifx_prepare() 的傳回代號。


 
 
使用范例 


本例為程式的一部份

$properties = ifx_fieldtypes($resultid);
if (! isset($properties)) {
  // 錯誤處理
}
for ($i = 0; $i < count($properties); $i++) {
  $fname = key($properties);
  printf("%s:\t type =  %s\n", $fname, $properties[$fname]);
  next($properties);
}
?> 


--------------------------------------------------------------------------------
 函式:ifx_num_fields() 
--------------------------------------------------------------------------------
 


Informix 資料庫函式庫


ifx_num_fields
取得傳回欄位的數目。

語法: int ifx_num_fields(int result_id);

傳回值: 整數

函式種類: 資料庫功能


 
 
內容說明 


本函式可以得到傳回欄位的數目。參數 result_id 是經過 ifx_query() 或 ifx_prepare() 的傳回代號。若發生錯誤則傳回 false 值。




--------------------------------------------------------------------------------
 

--------------------------------------------------------------------------------
 函式:ifx_num_rows() 
--------------------------------------------------------------------------------
 


Informix 資料庫函式庫


ifx_num_rows
取得傳回列的數目。

語法: int ifx_num_rows(int result_id);

傳回值: 整數

函式種類: 資料庫功能


 
 
內容說明 


本函式可以得到 Informix 資料庫傳回列的數目。參數 result_id 是經過 ifx_query() 或 ifx_do() 的傳回代號。若發生錯誤則傳回 false 值。

 

--------------------------------------------------------------------------------
 函式:ifx_free_result() 
--------------------------------------------------------------------------------
 


Informix 資料庫函式庫


ifx_free_result
釋放傳回佔用記憶體。

語法: boolean ifx_free_result(int result_id);

傳回值: 布林值

函式種類: 資料庫功能


 
 
內容說明 


本函式可以釋放目前 Informix 資料庫 query 傳回所佔用的記憶體。一般只有在非常擔心在記憶體的使用上可能會不足的情形下才會用本函式,因為 PHP 程式會在結束時自動釋放。發生錯誤則傳回 false 值。
 

--------------------------------------------------------------------------------
 函式:ifx_create_char() 
--------------------------------------------------------------------------------
 


Informix 資料庫函式庫


ifx_create_char
建立字元物件。

語法: int ifx_create_char(string param);

傳回值: 整數

函式種類: 資料庫功能


 
 
內容說明 


本函式用來建立字元 (char) 物件。參數 param 為字元的內容。成功則傳回字元的物件代碼,失敗傳回 false 值。

 

--------------------------------------------------------------------------------
 函式:ifx_free_char() 
--------------------------------------------------------------------------------
 


Informix 資料庫函式庫


ifx_free_char
刪除字元物件。

語法: boolean ifx_free_char(int bid);

傳回值: 布林值

函式種類: 資料庫功能


 
 
內容說明 


本函式用來刪除字元 (char) 物件。參數 bid 為字元的物件代碼。執行成功則傳回 true 值,失敗傳回 false 值。

 

--------------------------------------------------------------------------------
 函式:ifx_update_char() 
--------------------------------------------------------------------------------
 


Informix 資料庫函式庫


ifx_update_char
更改字元物件。

語法: boolean ifx_update_char(int bid, string content);

傳回值: 布林值

函式種類: 資料庫功能


 
 
內容說明 


本函式用來更改字元 (char) 物件。參數 bid 為字元的物件代碼。參數 content 為欲使用的新字元。執行成功則傳回 true 值,失敗傳回 false 值。

 

--------------------------------------------------------------------------------
 函式:ifx_get_char() 
--------------------------------------------------------------------------------
 


Informix 資料庫函式庫


ifx_get_char
取得字元物件。

語法: string ifx_get_char(int bid);

傳回值: 字串

函式種類: 資料庫功能


 
 
內容說明 


本函式用來取得字元 (char) 物件。參數 bid 為字元的物件代碼。傳回值為字元的內容。

 

--------------------------------------------------------------------------------
 函式:ifx_create_blob() 
--------------------------------------------------------------------------------
 


Informix 資料庫函式庫


ifx_create_blob
建立長位元物件。

語法: int ifx_create_blob(int type, int mode, string param);

傳回值: 整數

函式種類: 資料庫功能


 
 
內容說明 


本函式用來建立長位元 (blob) 物件。參數 type 表示 blob 的型態,1 表文字資料;0 表位元資料。參數 mode 為長位元資料的存放處,0 表在記憶體;1 表在檔案中。參數 param 為 blob 的內容,若 mode 為 0 則為記憶體指標;若 mode 為 1 則為檔名。成功則傳回長位元的物件代碼,失敗傳回 false 值。

 

--------------------------------------------------------------------------------
 函式:ifx_copy_blob() 
--------------------------------------------------------------------------------
 


Informix 資料庫函式庫


ifx_copy_blob
復制長位元物件。

語法: int ifx_copy_blob(int bid);

傳回值: 整數

函式種類: 資料庫功能


 
 
內容說明 


本函式用來復制長位元 (blob) 物件。參數 bid 為 blob 物件代碼。成功則傳回新的長位元物件代碼,失敗傳回 false 值。

 

--------------------------------------------------------------------------------
 函式:ifx_free_blob() 
--------------------------------------------------------------------------------
 


Informix 資料庫函式庫


ifx_free_blob
刪除長位元物件。

語法: boolean ifx_free_blob(int bid);

傳回值: 布林值

函式種類: 資料庫功能


 
 
內容說明 


本函式用來刪除長位元 (blob) 物件。參數 bid 為 blob 物件代碼。執行成功則傳回 true 值,失敗傳回 false 值。

 

--------------------------------------------------------------------------------
 函式:ifx_get_blob() 
--------------------------------------------------------------------------------
 


Informix 資料庫函式庫


ifx_get_blob
取得長位元物件。

語法: string ifx_get_blob(int bid);

傳回值: 字串

函式種類: 資料庫功能


 
 
內容說明 


本函式用來取得長位元 (blob) 物件。參數 bid 為長位元的物件代碼。傳回值為 blob 物件的內容。

 

--------------------------------------------------------------------------------
 函式:ifx_update_blob() 
--------------------------------------------------------------------------------
 


Informix 資料庫函式庫


ifx_update_blob
更改長位元物件。

語法: boolean ifx_update_blob(int bid, string content);

傳回值: 布林值

函式種類: 資料庫功能


 
 
內容說明 


本函式用來更改長位元 (blob) 物件。參數 bid 為 blob 物件代碼。參數 content 為欲使用新的 blob 資料。執行成功則傳回 true 值,失敗傳回 false 值。
 

--------------------------------------------------------------------------------
 函式:ifx_blobinfile_mode() 
--------------------------------------------------------------------------------
 


Informix 資料庫函式庫


ifx_blobinfile_mode
設定長位元物件模式。

語法: boolean ifx_blobinfile_mode(int mode);

傳回值: 布林值

函式種類: 資料庫功能


 
 
內容說明 


本函式用來設定所有 select 的 SQL 指令用到的長位元 (blob) 物件模式內定值。參數 mode 的值為儲存 blob 資料的地點, 0 表在記憶體;1 表在檔案中。執行成功則傳回 true 值,失敗傳回 false 值。

 

--------------------------------------------------------------------------------
 函式:ifx_textasvarchar() 
--------------------------------------------------------------------------------
 


Informix 資料庫函式庫


ifx_textasvarchar
設定文字模式內定值。

語法: boolean ifx_textasvarchar(int mode);

傳回值: 布林值

函式種類: 資料庫功能


 
 
內容說明 


本函式用來設定所有 select 的 SQL 指令用到的文字 (text) 物件模式內定值。參數 mode 的值為 0 表傳回 blob 的代碼;1 表傳回 varchar 字串。執行成功則傳回 true 值,失敗傳回 false 值。

 

--------------------------------------------------------------------------------
 函式:ifx_byteasvarchar() 
--------------------------------------------------------------------------------
 


Informix 資料庫函式庫


ifx_byteasvarchar
設定位元組模式內定值。

語法: boolean ifx_byteasvarchar(int mode);

傳回值: 布林值

函式種類: 資料庫功能


 
 
內容說明 


本函式用來設定所有 select 的 SQL 指令用到的位元組 (byte) 物件模式內定值。參數 mode 的值為 0 表傳回 blob 的代碼;1 表傳回 varchar 字串。執行成功則傳回 true 值,失敗傳回 false 值。


--------------------------------------------------------------------------------
 函式:ifx_nullformat() 
--------------------------------------------------------------------------------
 


Informix 資料庫函式庫


ifx_nullformat
設定空字元模式內定值。

語法: boolean ifx_nullformat(int mode);

傳回值: 布林值

函式種類: 資料庫功能


 
 
內容說明 


本函式用來設定所有 select 的 SQL 指令用到的空字元 (null) 物件模式內定值。參數 mode 的值為 0 表傳回 "" (空字串);1 表傳回 NULL 字串。執行成功則傳回 true 值,失敗傳回 false 值。

 

--------------------------------------------------------------------------------
 函式:ifxus_create_slob() 
--------------------------------------------------------------------------------
 


Informix 資料庫函式庫


ifxus_create_slob
建立 slob 物件。

語法: int ifxus_create_slob(int mode);

傳回值: 整數

函式種類: 資料庫功能


 
 
內容說明 


本函式用來建立 slob 物件。參數 mode 值如下表

數值 常數 
1 LO_RDONLY 
2 LO_WRONLY 
4 LO_APPEND 
8 LO_RDWR 
16 LO_BUFFER 
32 LO_NOBUFFER 


當然也 mode 可以直接使用常數值,如 IFX_LO_RDONLY。若有需要,可使用數字相加,使 mode 值更有變化。成功則傳回 slob 的物件代碼,失敗傳回 false 值。

 

--------------------------------------------------------------------------------
 函式:ifx_free_slob() 
--------------------------------------------------------------------------------
 


Informix 資料庫函式庫


ifx_free_slob
刪除 slob 物件。

語法: boolean ifxus_free_slob(int bid);

傳回值: 布林值

函式種類: 資料庫功能


 
 
內容說明 


本函式用來刪除 slob 物件。參數 bid 為 slob 物件代碼。執行成功則傳回 true 值,失敗傳回 false 值。

 

--------------------------------------------------------------------------------
 函式:ifxus_close_slob() 
--------------------------------------------------------------------------------
 


Informix 資料庫函式庫


ifxus_close_slob
刪除 slob 物件。

語法: boolean ifxus_close_slob(int bid);

傳回值: 布林值

函式種類: 資料庫功能


 
 
內容說明 


本函式用來刪除 slob 物件。參數 bid 為 slob 物件代碼。執行成功則傳回 true 值,失敗傳回 false 值。

 

--------------------------------------------------------------------------------
 函式:ifxus_open_slob() 
--------------------------------------------------------------------------------
 


Informix 資料庫函式庫


ifxus_open_slob
開啟 slob 物件。

語法: int ifxus_open_slob(long bid, int mode);

傳回值: 整數

函式種類: 資料庫功能


 
 
內容說明 


本函式用來開啟 slob 物件。參數 bid 為 slob 物件代碼。參數 mode 值如下表

數值 常數 
1 LO_RDONLY 
2 LO_WRONLY 
4 LO_APPEND 
8 LO_RDWR 
16 LO_BUFFER 
32 LO_NOBUFFER 


當然也 mode 可以直接使用常數值,如 IFX_LO_RDONLY。若有需要,可使用數字相加,使 mode 值更有變化。成功則傳回 slob 的物件代碼,失敗傳回 false 值。

 

--------------------------------------------------------------------------------
 函式:ifxus_tell_slob() 
--------------------------------------------------------------------------------
 


Informix 資料庫函式庫


ifxus_tell_slob
傳回目前檔案或找尋位置。

語法: int ifxus_tell_slob(long bid);

傳回值: 整數

函式種類: 資料庫功能


 
 
內容說明 


本函式傳回目前檔案或者找尋檔案的位置。參數 bid 為 slob 物件代碼。執行成功則傳回代碼值,失敗傳回 false 值。


--------------------------------------------------------------------------------
 函式:ifxus_seek_slob() 
--------------------------------------------------------------------------------
 


Informix 資料庫函式庫


ifxus_seek_slob
設定目前檔案或找尋位置。

語法: int ifxus_seek_blob(long bid, int mode, long offset);

傳回值: 整數

函式種類: 資料庫功能


 
 
內容說明 


本函式用來設定目前檔案或找尋檔案的位置。參數 bid 為 slob 物件代碼。參數 mode 的值如下:0 表 LO_SEEK_SET、1 表 LO_SEEK_CUR、2 表 LO_SEEK_END。參數 offset 為位元組偏移值。執行成功則傳回代碼值,失敗傳回 false 值。
 

--------------------------------------------------------------------------------
 函式:ifxus_read_slob() 
--------------------------------------------------------------------------------
 


Informix 資料庫函式庫


ifxus_read_slob
讀取指定數目的 slob 物件。

語法: string ifxus_read_slob(long bid, long nbytes);

傳回值: 字串

函式種類: 資料庫功能


 
 
內容說明 


本函式用來讀取指定位元數的 slob 物件。參數 bid 為 slob 物件代碼。參數 nbytes 為位元組數目。執行成功則傳回 slob 部份字串,失敗傳回 false 值。

 

--------------------------------------------------------------------------------
 函式:ifxus_write_slob() 
--------------------------------------------------------------------------------
 


Informix 資料庫函式庫


ifxus_write_slob
將字串寫入 slob 物件中。

語法: int ifxus_write_slob(long bid, string content);

傳回值: 整數

函式種類: 資料庫功能


 
 
內容說明 


本函式將指定字串寫入 slob 物件之中。參數 bid 為 slob 物件代碼。參數 content 為待寫入字串。執行成功則傳回寫入字元數,失敗傳回 false 值。  (http://www.fanqiang.com)     進入【UNIX論壇

相關文章
PHP4手冊:函數庫及函數(四十六) SNMP 網管函式庫 (2001-04-18 16:56:55)
PHP4手冊:函數庫及函數(四十五) Solid 資料庫連結函式庫 (2001-04-18 16:54:16)
PHP4手冊:函數庫及函數(四十四) 信號與共享記憶體函式庫 (2001-04-18 16:49:09)
PHP4手冊:函數庫及函數(四十三) 常規表示法函式庫 (2001-04-18 16:40:33)
PHP4手冊:函數庫及函數(四十二) URL 處理函式庫 (2001-04-18 16:37:13)
PHP4手冊:函數庫及函數(四十一) PostgreSQL 資料庫函式庫 (2001-04-18 15:58:12)
PHP4手冊:函數庫及函數(四十) PDF 格式檔案函式庫 - 2 (2001-04-18 15:53:53)
PHP4手冊:函數庫及函數(四十) PDF 格式檔案函式庫 - 1 (2001-04-18 15:53:35)
PHP4手冊:函數庫及函數(三十九) Perl 相容語法函式庫 (2001-04-18 15:45:08)
PHP4手冊:函數庫及函數(三十八) Oracle 資料庫函式庫 (2001-04-18 15:43:09)

===更多相關===
 

★  樊強制作 歡迎分享  ★