mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
new functions (4.1.1): mysql_sqlstate, mysql_stmt_sqlstate
This commit is contained in:
parent
3a550b3c8c
commit
4554dc4a37
3 changed files with 56 additions and 0 deletions
|
@ -1725,6 +1725,24 @@ PHP_FUNCTION(mysqli_select_db)
|
|||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto string mysqli_sqlstate(resource link)
|
||||
Returns the SQLSTATE error from previous MySQL operation */
|
||||
#if MYSQL_VERSION_ID >= 40101
|
||||
PHP_FUNCTION(mysqli_sqlstate)
|
||||
{
|
||||
MYSQL *mysql;
|
||||
zval *mysql_link;
|
||||
PR_MYSQL *prmysql;
|
||||
|
||||
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_link, mysqli_link_class_entry) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
MYSQLI_FETCH_RESOURCE(mysql, MYSQL *, prmysql, PR_MYSQL *, &mysql_link, "mysqli_link");
|
||||
RETURN_STRING((char *)mysql_sqlstate(mysql),1);
|
||||
}
|
||||
#endif
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto string mysqli_ssl_set(resource link [,string key [,string cert [,string ca [,string capath [,string cipher]]]]])
|
||||
*/
|
||||
PHP_FUNCTION(mysqli_ssl_set)
|
||||
|
@ -1819,6 +1837,25 @@ PHP_FUNCTION(mysqli_stmt_store_result)
|
|||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto string mysqli_stmt_error(resource stmt)
|
||||
*/
|
||||
#if MYSQL_VERSION_ID >= 40101
|
||||
PHP_FUNCTION(mysqli_stmt_sqlstate)
|
||||
{
|
||||
STMT *stmt;
|
||||
zval *mysql_stmt;
|
||||
PR_STMT *prstmt;
|
||||
|
||||
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_stmt, mysqli_stmt_class_entry) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
MYSQLI_FETCH_RESOURCE(stmt, STMT *, prstmt, PR_STMT *, &mysql_stmt, "mysqli_stmt");
|
||||
|
||||
RETURN_STRING((char *)mysql_stmt_sqlstate(stmt->stmt),1);
|
||||
}
|
||||
#endif
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto resource mysqli_store_result(resource link)
|
||||
Buffer result set on client */
|
||||
PHP_FUNCTION(mysqli_store_result)
|
||||
|
|
|
@ -104,12 +104,19 @@ function_entry mysqli_functions[] = {
|
|||
PHP_FE(mysqli_send_query, NULL)
|
||||
PHP_FALIAS(mysqli_set_opt, mysqli_options, NULL)
|
||||
PHP_FE(mysqli_slave_query, NULL)
|
||||
|
||||
#if MYSQL_VERSION_ID >= 40101
|
||||
PHP_FE(mysqli_sqlstate, NULL)
|
||||
#endif
|
||||
PHP_FE(mysqli_ssl_set, NULL)
|
||||
PHP_FE(mysqli_stat, NULL)
|
||||
PHP_FE(mysqli_stmt_affected_rows, NULL)
|
||||
PHP_FE(mysqli_stmt_close, NULL)
|
||||
PHP_FE(mysqli_stmt_errno, NULL)
|
||||
PHP_FE(mysqli_stmt_error, NULL)
|
||||
#if MYSQL_VERSION_ID >= 40101
|
||||
PHP_FE(mysqli_stmt_sqlstate, NULL)
|
||||
#endif
|
||||
PHP_FE(mysqli_store_result, NULL)
|
||||
PHP_FE(mysqli_stmt_store_result, NULL)
|
||||
PHP_FE(mysqli_thread_id, NULL)
|
||||
|
@ -168,6 +175,9 @@ function_entry mysqli_link_methods[] = {
|
|||
PHP_FALIAS(select_db,mysqli_select_db,NULL)
|
||||
PHP_FALIAS(set_opt, mysqli_options,NULL)
|
||||
PHP_FALIAS(slave_query,mysqli_slave_query,NULL)
|
||||
#if MYSQL_VERSION_ID >= 40101
|
||||
PHP_FALIAS(sqlstate, mysqli_sqlstate,NULL)
|
||||
#endif
|
||||
PHP_FALIAS(ssl_set,mysqli_ssl_set,NULL)
|
||||
PHP_FALIAS(stat,mysqli_stat,NULL)
|
||||
PHP_FALIAS(store_result,mysqli_store_result,NULL)
|
||||
|
@ -221,6 +231,9 @@ function_entry mysqli_stmt_methods[] = {
|
|||
PHP_FALIAS(close,mysqli_stmt_close,NULL)
|
||||
PHP_FALIAS(errno,mysqli_stmt_errno,NULL)
|
||||
PHP_FALIAS(error,mysqli_stmt_error,NULL)
|
||||
#if MYSQL_VERSION_ID >= 40101
|
||||
PHP_FALIAS(sqlstate, mysqli_stmt_sqlstate,NULL)
|
||||
#endif
|
||||
{NULL, NULL, NULL}
|
||||
};
|
||||
/* }}} */
|
||||
|
|
|
@ -254,12 +254,18 @@ PHP_FUNCTION(mysqli_select_db);
|
|||
PHP_FUNCTION(mysqli_send_long_data);
|
||||
PHP_FUNCTION(mysqli_send_query);
|
||||
PHP_FUNCTION(mysqli_slave_query);
|
||||
#if MYSQL_VERSION_ID >= 40101
|
||||
PHP_FUNCTION(mysqli_sqlstate);
|
||||
#endif
|
||||
PHP_FUNCTION(mysqli_ssl_set);
|
||||
PHP_FUNCTION(mysqli_stat);
|
||||
PHP_FUNCTION(mysqli_stmt_affected_rows);
|
||||
PHP_FUNCTION(mysqli_stmt_close);
|
||||
PHP_FUNCTION(mysqli_stmt_errno);
|
||||
PHP_FUNCTION(mysqli_stmt_error);
|
||||
#if MYSQL_VERSION_ID >= 40101
|
||||
PHP_FUNCTION(mysqli_stmt_sqlstate);
|
||||
#endif
|
||||
PHP_FUNCTION(mysqli_stmt_store_result);
|
||||
PHP_FUNCTION(mysqli_store_result);
|
||||
PHP_FUNCTION(mysqli_thread_id);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue