Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /home/zhenxiangba/zhenxiangba.com/public_html/phproxy-improved-master/index.php on line 456
PHP: maxdb_stmt_errno - Manual
[go: Go Back, main page]

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

search for in the

maxdb_stmt_error" width="11" height="7"/> <maxdb_stmt_data_seek
Last updated: Wed, 01 Nov 2006
view this page in

maxdb_stmt_errno

(PECL)

maxdb_stmt_errno

(no version information, might be only in CVS)

maxdb_stmt->errno -- 直近のステートメントコール時のエラーコードを返す

説明

手続き型

int maxdb_stmt_errno ( resource stmt )

オブジェクト指向型 (プロパティ)

class stmt {

int errno

}

stmt で指定したステートメントについて、 maxdb_stmt_errno() は 直近に実行されたステートメントのエラーコードを返します。

注意: 返される可能性のあるエラーコードについては、SQLDBC のドキュメント http://dev.mysql.com/doc/maxdb/ を参照ください。

返り値

エラーコードの値を返します。エラーが発生しなかった場合はゼロを返します。

例 1. オブジェクト指向型

<?php
/* 接続をオープンします */
$maxdb = new maxdb("localhost", "MONA", "RED", "DEMODB");

/* 接続を調べます */
if (maxdb_connect_errno()) {
  
printf("接続に失敗しました: %s\n", maxdb_connect_error());
   exit();
}

$maxdb->query("CREATE TABLE temp.mycity LIKE hotel.city");
$maxdb->query("INSERT INTO temp.mycity SELECT * FROM hotel.city");


$query = "SELECT name, zip FROM temp.mycity ORDER BY name";
if (
$stmt = $maxdb->prepare($query)) {

  
/* テーブルを削除します */
  
$maxdb->query("DROP TABLE temp.mycity");

  
/* クエリを実行します */
  
$stmt->execute();

  
printf("エラー: %d.\n", $stmt->errno);

  
/* ステートメントを閉じます */
  
$stmt->close();
}

/* 接続を閉じます */
$maxdb->close();
?>

例 2. 手続き型

<?php
/* 接続をオープンします */
$link = maxdb_connect("localhost", "MONA", "RED", "DEMODB");

/* 接続を調べます */
if (maxdb_connect_errno()) {
  
printf("接続に失敗しました: %s\n", maxdb_connect_error());
   exit();
}

maxdb_query($link, "CREATE TABLE temp.mycity LIKE hotel.city");
maxdb_query($link, "INSERT INTO temp.mycity SELECT * FROM hotel.city");


$query = "SELECT name, zip FROM temp.mycity ORDER BY name";
if (
$stmt = maxdb_prepare($link, $query)) {

  
/* テーブルを削除します */
  
maxdb_query($link, "DROP TABLE temp.mycity");

  
/* クエリを実行します */
  
maxdb_stmt_execute($stmt);

  
printf("エラー: %d.\n", maxdb_stmt_errno($stmt));

  
/* ステートメントを閉じます */
  
maxdb_stmt_close($stmt);
}

/* 接続を閉じます */
maxdb_close($link);
?>

上の例の出力は、たとえば以下のようになります。

Warning: maxdb_stmt_execute(): -4004 POS(23) Unknown table name:MYCITY [42000] <...>
エラー: -4004.


add a note add a note User Contributed Notes
maxdb_stmt_errno
There are no user contributed notes for this page.

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