Back to index

php5  5.3.10
Functions
mysqli_fe.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

 PHP_FUNCTION (mysqli)
 PHP_FUNCTION (mysqli_affected_rows)
 PHP_FUNCTION (mysqli_autocommit)
 PHP_FUNCTION (mysqli_change_user)
 PHP_FUNCTION (mysqli_character_set_name)
 PHP_FUNCTION (mysqli_set_charset)
 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_dump_debug_info)
 PHP_FUNCTION (mysqli_errno)
 PHP_FUNCTION (mysqli_error)
 PHP_FUNCTION (mysqli_fetch_all)
 PHP_FUNCTION (mysqli_fetch_array)
 PHP_FUNCTION (mysqli_fetch_assoc)
 PHP_FUNCTION (mysqli_fetch_object)
 PHP_FUNCTION (mysqli_fetch_field)
 PHP_FUNCTION (mysqli_fetch_fields)
 PHP_FUNCTION (mysqli_fetch_field_direct)
 PHP_FUNCTION (mysqli_fetch_lengths)
 PHP_FUNCTION (mysqli_fetch_row)
 PHP_FUNCTION (mysqli_field_count)
 PHP_FUNCTION (mysqli_field_seek)
 PHP_FUNCTION (mysqli_field_tell)
 PHP_FUNCTION (mysqli_free_result)
 PHP_FUNCTION (mysqli_get_cache_stats)
 PHP_FUNCTION (mysqli_get_client_stats)
 PHP_FUNCTION (mysqli_get_connection_stats)
 PHP_FUNCTION (mysqli_get_charset)
 PHP_FUNCTION (mysqli_get_client_info)
 PHP_FUNCTION (mysqli_get_client_version)
 PHP_FUNCTION (mysqli_get_host_info)
 PHP_FUNCTION (mysqli_get_proto_info)
 PHP_FUNCTION (mysqli_get_server_info)
 PHP_FUNCTION (mysqli_get_server_version)
 PHP_FUNCTION (mysqli_get_warnings)
 PHP_FUNCTION (mysqli_info)
 PHP_FUNCTION (mysqli_insert_id)
 PHP_FUNCTION (mysqli_init)
 PHP_FUNCTION (mysqli_kill)
 PHP_FUNCTION (mysqli_link_construct)
 PHP_FUNCTION (mysqli_set_local_infile_default)
 PHP_FUNCTION (mysqli_set_local_infile_handler)
 PHP_FUNCTION (mysqli_more_results)
 PHP_FUNCTION (mysqli_multi_query)
 PHP_FUNCTION (mysqli_next_result)
 PHP_FUNCTION (mysqli_num_fields)
 PHP_FUNCTION (mysqli_num_rows)
 PHP_FUNCTION (mysqli_options)
 PHP_FUNCTION (mysqli_ping)
 PHP_FUNCTION (mysqli_poll)
 PHP_FUNCTION (mysqli_prepare)
 PHP_FUNCTION (mysqli_query)
 PHP_FUNCTION (mysqli_stmt_result_metadata)
 PHP_FUNCTION (mysqli_report)
 PHP_FUNCTION (mysqli_read_query_result)
 PHP_FUNCTION (mysqli_real_connect)
 PHP_FUNCTION (mysqli_real_query)
 PHP_FUNCTION (mysqli_real_escape_string)
 PHP_FUNCTION (mysqli_reap_async_query)
 PHP_FUNCTION (mysqli_rollback)
 PHP_FUNCTION (mysqli_row_seek)
 PHP_FUNCTION (mysqli_select_db)
 PHP_FUNCTION (mysqli_stmt_attr_get)
 PHP_FUNCTION (mysqli_stmt_attr_set)
 PHP_FUNCTION (mysqli_stmt_bind_param)
 PHP_FUNCTION (mysqli_stmt_bind_result)
 PHP_FUNCTION (mysqli_stmt_execute)
 PHP_FUNCTION (mysqli_stmt_field_count)
 PHP_FUNCTION (mysqli_stmt_init)
 PHP_FUNCTION (mysqli_stmt_prepare)
 PHP_FUNCTION (mysqli_stmt_fetch)
 PHP_FUNCTION (mysqli_stmt_param_count)
 PHP_FUNCTION (mysqli_stmt_send_long_data)
 PHP_FUNCTION (mysqli_embedded_server_end)
 PHP_FUNCTION (mysqli_embedded_server_start)
 PHP_FUNCTION (mysqli_sqlstate)
 PHP_FUNCTION (mysqli_ssl_set)
 PHP_FUNCTION (mysqli_stat)
 PHP_FUNCTION (mysqli_refresh)
 PHP_FUNCTION (mysqli_stmt_affected_rows)
 PHP_FUNCTION (mysqli_stmt_close)
 PHP_FUNCTION (mysqli_stmt_data_seek)
 PHP_FUNCTION (mysqli_stmt_errno)
 PHP_FUNCTION (mysqli_stmt_error)
 PHP_FUNCTION (mysqli_stmt_free_result)
 PHP_FUNCTION (mysqli_stmt_get_result)
 PHP_FUNCTION (mysqli_stmt_get_warnings)
 PHP_FUNCTION (mysqli_stmt_reset)
 PHP_FUNCTION (mysqli_stmt_insert_id)
 PHP_FUNCTION (mysqli_stmt_more_results)
 PHP_FUNCTION (mysqli_stmt_next_result)
 PHP_FUNCTION (mysqli_stmt_num_rows)
 PHP_FUNCTION (mysqli_stmt_sqlstate)
 PHP_FUNCTION (mysqli_stmt_store_result)
 PHP_FUNCTION (mysqli_store_result)
 PHP_FUNCTION (mysqli_thread_id)
 PHP_FUNCTION (mysqli_thread_safe)
 PHP_FUNCTION (mysqli_use_result)
 PHP_FUNCTION (mysqli_warning_count)
 PHP_FUNCTION (mysqli_stmt_construct)
 PHP_FUNCTION (mysqli_result_construct)
 PHP_FUNCTION (mysqli_driver_construct)
 PHP_METHOD (mysqli_warning, __construct)

