mirror of
https://github.com/php/php-src.git
synced 2026-04-19 05:51:02 +02:00
added new functions:
mysqli_connect_error mysqli_connect_errno which return possible errors for the last connect
This commit is contained in:
@@ -1422,6 +1422,8 @@ PHP_FUNCTION(mysqli_real_connect)
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", mysql_error(mysql));
|
||||
RETURN_FALSE;
|
||||
}
|
||||
php_mysqli_set_error(mysql_errno(mysql), (char *)mysql_error(mysql) TSRMLS_CC);
|
||||
|
||||
RETURN_TRUE;
|
||||
}
|
||||
/* }}} */
|
||||
@@ -1675,24 +1677,24 @@ PHP_FUNCTION(mysqli_stmt_close)
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto void mysqli_stmt_data_seek(object stmt, int offset)
|
||||
Move internal result pointer */
|
||||
Move internal result pointer */
|
||||
PHP_FUNCTION(mysqli_stmt_data_seek)
|
||||
{
|
||||
STMT *stmt;
|
||||
zval *mysql_stmt;
|
||||
PR_STMT *prstmt;
|
||||
long offset;
|
||||
STMT *stmt;
|
||||
zval *mysql_stmt;
|
||||
PR_STMT *prstmt;
|
||||
long offset;
|
||||
|
||||
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ol", &mysql_stmt, mysqli_stmt_class_entry, &offset) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
MYSQLI_FETCH_RESOURCE(stmt, STMT *, prstmt, PR_STMT *, &mysql_stmt, "mysqli_stmt");
|
||||
|
||||
|
||||
mysql_stmt_data_seek(stmt->stmt, offset);
|
||||
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ol", &mysql_stmt, mysqli_stmt_class_entry, &offset) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
MYSQLI_FETCH_RESOURCE(stmt, STMT *, prstmt, PR_STMT *, &mysql_stmt, "mysqli_stmt");
|
||||
|
||||
|
||||
mysql_stmt_data_seek(stmt->stmt, offset);
|
||||
return;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto mixed mysqli_stmt_num_rows(object stmt)
|
||||
|
||||
@@ -50,6 +50,8 @@ function_entry mysqli_functions[] = {
|
||||
PHP_FE(mysqli_close, NULL)
|
||||
PHP_FE(mysqli_commit, NULL)
|
||||
PHP_FE(mysqli_connect, NULL)
|
||||
PHP_FE(mysqli_connect_errno, NULL)
|
||||
PHP_FE(mysqli_connect_error, NULL)
|
||||
PHP_FE(mysqli_data_seek, NULL)
|
||||
PHP_FE(mysqli_debug, NULL)
|
||||
PHP_FE(mysqli_disable_reads_from_master, NULL)
|
||||
|
||||
@@ -76,6 +76,7 @@ PHP_FUNCTION(mysqli_connect)
|
||||
mysql_close(mysql);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
php_mysqli_set_error(mysql_errno(mysql), (char *) mysql_error(mysql) TSRMLS_CC);
|
||||
|
||||
if (MyG(profiler)) {
|
||||
prmysql = (PR_MYSQL *)MYSQLI_PROFILER_NEW(prmain, MYSQLI_PR_MYSQL, 0);
|
||||
@@ -99,6 +100,22 @@ PHP_FUNCTION(mysqli_connect)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto int mysqli_connct_errno()
|
||||
Returns the numerical value of the error message from last connect command */
|
||||
PHP_FUNCTION(mysqli_connect_errno)
|
||||
{
|
||||
RETURN_LONG(MyG(error_no));
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto string mysqli_connect_error()
|
||||
Returns the text of the error message from previous MySQL operation */
|
||||
PHP_FUNCTION(mysqli_connect_error)
|
||||
{
|
||||
RETURN_STRING(MyG(error_msg),1);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto array mysqli_fetch_array (object result [,int resulttype])
|
||||
Fetch a result row as an associative array, a numeric array, or both */
|
||||
PHP_FUNCTION(mysqli_fetch_array)
|
||||
|
||||
@@ -203,6 +203,8 @@ PHP_FUNCTION(mysqli_character_set_name);
|
||||
PHP_FUNCTION(mysqli_close);
|
||||
PHP_FUNCTION(mysqli_commit);
|
||||
PHP_FUNCTION(mysqli_connect);
|
||||
PHP_FUNCTION(mysqli_connect_errno);
|
||||
PHP_FUNCTION(mysqli_connect_error);
|
||||
PHP_FUNCTION(mysqli_data_seek);
|
||||
PHP_FUNCTION(mysqli_debug);
|
||||
PHP_FUNCTION(mysqli_disable_reads_from_master);
|
||||
|
||||
Reference in New Issue
Block a user