maxdb_warning_count

maxdb::warning_count

(PECL maxdb >= 1.0)

maxdb_warning_count -- maxdb::warning_countReturns the number of warnings from the last query for the given link

说明

过程化风格

maxdb_warning_count ( resource $link ) : int

面向对象风格

int $maxdb->warning_count;

maxdb_warning_count() returns the number of warnings from the last query in the connection represented by the link parameter.

返回值

Number of warnings or zero if there are no warnings.

范例

Example #1 面向对象风格

<?php
$maxdb 
= new maxdb("localhost""MONA""RED""DEMODB");

/* check connection */
if (maxdb_connect_errno()) {
   
printf("Connect failed: %s\n"maxdb_connect_error());
   exit();
}

$maxdb->query("CREATE TABLE temp.mycity LIKE hotel.city");

/* a remarkable city in Wales */
$query "INSERT INTO temp.mycity (zip, name) VALUES('11111',
       'Llanfairpwllgwyngyllgogerychwyrndrobwllllantysiliogogogoch')"
;

$maxdb->query($query);

printf ("Number of warning: %d\n"$maxdb->warning_count);

/* close connection */
$maxdb->close();
?>

Example #2 过程化风格

<?php
$link 
maxdb_connect("localhost""MONA""RED""DEMODB");

/* check connection */
if (maxdb_connect_errno()) {
   
printf("Connect failed: %s\n"maxdb_connect_error());
   exit();
}

maxdb_query($link"CREATE TABLE temp.mycity LIKE hotel.city");

/* a remarkable long city name in Wales */
$query "INSERT INTO temp.mycity (zip, name) VALUES('11111',
       'Llanfairpwllgwyngyllgogerychwyrndrobwllllantysiliogogogoch')"
;

maxdb_query($link$query);

printf ("Number of warning: %d\n"maxdb_warning_count($link));

/* close connection */
maxdb_close($link);
?>

以上例程的输出类似于:

Warning: maxdb_query(): -8004 POS(62) Constant must be compatible with column type and length <...>
Number of warning: 0

参见

  • maxdb_errno() - Returns the error code for the most recent function call
  • maxdb_error() - Returns a string description of the last error
  • maxdb_sqlstate() - Returns the SQLSTATE error from previous MaxDB operation

相关文章
php ibm db2 函数 returns the auto generated id of the last insert query that successfully executed on this connectionphp maxdb 函数 returns the error code from last connect callphp maxdb 函数 returns the number of columns for the most recent queryphp maxdb 函数 returns the auto generated id used in the last queryphp maxdb 函数 check if there any more query results from a multi queryphp maxdb 函数 prepare next result from multi queryphp maxdb 函数 returns rpl query typephp maxdb 函数 returns the total number of rows changed deleted or inserted by the last executed statementphp maxdb 函数 returns the number of parameter for the given statementphp maxdb 函数 transfers a result set from the last queryphp maxdb 函数 returns whether thread safety is given or notphp maxdb 函数 returns the number of warnings from the last query for the given linkphp sqlite 函数 execute a query against a given database and returns an arrayphp sqlite 函数 executes a query against a given database and returns a result handlephp sqlsrv 函数 returns the number of rows modified by the last insert update or delete query executedphp svn 函数 returns the length of a file from a given version of the fsphp sybase 函数 returns the last message from the serverphp mysqli returns the number of warnings from the last query for the given linkphp mysqlnduhconnection returns the number of warnings from the last query for the given linkphp sdo das relational 函数 executes a given sql query against a relational database and returns the results as a normalised data graph
关注编程学问公众号