Function Documentation

PHP_FUNCTION ( mysqli  )
PHP_FUNCTION ( mysqli_affected_rows  )

Definition at line 38 of file mysqli_api.c.

{
       MY_MYSQL             *mysql;
       zval                 *mysql_link;
       my_ulonglong  rc;

       if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_link, mysqli_link_class_entry) == FAILURE) {
              return;
       }

       MYSQLI_FETCH_RESOURCE_CONN(mysql, &mysql_link, MYSQLI_STATUS_VALID);

       rc = mysql_affected_rows(mysql->mysql);
       if (rc == (my_ulonglong) -1) {
              RETURN_LONG(-1);
       }
       MYSQLI_RETURN_LONG_LONG(rc);
}

Here is the call graph for this function:

PHP_FUNCTION ( mysqli_autocommit  )

Definition at line 61 of file mysqli_api.c.

{
       MY_MYSQL      *mysql;
       zval          *mysql_link;
       zend_bool     automode;

       if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ob", &mysql_link, mysqli_link_class_entry, &automode) == FAILURE) {
              return;
       }
       MYSQLI_FETCH_RESOURCE_CONN(mysql, &mysql_link, MYSQLI_STATUS_VALID);

       if (mysql_autocommit(mysql->mysql, (my_bool)automode)) {
              RETURN_FALSE;
       }
       RETURN_TRUE;
}

Here is the call graph for this function:

PHP_FUNCTION ( mysqli_change_user  )

Definition at line 518 of file mysqli_api.c.

{
       MY_MYSQL      *mysql;
       zval          *mysql_link = NULL;
       char          *user, *password, *dbname;
       int                  user_len, password_len, dbname_len;
       ulong         rc;
#if !defined(MYSQLI_USE_MYSQLND) && defined(HAVE_MYSQLI_SET_CHARSET)
       const         CHARSET_INFO * old_charset;
#endif

       if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Osss", &mysql_link, mysqli_link_class_entry, &user, &user_len, &password, &password_len, &dbname, &dbname_len) == FAILURE) {
              return;
       }
       MYSQLI_FETCH_RESOURCE_CONN(mysql, &mysql_link, MYSQLI_STATUS_VALID);

#if !defined(MYSQLI_USE_MYSQLND) && defined(HAVE_MYSQLI_SET_CHARSET)
       old_charset = mysql->mysql->charset;
#endif

       rc = mysql_change_user(mysql->mysql, user, password, dbname);
       MYSQLI_REPORT_MYSQL_ERROR(mysql->mysql);

       if (rc) {
              RETURN_FALSE;
       }
#if !defined(MYSQLI_USE_MYSQLND) && defined(HAVE_MYSQLI_SET_CHARSET)
       if (mysql_get_server_version(mysql->mysql) < 501023L) {
              /*
                Request the current charset, or it will be reset to the system one.
                5.0 doesn't support it. Support added in 5.1.23 by fixing the following bug :
                Bug #30472 libmysql doesn't reset charset, insert_id after succ. mysql_change_user() call
              */
              rc = mysql_set_character_set(mysql->mysql, old_charset->csname);
       }
#endif

       RETURN_TRUE;
}

Here is the call graph for this function:

PHP_FUNCTION ( mysqli_character_set_name  )

Definition at line 561 of file mysqli_api.c.

{
       MY_MYSQL      *mysql;
       zval          *mysql_link;

       if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_link, mysqli_link_class_entry) == FAILURE) {
              return;
       }

       MYSQLI_FETCH_RESOURCE_CONN(mysql, &mysql_link, MYSQLI_STATUS_VALID);

       RETURN_STRING((char *)mysql_character_set_name(mysql->mysql), 1);
}

Here is the call graph for this function:

PHP_FUNCTION ( mysqli_set_charset  )

Definition at line 611 of file mysqli_api.c.

Here is the call graph for this function:

PHP_FUNCTION ( mysqli_commit  )

Definition at line 633 of file mysqli_api.c.

{
       MY_MYSQL      *mysql;
       zval          *mysql_link;

       if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_link, mysqli_link_class_entry) == FAILURE) {
              return;
       }
       MYSQLI_FETCH_RESOURCE_CONN(mysql, &mysql_link, MYSQLI_STATUS_VALID);
       if (mysql_commit(mysql->mysql)) {
              RETURN_FALSE;
       }
       RETURN_TRUE;
}

Here is the call graph for this function:

PHP_FUNCTION ( mysqli_connect  )

Definition at line 311 of file mysqli_nonapi.c.

Here is the call graph for this function:

PHP_FUNCTION ( mysqli_connect_errno  )

Definition at line 329 of file mysqli_nonapi.c.

