位置: 编程技术 - 正文
推荐整理分享PHP:oci_error()的用法_Oracle函数(php or),希望有所帮助,仅作参考,欢迎阅读内容。
文章相关热门搜索词:php ord,php error,php error,php ord,php occ,php oci_connect,php oci8,php oci8,内容如对您有帮助,希望把文章链接给更多的朋友!
(PHP 5, PECL OCI8 >= 1.1.0)
oci_error — 返回上一个错误
说明 array oci_error ([ resource $source ] )对于大多数错误,参数是最适合的资源句柄。对于 oci_connect(),oci_new_connect() 或 oci_pconnect() 的连接错误,不要传递参数。如果没有发现错误,oci_error() 返回 FALSE。oci_error() 以一个关联数组返回错误。在此数组中,code 是 oracle 错误代码而 message 是 oracle 的错误字符串。
Note: 自 PHP 4.3 起
offset 和 sqltext 也包括在返回的数组中,用来指出错误发生的位置以及造成错误的原始的 SQL 文本。
Example #1 连接错误后显示 Oracle 错误信息
$conn=@oci_connect("scott","tiger","mydb");if(!$conn){$e=oci_error();//Foroci_connecterrorspassnohandleechohtmlentities($e['message']);}
Example #2 语法解析错误后显示 Oracle 错误信息
$stmt=@oci_parse($conn,"select'fromdual");//notemismatchedquoteif(!$stmt){$e=oci_error($conn);//Foroci_parseerrorspasstheconnectionhandleechohtmlentities($e['message']);}
Example #3 执行错误后显示 Oracle 错误信息和出错的语句
$r=oci_execute($stmt);if(!$r){$e=oci_error($stmt);//Foroci_executeerrorspassthestatementhandleechohtmlentities($e['message']);echo"<pre>";echohtmlentities($e['sqltext']);printf("n%".($e['offset']+1)."s","^");echo"</pre>";}Note:
在 PHP 5.0.0 之前的版本必须使用 ocierror() 替代本函数。该函数名仍然可用,为向下兼容作为 oci_error() 的别名。不过其已被废弃,不推荐使用。
PHP:oci_bind_by_name()的用法_Oracle函数 oci_bind_by_name(PHP5,PECLOCI8=1.1.0)oci_bind_by_name绑定一个PHP变量到一个Oracle位置标志符说明booloci_bind_by_name(resource$stmt,string$ph_name,mixed&$variable[,int$maxlength[,int$type
PHP:oci_define_by_name()的用法_Oracle函数 oci_define_by_name(PHP5,PECLOCI8=1.1.0)oci_define_by_name在SELECT中使用PHP变量作为定义的步骤说明booloci_define_by_name(resource$statement,string$column_name,mixed&$variable[,int$type])o
PHP:oci_client_version()的用法_Oracle函数 oci_client_version(PHP5.3.7,PECLOCI8=1.4.6)oci_client_versionReturnstheOracleclientlibraryversion说明stringoci_client_version(void)ReturnsastringcontainingtheversionnumberoftheOracleCclientlibraryth
标签: php or
本文链接地址:https://www.jiuchutong.com/biancheng/281119.html 转载请保留说明!友情链接: 武汉网站建设