Google
搜索www.dodoakn 搜索DoDoKan

函数:ifx_num_fields()

ifx_num_fields
取得返回字段的数目。
语法: int ifx_num_fields(int result_id);
返回值: 整数
函数种类: 数据库功能

内容说明

本函数可以得到返回字段的数目。参数 result_id 是经过 ifx_query() 或 ifx_prepare() 的返回代号。若发生错误则返回 false 值。

函数:ifx_nullformat()

ifx_nullformat
配置空字符模式默认值。
语法: boolean ifx_nullformat(int mode);
返回值: 布尔值
函数种类: 数据库功能

内容说明

本函数用来配置所有 select 的 SQL 指令用到的空字符 (null) 类模式默认值。参数 mode 的值为 0 表返回 “” (空字符串);1 表返回 NULL 字符串。执行成功则返回 true 值,失败返回 false 值。

函数:ifx_htmltbl_result()

ifx_htmltbl_result
将 query 返回资料转成 HTML 表格。
语法: int ifx_htmltbl_result(int result_id, string [html_table_options]);
返回值: 整数
函数种类: 数据库功能

内容说明

本函数用来将 query 查询结果格式化成 HTML 标记格式的表格形式。参数 html_table_options 可省略,为 <table> 标记中的参数选项。成功则返回列数,失败则返回 false 值。

使用范例

以下的范例中,<table> 标记的参数设表格边宽为 2。
<?php
$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<br>”, $rowcount);
die (“请重新执行 SQL 指令<br>\n”);
}
if (! ifx_do($rid) {
// […]

函数:ifx_getsqlca()

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] 等六个元素的数组。

使用范例

下例为部份程序
<?php
$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<br>n“;
?>

函数:ifx_get_char()

ifx_get_char
取得字符类。
语法: string ifx_get_char(int bid);
返回值: 字符串
函数种类: 数据库功能

内容说明

本函数用来取得字符 (char) 类。参数 bid 为字符的类代码。返回值为字符的内容。