PHP_FUNCTION ( mysqli_connect_error  )

Definition at line 337 of file mysqli_nonapi.c.

{
       if (MyG(error_msg)) {
              RETURN_STRING(MyG(error_msg),1);
       } else {
              RETURN_NULL();
       }
}
PHP_FUNCTION ( mysqli_data_seek  )

Definition at line 651 of file mysqli_api.c.

{
       MYSQL_RES     *result;
       zval          *mysql_result;
       long          offset;

       if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ol", &mysql_result, mysqli_result_class_entry, &offset) == FAILURE) {
              return;
       }

       MYSQLI_FETCH_RESOURCE(result, MYSQL_RES *, &mysql_result, "mysqli_result", MYSQLI_STATUS_VALID);

       if (mysqli_result_is_unbuffered(result)) {
              php_error_docref(NULL TSRMLS_CC, E_WARNING, "Function cannot be used with MYSQL_USE_RESULT");
              RETURN_FALSE;
       }

       if (offset < 0 || offset >= mysql_num_rows(result)) {
              RETURN_FALSE;
       }

       mysql_data_seek(result, offset);
       RETURN_TRUE;
}

Here is the call graph for this function:

PHP_FUNCTION ( mysqli_debug  )

Definition at line 679 of file mysqli_api.c.

{
       char   *debug;
       int           debug_len;

       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &debug, &debug_len) == FAILURE) {
              return;
       }

       mysql_debug(debug);
       RETURN_TRUE;
}

Here is the call graph for this function:

PHP_FUNCTION ( mysqli_dump_debug_info  )

Definition at line 696 of file mysqli_api.c.

{
       MY_MYSQL      *mysql;
       zval          *mysql_link;

       if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_link, mysqli_link_class_entry) == FAILURE) {
              return;
       }
       MYSQLI_FETCH_RESOURCE_CONN(mysql, &mysql_link, MYSQLI_STATUS_VALID);

       RETURN_BOOL(!mysql_dump_debug_info(mysql->mysql))
}

Here is the call graph for this function:

PHP_FUNCTION ( mysqli_errno  )

Definition at line 712 of file mysqli_api.c.

{
       MY_MYSQL      *mysql;
       zval          *mysql_link;

       if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_link, mysqli_link_class_entry) == FAILURE) {
              return;
       }
       MYSQLI_FETCH_RESOURCE_CONN(mysql, &mysql_link, MYSQLI_STATUS_VALID);
       RETURN_LONG(mysql_errno(mysql->mysql));
}

Here is the call graph for this function:

PHP_FUNCTION ( mysqli_error  )

Definition at line 727 of file mysqli_api.c.

{
       MY_MYSQL      *mysql;
       zval          *mysql_link;

       if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_link, mysqli_link_class_entry) == FAILURE) {
              return;
       }
       MYSQLI_FETCH_RESOURCE_CONN(mysql, &mysql_link, MYSQLI_STATUS_VALID);
       RETURN_STRING((char *)mysql_error(mysql->mysql),1);
}

Here is the call graph for this function:

PHP_FUNCTION ( mysqli_fetch_all  )
PHP_FUNCTION ( mysqli_fetch_array  )

Definition at line 350 of file mysqli_nonapi.c.

Here is the call graph for this function:

PHP_FUNCTION ( mysqli_fetch_assoc  )

Definition at line 358 of file mysqli_nonapi.c.

Here is the call graph for this function:

PHP_FUNCTION ( mysqli_fetch_object  )

Definition at line 435 of file mysqli_nonapi.c.

Here is the call graph for this function:

PHP_FUNCTION ( mysqli_fetch_field  )
PHP_FUNCTION ( mysqli_fetch_fields  )
PHP_FUNCTION ( mysqli_fetch_field_direct  )
PHP_FUNCTION ( mysqli_fetch_lengths  )
PHP_FUNCTION ( mysqli_fetch_row  )
PHP_FUNCTION ( mysqli_field_count  )
PHP_FUNCTION ( mysqli_field_seek  )
PHP_FUNCTION ( mysqli_field_tell  )
PHP_FUNCTION ( mysqli_get_cache_stats  )
PHP_FUNCTION ( mysqli_get_client_stats  )
PHP_FUNCTION ( mysqli_get_connection_stats  )
PHP_FUNCTION ( mysqli_get_charset  )
PHP_FUNCTION ( mysqli_get_client_info  )
PHP_FUNCTION ( mysqli_get_client_version  )
PHP_FUNCTION ( mysqli_get_host_info  )
PHP_FUNCTION ( mysqli_get_proto_info  )
PHP_FUNCTION ( mysqli_get_server_info  )
PHP_FUNCTION ( mysqli_get_server_version  )
PHP_FUNCTION ( mysqli_get_warnings  )

Definition at line 827 of file mysqli_nonapi.c.

{
       MY_MYSQL                    *mysql;
       zval                        *mysql_link;
       MYSQLI_RESOURCE             *mysqli_resource;
       MYSQLI_WARNING              *w;

       if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_link, mysqli_link_class_entry) == FAILURE) {
              return;
       }
       MYSQLI_FETCH_RESOURCE_CONN(mysql, &mysql_link, MYSQLI_STATUS_VALID);

       if (mysql_warning_count(mysql->mysql)) {
              w = php_get_warnings(mysql->mysql TSRMLS_CC);
       } else {
              RETURN_FALSE;
       }
       mysqli_resource = (MYSQLI_RESOURCE *)ecalloc (1, sizeof(MYSQLI_RESOURCE));
       mysqli_resource->ptr = mysqli_resource->info = (void *)w;
       mysqli_resource->status = MYSQLI_STATUS_VALID;
       MYSQLI_RETURN_RESOURCE(mysqli_resource, mysqli_warning_class_entry);
}

