FUNCTION NAME |
FUNCTION DESCRIPTION |
FUNCTION SYNTAX |
FUNCTION RETURN VALUE |
mysqli::set_local_infile_handler()
mysqli_set_local_infile_handler()
[mysqli::set_local_infile_handler — mysqli_set_local_infile_handler – Set callback function for LOAD DATA LOCAL INFILE command] |
This function sets the callback function [‘handler’] for the LOAD DATA LOCAL INFILE command. The callback‘s task is to read input from the file specified in the LOAD DATA LOCAL INFILE and to reformat it into the format understood by LOAD DATA INFILE . The returned data needs to match the format specified in the LOAD DATA . |
Object-oriented style:
$mysqli->set_local_infile_handler(callback_function);
Procedural style:
mysqli_set_local_infile_handler(mysqli_link, callback_function);
[mysqli_link: a link identifier returned by mysqli_connect() or mysqli_init() ; only required for the procedural style. callback_function: a callback function or object method taking the following parameters – stream: a PHP stream associated with the SQL commands INFILE ; &buffer: a string buffer to store the rewritten input; buflen: the maximum number of characters to be stored in the buffer; and &error_message: used to store any error messages that occur.] |
mysqli::set_local_infile_handler() : returns TRUE on success; FALSE on failure. |
mysqli::$sqlstate()
mysqli_sqlstate()
[mysqli::$sqlstate — mysqli_sqlstate -Returns the SQLSTATE error from previous MySQL operation] |
This function returns a string containing the SQLSTATE error code for the last error. Five characters comprise the error code; ‘00000’ means no error.
The values are specified by ANSI SQL and ODBC. Not all MySQL errors are mapped to SQLSTATE s; the general error value HY000 is used for unmapped errors. |
Object-oriented style:
$mysqli->sqlstate;
Procedural style:
mysqli_sqlstate(mysqli_link);
[mysqli_link: a link identifier returned by mysqli_connect() or mysqli_init() ; only required for the procedural style.] |
mysqli::sqlstate() : returns a 5-character string containing the SQLSTATE error code for the last error. A list of possible values is available at: http://dev.mysql.com/doc/mysql/en/error-handling.html. |
mysqli::ssl_set()
mysqli_ssl_set()
[mysqli::ssl_set — mysqli_ssl_set – Used for establishing secure connections using SSL] |
This function is used for establishing [‘setting’] secure connections using SSL. It must be called before mysqli_real_connect() and is only effective if OpenSSL support is enabled. MySQL Native Driver only supports SSL from PHP 5.3.3+; MySQL Native Driver is enabled by default on Windows platforms from PHP 5.3+. |
Object-oriented style:
$mysqli->ssl_set(key, cert, ca, capath, cipher);
Procedural style:
mysqli_ssl_set(mysqli_link, key, cert, ca, capath, cipher);
[mysqli_link: a link identifier returned by mysqli_connect() or mysqli_init() ; only required for the procedural style. key: the pathway to the key file. cert: the pathway to the certificate file. ca: the pathway to the certificate authority file. capath: the pathway to a directory that contains trusted SSL CA certificates in PEM format. cipher: a list of allowable ciphers to use for SSL encryption. — Any unused SSL parameters may be given as NULL. –] |
mysqli::ssl_set() : always returns TRUE. If SSL setup is incorrect, mysqli_real_connect() will return an error when you try to connect. |
mysqli::stat()
mysqli_stat()
[mysqli::stat — mysqli_stat – Gets the current system status] |
This function returns a string containing information relating to the system status, similar to that provided by the mysqladmin status command.
The following elements are returned in the string: ‘Uptime’; ‘Threads’; ‘Questions’; ‘Slow queries’; ‘Opens’; ‘Flush tables’; ‘Open tables’; ‘Queries per second avg’; ‘Memory in use’; ‘Max memory used’. |
Object-oriented style:
$mysqli->stat();
Procedural style:
mysqli_stat(mysqli_link);
[mysqli_link: a link identifier returned by mysqli_connect() or mysqli_init() ; only required for the procedural style.] |
mysqli::stat() : returns a string containing the server status on success; FALSE on failure. A description of the intra-string elements: ‘Uptime’ – the number of seconds that the MySQL server has been running; ‘Threads’ – the number of active threads [clients]; ‘Questions’ – the number of questions from clients since the server was started; ‘Slow queries’ – the number of queries that have taken longer than long_query_time seconds; ‘Opens’ – the number of tables the server has opened; ‘Flush tables’ – the number of flush-* , refresh , and reload commands the server has executed; ‘Open tables’ – the number of tables currently open; ‘Queries per second avg’ – Questions divided by Uptime; and the two self-explanatory elements ‘Memory in use’ and ‘Max memory used’. |
mysqli::stmt_init()
mysqli_stmt_init()
[mysqli::stmt_init — mysqli_stmt_init – Initializes a statement and returns an object for use with mysqli_stmt_prepare() ] |
This function allocates and initializes a statement object suitable for use with mysqli_stmt_prepare() . All subsequent calls to any mysqli_stmt...() function will fail until mysqli_stmt_prepare() is called. |
Object-oriented style:
$mysqli->stmt_init();
Procedural style:
mysqli_stmt_init(mysqli_link);
[mysqli_link: a link identifier returned by mysqli_connect() or mysqli_init() ; only required for the procedural style.] |
mysqli::stmt_init() : returns a mysqli statement object. |
mysqli::store_result()
mysqli_store_result()
[mysqli::store_result — mysqli_store_result – Transfers a result set from the last query] |
This function transfers the (stored) result set from the last query on the database connection represented by $mysqli [‘object-oriented’ style] / mysqli_link [‘procedural’ style]; the result set can then be used with the mysqli_data_seek() function.
When transferring large result sets it is particularly important to free the memory used to store a result set using mysqli_free_result() . |
Object-oriented style:
$mysqli->store_result(option [optional parameter]);
Procedural style:
mysqli_store_result(mysqli_link, option [optional parameter]);
[mysqli_link: a link identifier returned by mysqli_connect() or mysqli_init() ; only required for the procedural style. option: at present, this can only take the form of MYSQLI_STORE_RESULT_COPY_DATA.] |
mysqli::store_result() : returns a buffered result object on success; FALSE on failure. FALSE is returned if: the query didn’t return a result set; the reading of the result set failed; or sufficient memory for an excessively large result set cannot be allocated. If mysqli_field_count() returns a non-zero value, the statement should have produced a non-empty result set; similarly, if mysqli_error() returns an empty string – or mysqli_errno() returns zero – then no error has occurred. |
mysqli::$thread_id()
mysqli_thread_id()
[mysqli::$thread_id — mysqli_thread_id – Returns the thread ID for the current connection] |
This function returns the thread ID for the current connection; the thread can then be killed using the mysqli_kill() function. The thread ID is assigned on a per-connection basis; if the connection is broken and then re-established (for example, by using mysqli_ping() ) a new thread ID will be assigned. Thus, the thread ID should be obtained only when necessary for immediate use. A running query can be killed using the SQL command KILL QUERY processid . |
Object-oriented style:
$mysqli->thread_id;
Procedural style:
mysqli_thread_id(mysqli_link);
[mysqli_link: a link identifier returned by mysqli_connect() or mysqli_init() ; only required for the procedural style.] |
mysqli::$thread_id() : returns the thread ID for the current connection as an integer. |
mysqli::thread_safe()
mysqli_thread_safe()
[mysqli::thread_safe — mysqli_thread_safe – Returns whether thread safety is given or not] |
This function is used to determine whether the client library is compiled as thread-safe. |
Object-oriented style:
$mysqli->thread_safe();
Procedural style:
mysqli_thread_safe(); |
mysqli::thread_safe() : returns TRUE if the client library is thread-safe; FALSE otherwise. |
mysqli::use_result()
mysqli_use_result()
[mysqli::use_result — mysqli_use_result – Initiate a result set retrieval] |
This function is used to initiate the retrieval of a result set from the last mysqli_real_query() function execution on the connection. This function – or mysqli_store_result() – must be called before the results of a query can be retrieved; one or the other function must be called to stop the next query on the database connection failing. mysqli_use_result() does not transfer the entire result set from the database, and thus cannot be used by functions such as mysqli_data_seek() to move to a particular row within a result set. |
Object-oriented style:
$mysqli->use_result();
Procedural style:
mysqli_use_result(mysqli_link);
[mysqli_link: a link identifier returned by mysqli_connect() or mysqli_init() ; only required for the procedural style.] |
mysqli::use_result() : returns an unbuffered mysqli result object on success; FALSE on failure. This function should not be used if a lot of processing is performed on the client side, since this will tie up the server and prevent other threads updating the tables from which data is being fetched. |
mysqli::$warning_count()
mysqli_warning_count()
[mysqli::$warning_count — mysqli_warning_count – Returns the number of warnings from the last query for the given link] |
This function returns the number (‘count’) of warnings from the last query in the connection. You can also use the SQL command SHOW WARNINGS [limit_row_count ] to retrieve warning messages. |
Object-oriented style:
$mysqli->warning_count;
Procedural style:
mysqli_warning_count(mysqli_link);
[mysqli_link: a link identifier returned by mysqli_connect() or mysqli_init() ; only required for the procedural style.] |
mysqli::warning_count() : returns the number of warnings; if no warnings were generated, 0 is returned. |