男女疯狂一边摸一边做羞羞视频|啊好深好硬快点用力别停动态图|亚洲一区无码中文字幕|特级无码毛片免费视频播放▽|久久狠狠躁免费观看|国内精品久久久久久网站

PDO::errorCode

(PHP 5 >= 5.1.0, PHP 7, PHP 8, PECL pdo >= 0.1.0)

PDO::errorCode 獲取跟數據庫句柄上一次操作相關(guān)的 SQLSTATE

說(shuō)明

PDO::errorCode(): mixed

返回值

返回一個(gè) SQLSTATE,一個(gè)由5個(gè)字母或數字組成的在 ANSI SQL 標準中定義的標識符。 簡(jiǎn)要地說(shuō),一個(gè) SQLSTATE 由前面兩個(gè)字符的類(lèi)值和后面三個(gè)字符的子類(lèi)值組成。 class value of 01 indicates a warning and is accompanied by a return code of SQL_SUCCESS_WITH_INFO. Class values other than '01', except for the class 'IM', indicate an error. The class 'IM' is specific to warnings and errors that derive from the implementation of PDO (or perhaps ODBC, if you're using the ODBC driver) itself. The subclass value '000' in any class indicates that there is no subclass for that SQLSTATE.

PDO::errorCode() only retrieves error codes for operations performed directly on the database handle. If you create a PDOStatement object through PDO::prepare() or PDO::query() and invoke an error on the statement handle, PDO::errorCode() will not reflect that error. You must call PDOStatement::errorCode() to return the error code for an operation performed on a particular statement handle.

如果數據庫句柄沒(méi)有進(jìn)行操作,則返回 null 。

范例

示例 #1 取得一個(gè) SQLSTATE 碼

<?php
/* 引發(fā)一個(gè)錯誤 -- BONES 數據表不存在 */
$dbh->exec("INSERT INTO bones(skull) VALUES ('lucy')");

echo 
"\nPDO::errorCode(): ";
print 
$dbh->errorCode();
?>

以上例程會(huì )輸出:

PDO::errorCode(): 42S02

參見(jiàn)

男女疯狂一边摸一边做羞羞视频|啊好深好硬快点用力别停动态图|亚洲一区无码中文字幕|特级无码毛片免费视频播放▽|久久狠狠躁免费观看|国内精品久久久久久网站