Here is the call graph for this function:

PHP_FUNCTION ( mysqli_info  )
PHP_FUNCTION ( mysqli_insert_id  )
PHP_FUNCTION ( mysqli_init  )
PHP_FUNCTION ( mysqli_kill  )
PHP_FUNCTION ( mysqli_link_construct  )

Definition at line 320 of file mysqli_nonapi.c.

Here is the call graph for this function:

PHP_FUNCTION ( mysqli_set_local_infile_default  )
PHP_FUNCTION ( mysqli_set_local_infile_handler  )
PHP_FUNCTION ( mysqli_more_results  )
PHP_FUNCTION ( mysqli_multi_query  )

Definition at line 443 of file mysqli_nonapi.c.

{
       MY_MYSQL      *mysql;
       zval          *mysql_link;
       char          *query = NULL;
       int           query_len;

       if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &mysql_link, mysqli_link_class_entry, &query, &query_len) == FAILURE) {
              return;
       }
       MYSQLI_FETCH_RESOURCE_CONN(mysql, &mysql_link, MYSQLI_STATUS_VALID);

       MYSQLI_ENABLE_MQ;
       if (mysql_real_query(mysql->mysql, query, query_len)) {
#ifndef MYSQLI_USE_MYSQLND
              char s_error[MYSQL_ERRMSG_SIZE], s_sqlstate[SQLSTATE_LENGTH+1];
              unsigned int s_errno;
              /* we have to save error information, cause
              MYSQLI_DISABLE_MQ will reset error information */
              strcpy(s_error, mysql_error(mysql->mysql));
              strcpy(s_sqlstate, mysql_sqlstate(mysql->mysql));
              s_errno = mysql_errno(mysql->mysql);
#else
              MYSQLND_ERROR_INFO error_info = mysql->mysql->error_info;
#endif
              MYSQLI_REPORT_MYSQL_ERROR(mysql->mysql);
              MYSQLI_DISABLE_MQ;

#ifndef MYSQLI_USE_MYSQLND
              /* restore error information */
              strcpy(mysql->mysql->net.last_error, s_error);
              strcpy(mysql->mysql->net.sqlstate, s_sqlstate);
              mysql->mysql->net.last_errno = s_errno;
#else
              mysql->mysql->error_info = error_info;
#endif
              RETURN_FALSE;
       }
       RETURN_TRUE;
}

Here is the call graph for this function:

PHP_FUNCTION ( mysqli_next_result  )
PHP_FUNCTION ( mysqli_num_fields  )
PHP_FUNCTION ( mysqli_num_rows  )
PHP_FUNCTION ( mysqli_options  )
PHP_FUNCTION ( mysqli_ping  )
PHP_FUNCTION ( mysqli_poll  )
PHP_FUNCTION ( mysqli_prepare  )
PHP_FUNCTION ( mysqli_query  )

Definition at line 486 of file mysqli_nonapi.c.

{
       MY_MYSQL                    *mysql;
       zval                        *mysql_link;
       MYSQLI_RESOURCE             *mysqli_resource;
       MYSQL_RES                   *result;
       char                        *query = NULL;
       int                         query_len;
       long                        resultmode = MYSQLI_STORE_RESULT;

       if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os|l", &mysql_link, mysqli_link_class_entry, &query, &query_len, &resultmode) == FAILURE) {
              return;
       }

       if (!query_len) {
              php_error_docref(NULL TSRMLS_CC, E_WARNING, "Empty query");
              RETURN_FALSE;
       }
       if ((resultmode & ~MYSQLI_ASYNC) != MYSQLI_USE_RESULT && (resultmode & ~MYSQLI_ASYNC) != MYSQLI_STORE_RESULT) {
              php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid value for resultmode");
              RETURN_FALSE;
       }

       MYSQLI_FETCH_RESOURCE_CONN(mysql, &mysql_link, MYSQLI_STATUS_VALID);

       MYSQLI_DISABLE_MQ;


#ifdef MYSQLI_USE_MYSQLND
       if (resultmode & MYSQLI_ASYNC) {
              if (mysqli_async_query(mysql->mysql, query, query_len)) {
                     MYSQLI_REPORT_MYSQL_ERROR(mysql->mysql);
                     RETURN_FALSE;
              }
              mysql->async_result_fetch_type = resultmode & ~MYSQLI_ASYNC;
              RETURN_TRUE;
       }
#endif

       if (mysql_real_query(mysql->mysql, query, query_len)) {
              MYSQLI_REPORT_MYSQL_ERROR(mysql->mysql);
              RETURN_FALSE;
       }

       if (!mysql_field_count(mysql->mysql)) {
              /* no result set - not a SELECT */
              if (MyG(report_mode) & MYSQLI_REPORT_INDEX) {
                     php_mysqli_report_index(query, mysqli_server_status(mysql->mysql) TSRMLS_CC);
              }
              RETURN_TRUE;
       }

       switch (resultmode) {
              case MYSQLI_STORE_RESULT:
                     result = mysql_store_result(mysql->mysql);
                     break;
              case MYSQLI_USE_RESULT:
                     result = mysql_use_result(mysql->mysql);
                     break;
       }
       if (!result) {
              php_mysqli_throw_sql_exception((char *)mysql_sqlstate(mysql->mysql), mysql_errno(mysql->mysql) TSRMLS_CC,
                                                                      "%s", mysql_error(mysql->mysql));
              RETURN_FALSE;
       }

       if (MyG(report_mode) & MYSQLI_REPORT_INDEX) {
              php_mysqli_report_index(query, mysqli_server_status(mysql->mysql) TSRMLS_CC);
       }

       mysqli_resource = (MYSQLI_RESOURCE *)ecalloc (1, sizeof(MYSQLI_RESOURCE));
       mysqli_resource->ptr = (void *)result;
       mysqli_resource->status = MYSQLI_STATUS_VALID;
       MYSQLI_RETURN_RESOURCE(mysqli_resource, mysqli_result_class_entry);
}

Here is the call graph for this function:

PHP_FUNCTION ( mysqli_stmt_result_metadata  )
PHP_FUNCTION ( mysqli_report  )

Definition at line 34 of file mysqli_report.c.

{
       long flags;


       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &flags) == FAILURE) {
              return;
       }

       MyG(report_mode) = flags;

       RETURN_TRUE;
}

Here is the call graph for this function:

PHP_FUNCTION ( mysqli_read_query_result  )
PHP_FUNCTION ( mysqli_real_connect  )
PHP_FUNCTION ( mysqli_real_query  )
PHP_FUNCTION ( mysqli_real_escape_string  )
PHP_FUNCTION ( mysqli_reap_async_query  )
PHP_FUNCTION ( mysqli_rollback  )
PHP_FUNCTION ( mysqli_row_seek  )
PHP_FUNCTION ( mysqli_select_db  )
PHP_FUNCTION ( mysqli_stmt_attr_get  )
PHP_FUNCTION ( mysqli_stmt_attr_set  )
PHP_FUNCTION ( mysqli_stmt_bind_param  )

Definition at line 213 of file mysqli_api.c.

{
       zval                 ***args;
       int                         argc = ZEND_NUM_ARGS();
       int                         num_vars;
       int                         start = 2;
       MY_STMT                     *stmt;
       zval                 *mysql_stmt;
       char                 *types;
       int                         types_len;
       unsigned long rc;

       /* calculate and check number of parameters */
       if (argc < 2) {
              /* there has to be at least one pair */
              WRONG_PARAM_COUNT;
       }

       if (zend_parse_method_parameters((getThis()) ? 1:2 TSRMLS_CC, getThis(), "Os", &mysql_stmt, mysqli_stmt_class_entry,
                                                               &types, &types_len) == FAILURE) {
              return;
       }

       MYSQLI_FETCH_RESOURCE_STMT(stmt, &mysql_stmt, MYSQLI_STATUS_VALID);

       num_vars = argc - 1;
       if (getThis()) {
              start = 1;
       } else {
              /* ignore handle parameter in procedural interface*/
              --num_vars;
       }
       if (!types_len) {
              php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid type or no types specified");
              RETURN_FALSE;
       }

       if (types_len != argc - start) {
              /* number of bind variables doesn't match number of elements in type definition string */
              php_error_docref(NULL TSRMLS_CC, E_WARNING, "Number of elements in type definition string doesn't match number of bind variables");
              RETURN_FALSE;
       }

       if (types_len != mysql_stmt_param_count(stmt->stmt)) {
              php_error_docref(NULL TSRMLS_CC, E_WARNING, "Number of variables doesn't match number of parameters in prepared statement");
              RETURN_FALSE;
       }

       args = (zval ***)safe_emalloc(argc, sizeof(zval **), 0);

       if (zend_get_parameters_array_ex(argc, args) == FAILURE) {
              zend_wrong_param_count(TSRMLS_C);
              rc = 1;
       } else {
              rc = mysqli_stmt_bind_param_do_bind(stmt, argc, num_vars, args, start, types TSRMLS_CC);
              MYSQLI_REPORT_STMT_ERROR(stmt->stmt);
       }

       efree(args);

       RETURN_BOOL(!rc);
}

Here is the call graph for this function:

PHP_FUNCTION ( mysqli_stmt_bind_result  )

Definition at line 473 of file mysqli_api.c.

{
       zval          ***args;
       int                  argc = ZEND_NUM_ARGS();
       int                  start = 1;
       ulong         rc;
       MY_STMT              *stmt;
       zval          *mysql_stmt;

       if (getThis()) {
              start = 0;
       }

       if (zend_parse_method_parameters((getThis()) ? 0:1 TSRMLS_CC, getThis(), "O", &mysql_stmt, mysqli_stmt_class_entry) == FAILURE) {
              return;
       }

       MYSQLI_FETCH_RESOURCE_STMT(stmt, &mysql_stmt, MYSQLI_STATUS_VALID);

       if (argc < (getThis() ? 1 : 2)) {
              WRONG_PARAM_COUNT;
       }

       if ((argc - start) != mysql_stmt_field_count(stmt->stmt)) {
              php_error_docref(NULL TSRMLS_CC, E_WARNING, "Number of bind variables doesn't match number of fields in prepared statement");
              RETURN_FALSE;
       }

       args = (zval ***)safe_emalloc(argc, sizeof(zval **), 0);

       if (zend_get_parameters_array_ex(argc, args) == FAILURE) {
              efree(args);
              WRONG_PARAM_COUNT;
       }

       rc = mysqli_stmt_bind_result_do_bind(stmt, args, argc, start TSRMLS_CC);

       efree(args);

       RETURN_BOOL(!rc);
}

Here is the call graph for this function:

PHP_FUNCTION ( mysqli_stmt_execute  )

Definition at line 758 of file mysqli_api.c.

{
       MY_STMT              *stmt;
       zval          *mysql_stmt;
#ifndef MYSQLI_USE_MYSQLND
       unsigned int  i;
       zval          **copies = NULL;
#endif

       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, &mysql_stmt, MYSQLI_STATUS_VALID);

#ifndef MYSQLI_USE_MYSQLND
       if (stmt->param.var_cnt) {
              int j;
              for (i = 0; i < stmt->param.var_cnt; i++) {
                     for (j = i + 1; j < stmt->param.var_cnt; j++) {
                            /* Oops, someone binding the same variable - clone */
                            if (stmt->param.vars[j] == stmt->param.vars[i] && stmt->param.vars[i]) {
                                   php_mysqli_stmt_copy_it(&copies, stmt->param.vars[i], stmt->param.var_cnt, i);
                                   break;
                            }
                     }
              }
       }
       for (i = 0; i < stmt->param.var_cnt; i++) {
              if (stmt->param.vars[i]) {
                     if ( !(stmt->param.is_null[i] = (stmt->param.vars[i]->type == IS_NULL)) ) {
                            zval *the_var = copies && copies[i]? copies[i]:stmt->param.vars[i];
                            switch (stmt->stmt->params[i].buffer_type) {
                                   case MYSQL_TYPE_VAR_STRING:
                                          if (the_var == stmt->param.vars[i] && Z_TYPE_P(stmt->param.vars[i]) != IS_STRING) {
                                                 php_mysqli_stmt_copy_it(&copies, stmt->param.vars[i], stmt->param.var_cnt, i);
                                                 the_var = copies[i];
                                          }
                                          convert_to_string_ex(&the_var);
                                          stmt->stmt->params[i].buffer = Z_STRVAL_P(the_var);
                                          stmt->stmt->params[i].buffer_length = Z_STRLEN_P(the_var);
                                          break;
                                   case MYSQL_TYPE_DOUBLE:
                                          if (the_var == stmt->param.vars[i] && Z_TYPE_P(stmt->param.vars[i]) != IS_DOUBLE) {
                                                 php_mysqli_stmt_copy_it(&copies, stmt->param.vars[i], stmt->param.var_cnt, i);
                                                 the_var = copies[i];
                                          }
                                          convert_to_double_ex(&the_var);
                                          stmt->stmt->params[i].buffer = &Z_DVAL_P(the_var);
                                          break;
                                   case MYSQL_TYPE_LONGLONG:
                                   case MYSQL_TYPE_LONG:
                                          if (the_var == stmt->param.vars[i] && Z_TYPE_P(stmt->param.vars[i]) != IS_LONG) {
                                                 php_mysqli_stmt_copy_it(&copies, stmt->param.vars[i], stmt->param.var_cnt, i);
                                                 the_var = copies[i];
                                          }
                                          convert_to_long_ex(&the_var);
                                          stmt->stmt->params[i].buffer = &Z_LVAL_P(the_var);
                                          break;
                                   default:
                                          break;
                            }
                     }
              }
       }
#endif

       if (mysql_stmt_execute(stmt->stmt)) {
              MYSQLI_REPORT_STMT_ERROR(stmt->stmt);
              RETVAL_FALSE;
       } else {
              RETVAL_TRUE;
       }

#ifndef MYSQLI_USE_MYSQLND
       if (copies) {
              for (i = 0; i < stmt->param.var_cnt; i++) {
                     if (copies[i]) {
                            zval_ptr_dtor(&copies[i]);
                     }
              }
              efree(copies);
       }
#endif

       if (MyG(report_mode) & MYSQLI_REPORT_INDEX) {
              php_mysqli_report_index(stmt->query, mysqli_stmt_server_status(stmt->stmt) TSRMLS_CC);
       }
}

Here is the call graph for this function:

PHP_FUNCTION ( mysqli_stmt_field_count  )
PHP_FUNCTION ( mysqli_stmt_init  )
PHP_FUNCTION ( mysqli_stmt_prepare  )
PHP_FUNCTION ( mysqli_stmt_fetch  )
PHP_FUNCTION ( mysqli_stmt_param_count  )
PHP_FUNCTION ( mysqli_stmt_send_long_data  )
PHP_FUNCTION ( mysqli_embedded_server_end  )

Definition at line 115 of file mysqli_embedded.c.

{
#ifdef HAVE_MYSQLI_EMBEDDED
       mysql_server_end();
#endif
}
PHP_FUNCTION ( mysqli_embedded_server_start  )

Definition at line 32 of file mysqli_embedded.c.

{
#ifdef HAVE_EMBEDDED_MYSQLI
       long start;
       zval *args;
       zval *grps;

       int    argc = 0;
       char **arguments;
       char **groups;
       HashPosition pos;
       int index, rc;

       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "laa", &start, &args, &grps) == FAILURE) {
              return;
       }

       if (!start) {
              mysql_server_init(-1,NULL, NULL);
              RETURN_TRUE;
       }
       /* get arguments */
       if ((argc = zend_hash_num_elements(HASH_OF(args)))) {
              arguments = safe_emalloc(sizeof(char *), argc + 1, 0);
              arguments[0] = NULL;

              zend_hash_internal_pointer_reset_ex(HASH_OF(args), &pos);

              for (index = 0;; zend_hash_move_forward_ex(HASH_OF(args), &pos))      {
                     zval **item;

                     if (zend_hash_get_current_data_ex(HASH_OF(args), (void **) &item, &pos) == FAILURE) {
                            break;
                     }

                     convert_to_string_ex(item);

                     arguments[++index] = Z_STRVAL_PP(item);
              }
              argc++;
       }

       /* get groups */
       if ((zend_hash_num_elements(HASH_OF(grps)))) {
              groups = safe_emalloc(sizeof(char *), zend_hash_num_elements(HASH_OF(grps)) + 1, 0);
              groups[0] = NULL;

              zend_hash_internal_pointer_reset_ex(HASH_OF(grps), &pos);

              for (index = 0;; zend_hash_move_forward_ex(HASH_OF(grps), &pos))      {
                     zval ** item;

                     if (zend_hash_get_current_data_ex(HASH_OF(grps), (void **) &item, &pos) == FAILURE) {
                            break;
                     }

                     convert_to_string_ex(item);

                     groups[++index] = Z_STRVAL_PP(item);
              }
              groups[index] = NULL;
       } else {
              groups = safe_emalloc(sizeof(char *), 1, 0);
              groups[0] = NULL;
       }

       rc = mysql_server_init(argc, arguments, groups);

       if (argc) {
              efree(arguments);
       }
       efree(groups);

       if (rc) {
              RETURN_FALSE;
       }
       RETURN_TRUE;
#endif
}

Here is the call graph for this function:

PHP_FUNCTION ( mysqli_sqlstate  )
PHP_FUNCTION ( mysqli_ssl_set  )
PHP_FUNCTION ( mysqli_stat  )
PHP_FUNCTION ( mysqli_refresh  )
PHP_FUNCTION ( mysqli_stmt_affected_rows  )
PHP_FUNCTION ( mysqli_stmt_data_seek  )
PHP_FUNCTION ( mysqli_stmt_errno  )
PHP_FUNCTION ( mysqli_stmt_error  )
PHP_FUNCTION ( mysqli_stmt_free_result  )
PHP_FUNCTION ( mysqli_stmt_get_result  )
PHP_FUNCTION ( mysqli_stmt_get_warnings  )

Definition at line 852 of file mysqli_nonapi.c.

{
       MY_STMT                            *stmt;
       zval                        *stmt_link;
       MYSQLI_RESOURCE             *mysqli_resource;
       MYSQLI_WARNING              *w;

       if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &stmt_link, mysqli_stmt_class_entry) == FAILURE) {
              return;
       }
       MYSQLI_FETCH_RESOURCE_STMT(stmt, &stmt_link, MYSQLI_STATUS_VALID);

       if (mysqli_stmt_warning_count(stmt->stmt)) {
              w = php_get_warnings(mysqli_stmt_get_connection(stmt->stmt) TSRMLS_CC);
       } else {
              RETURN_FALSE;
       }
       mysqli_resource = (MYSQLI_RESOURCE *)ecalloc (1, sizeof(MYSQLI_RESOURCE));
       mysqli_resource->ptr = mysqli_resource->info = (void *)w;
       mysqli_resource->status = MYSQLI_STATUS_VALID;
       MYSQLI_RETURN_RESOURCE(mysqli_resource, mysqli_warning_class_entry);
}

Here is the call graph for this function:

PHP_FUNCTION ( mysqli_stmt_reset  )
PHP_FUNCTION ( mysqli_stmt_insert_id  )
PHP_FUNCTION ( mysqli_stmt_more_results  )
PHP_FUNCTION ( mysqli_stmt_next_result  )
PHP_FUNCTION ( mysqli_stmt_num_rows  )
PHP_FUNCTION ( mysqli_stmt_sqlstate  )
PHP_FUNCTION ( mysqli_stmt_store_result  )
PHP_FUNCTION ( mysqli_store_result  )
PHP_FUNCTION ( mysqli_thread_id  )
PHP_FUNCTION ( mysqli_thread_safe  )
PHP_FUNCTION ( mysqli_use_result  )
PHP_FUNCTION ( mysqli_warning_count  )
PHP_FUNCTION ( mysqli_stmt_construct  )

Definition at line 981 of file mysqli.c.

{
       MY_MYSQL                    *mysql;
       zval                        *mysql_link;
       MY_STMT                            *stmt;
       MYSQLI_RESOURCE             *mysqli_resource;
       char                        *statement;
       int                                statement_len;

       switch (ZEND_NUM_ARGS())
       {
              case 1:  /* mysql_stmt_init */
                     if (zend_parse_parameters(1 TSRMLS_CC, "O", &mysql_link, mysqli_link_class_entry)==FAILURE) {
                            return;
                     }
                     MYSQLI_FETCH_RESOURCE_CONN(mysql, &mysql_link, MYSQLI_STATUS_VALID);

                     stmt = (MY_STMT *)ecalloc(1,sizeof(MY_STMT));

                     stmt->stmt = mysql_stmt_init(mysql->mysql);
              break;
              case 2:
                     if (zend_parse_parameters(2 TSRMLS_CC, "Os", &mysql_link, mysqli_link_class_entry, &statement, &statement_len)==FAILURE) {
                            return;
                     }
                     MYSQLI_FETCH_RESOURCE_CONN(mysql, &mysql_link, MYSQLI_STATUS_VALID);

                     stmt = (MY_STMT *)ecalloc(1,sizeof(MY_STMT));

                     if ((stmt->stmt = mysql_stmt_init(mysql->mysql))) {
                            mysql_stmt_prepare(stmt->stmt, (char *)statement, statement_len);
                     }
              break;
              default:
                     WRONG_PARAM_COUNT;
              break;
       }

       if (!stmt->stmt) {
              efree(stmt);
              RETURN_FALSE;
       }

       mysqli_resource = (MYSQLI_RESOURCE *)ecalloc (1, sizeof(MYSQLI_RESOURCE));
       mysqli_resource->ptr = (void *)stmt;
       mysqli_resource->status = (ZEND_NUM_ARGS() == 1) ? MYSQLI_STATUS_INITIALIZED : MYSQLI_STATUS_VALID;

       ((mysqli_object *) zend_object_store_get_object(getThis() TSRMLS_CC))->ptr = mysqli_resource;
}

Here is the call graph for this function:

PHP_FUNCTION ( mysqli_result_construct  )

Definition at line 1037 of file mysqli.c.

{
       MY_MYSQL                    *mysql;
       MYSQL_RES                   *result = NULL;
       zval                        *mysql_link;
       MYSQLI_RESOURCE             *mysqli_resource;
       long                        resmode = MYSQLI_STORE_RESULT;

       switch (ZEND_NUM_ARGS()) {
              case 1:
                     if (zend_parse_parameters(1 TSRMLS_CC, "O", &mysql_link, mysqli_link_class_entry)==FAILURE) {
                            return;
                     }
                     break;
              case 2:
                     if (zend_parse_parameters(2 TSRMLS_CC, "Ol", &mysql_link, mysqli_link_class_entry, &resmode)==FAILURE) {
                            return;
                     }
                     break;
              default:
                     WRONG_PARAM_COUNT;
       }

       MYSQLI_FETCH_RESOURCE_CONN(mysql, &mysql_link, MYSQLI_STATUS_VALID);

       switch (resmode) {
              case MYSQLI_STORE_RESULT:
                     result = mysql_store_result(mysql->mysql);
                     break;
              case MYSQLI_USE_RESULT:
                     result = mysql_use_result(mysql->mysql);
                     break;
              default:
                     php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid value for resultmode");
       }

       if (!result) {
              RETURN_FALSE;
       }

       mysqli_resource = (MYSQLI_RESOURCE *)ecalloc (1, sizeof(MYSQLI_RESOURCE));
       mysqli_resource->ptr = (void *)result;
       mysqli_resource->status = MYSQLI_STATUS_VALID;

       ((mysqli_object *) zend_object_store_get_object(getThis() TSRMLS_CC))->ptr = mysqli_resource;

}

Here is the call graph for this function:

PHP_FUNCTION ( mysqli_driver_construct  )
PHP_METHOD ( mysqli_warning  ,
__construct   
)

Definition at line 266 of file mysqli_warning.c.

{
       zval                 *z;
       mysqli_object *obj;
       MYSQL                *hdl;
       MYSQLI_WARNING  *w;
       MYSQLI_RESOURCE *mysqli_resource;

       if (ZEND_NUM_ARGS() != 1) {
              WRONG_PARAM_COUNT;
       }
       if (zend_parse_parameters(1 TSRMLS_CC, "o", &z)==FAILURE) {
              return;
       }
       obj = (mysqli_object *)zend_object_store_get_object(z TSRMLS_CC);\

       if (obj->zo.ce == mysqli_link_class_entry) {
              MY_MYSQL *mysql;
              MYSQLI_FETCH_RESOURCE_CONN(mysql, &z, MYSQLI_STATUS_VALID);
              hdl = mysql->mysql;
       } else if (obj->zo.ce == mysqli_stmt_class_entry) {
              MY_STMT *stmt;
              MYSQLI_FETCH_RESOURCE_STMT(stmt, &z, MYSQLI_STATUS_VALID);
              hdl = mysqli_stmt_get_connection(stmt->stmt);
       } else {
              php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid class argument");
              RETURN_FALSE;
       }

       if (mysql_warning_count(hdl)) {
              w = php_get_warnings(hdl TSRMLS_CC);
       } else {
              php_error_docref(NULL TSRMLS_CC, E_WARNING, "No warnings found");
              RETURN_FALSE;
       }

       mysqli_resource = (MYSQLI_RESOURCE *)ecalloc (1, sizeof(MYSQLI_RESOURCE));
       mysqli_resource->ptr = mysqli_resource->info = (void *)w;
       mysqli_resource->status = MYSQLI_STATUS_VALID;

       if (!getThis() || !instanceof_function(Z_OBJCE_P(getThis()), mysqli_warning_class_entry TSRMLS_CC)) {
              MYSQLI_RETURN_RESOURCE(mysqli_resource, mysqli_warning_class_entry);
       } else {
              ((mysqli_object *) zend_object_store_get_object(getThis() TSRMLS_CC))->ptr = mysqli_resource;
       }

}

Here is the call graph for this function: