预定义常量

下列常量由此扩展定义,且仅在此扩展编译入 PHP 或在运行时动态载入时可用。

MYSQLI_READ_DEFAULT_GROUP (int)

Read options from the named group from my.cnf or the file specified with MYSQLI_READ_DEFAULT_FILE

MYSQLI_READ_DEFAULT_FILE (int)

Read options from the named option file instead of from my.cnf

MYSQLI_OPT_CONNECT_TIMEOUT (int)

Connect timeout in seconds

MYSQLI_OPT_READ_TIMEOUT (int)

Command execution result timeout in seconds. Available as of PHP 7.2.0.

MYSQLI_OPT_LOCAL_INFILE (int)

Enables command LOAD LOCAL INFILE

MYSQLI_OPT_INT_AND_FLOAT_NATIVE (int)

Convert integer and float columns back to PHP numbers. Only valid for mysqlnd.

MYSQLI_OPT_NET_CMD_BUFFER_SIZE (int)

The size of the internal command/network buffer. Only valid for mysqlnd.

MYSQLI_OPT_NET_READ_BUFFER_SIZE (int)

Maximum read chunk size in bytes when reading the body of a MySQL command packet. Only valid for mysqlnd.

MYSQLI_OPT_SSL_VERIFY_SERVER_CERT (int)

需要 MySQL 5.1.10 及更高版本

MYSQLI_INIT_COMMAND (int)

Command to execute when connecting to MySQL server. Will automatically be re-executed when reconnecting.

MYSQLI_CLIENT_SSL (int)

Use SSL (encrypted protocol). This option should not be set by application programs; it is set internally in the MySQL client library

MYSQLI_CLIENT_COMPRESS (int)

Use compression protocol

MYSQLI_CLIENT_INTERACTIVE (int)

Allow interactive_timeout seconds (instead of wait_timeout seconds) of inactivity before closing the connection. The client's session wait_timeout variable will be set to the value of the session interactive_timeout variable.

MYSQLI_CLIENT_IGNORE_SPACE (int)

Allow spaces after function names. Makes all functions names reserved words.

MYSQLI_CLIENT_NO_SCHEMA (int)

Don't allow the db_name.tbl_name.col_name syntax.

MYSQLI_CLIENT_MULTI_QUERIES (int)

Allows multiple semicolon-delimited queries in a single mysqli_query() call.

MYSQLI_STORE_RESULT (int)

使用缓冲的结果集合。值为 0

MYSQLI_USE_RESULT (int)

使用无缓冲的结果集合。值为 1

MYSQLI_ASSOC (int)

Columns are returned into the array having the fieldname as the array index.

MYSQLI_NUM (int)

Columns are returned into the array having an enumerated index.

MYSQLI_BOTH (int)

Columns are returned into the array having both a numerical index and the fieldname as the associative index.

MYSQLI_NOT_NULL_FLAG (int)

Indicates that a field is defined as NOT NULL

MYSQLI_PRI_KEY_FLAG (int)

Field is part of a primary index

MYSQLI_UNIQUE_KEY_FLAG (int)

Field is part of a unique index.

MYSQLI_MULTIPLE_KEY_FLAG (int)

Field is part of an index.

MYSQLI_BLOB_FLAG (int)

Field is defined as BLOB

MYSQLI_UNSIGNED_FLAG (int)

Field is defined as UNSIGNED

MYSQLI_ZEROFILL_FLAG (int)

Field is defined as ZEROFILL

MYSQLI_AUTO_INCREMENT_FLAG (int)

Field is defined as AUTO_INCREMENT

MYSQLI_TIMESTAMP_FLAG (int)

Field is defined as TIMESTAMP

MYSQLI_SET_FLAG (int)

Field is defined as SET

MYSQLI_NUM_FLAG (int)

Field is defined as NUMERIC

MYSQLI_PART_KEY_FLAG (int)

Field is part of an multi-index

MYSQLI_GROUP_FLAG (int)

Field is part of GROUP BY

MYSQLI_TYPE_DECIMAL (int)

Field is defined as DECIMAL

MYSQLI_TYPE_NEWDECIMAL (int)

Precision math DECIMAL or NUMERIC field (MySQL 5.0.3 and up)

MYSQLI_TYPE_BIT (int)

Field is defined as BIT (MySQL 5.0.3 and up)

MYSQLI_TYPE_TINY (int)

Field is defined as TINYINT

MYSQLI_TYPE_SHORT (int)

Field is defined as SMALLINT

MYSQLI_TYPE_LONG (int)

Field is defined as INT

MYSQLI_TYPE_FLOAT (int)

Field is defined as FLOAT

MYSQLI_TYPE_DOUBLE (int)

Field is defined as DOUBLE

MYSQLI_TYPE_NULL (int)

Field is defined as DEFAULT NULL

MYSQLI_TYPE_TIMESTAMP (int)

Field is defined as TIMESTAMP

MYSQLI_TYPE_LONGLONG (int)

Field is defined as BIGINT

MYSQLI_TYPE_INT24 (int)

Field is defined as MEDIUMINT

MYSQLI_TYPE_DATE (int)

Field is defined as DATE

MYSQLI_TYPE_TIME (int)

Field is defined as TIME

MYSQLI_TYPE_DATETIME (int)

Field is defined as DATETIME

MYSQLI_TYPE_YEAR (int)

Field is defined as YEAR

MYSQLI_TYPE_NEWDATE (int)

Field is defined as DATE

MYSQLI_TYPE_INTERVAL (int)

Field is defined as INTERVAL

MYSQLI_TYPE_ENUM (int)

Field is defined as ENUM

MYSQLI_TYPE_SET (int)

Field is defined as SET

MYSQLI_TYPE_TINY_BLOB (int)

Field is defined as TINYBLOB

MYSQLI_TYPE_MEDIUM_BLOB (int)

Field is defined as MEDIUMBLOB

MYSQLI_TYPE_LONG_BLOB (int)

Field is defined as LONGBLOB

MYSQLI_TYPE_BLOB (int)

Field is defined as BLOB

MYSQLI_TYPE_VAR_STRING (int)

Field is defined as VARCHAR

MYSQLI_TYPE_STRING (int)

字段定义为 CHARBINARY

MYSQLI_TYPE_CHAR (int)

字段定义为 TINYINT。对于 CHAR,参阅 MYSQLI_TYPE_STRING

MYSQLI_TYPE_GEOMETRY (int)

Field is defined as GEOMETRY

MYSQLI_TYPE_JSON (int)

字段定义为 JSON。仅对 mysqlnd 和 MySQL 5.7.8 及更高版本有效。

MYSQLI_NEED_DATA (int)

More data available for bind variable

MYSQLI_NO_DATA (int)

No more data available for bind variable

MYSQLI_DATA_TRUNCATED (int)

发生数据截断。自 MySQL 5.0.5 起可用。

MYSQLI_ENUM_FLAG (int)

字段定义为 ENUM

MYSQLI_BINARY_FLAG (int)

字段定义为 BINARY

MYSQLI_CURSOR_TYPE_FOR_UPDATE (int)

MYSQLI_CURSOR_TYPE_NO_CURSOR (int)

MYSQLI_CURSOR_TYPE_READ_ONLY (int)

MYSQLI_CURSOR_TYPE_SCROLLABLE (int)

MYSQLI_STMT_ATTR_CURSOR_TYPE (int)

MYSQLI_STMT_ATTR_PREFETCH_ROWS (int)

MYSQLI_STMT_ATTR_UPDATE_MAX_LENGTH (int)

MYSQLI_SET_CHARSET_NAME (int)

MYSQLI_REPORT_INDEX (int)

如果在查询中没有使用索引或使用了坏索引,则会报告。

MYSQLI_REPORT_ERROR (int)

报告来自 mysqli 函数调用的错误。

MYSQLI_REPORT_STRICT (int)

抛出 mysqli_sql_exception 错误而不是警告。

MYSQLI_REPORT_ALL (int)

启用所有选项(报告所有)。

MYSQLI_REPORT_OFF (int)

关闭报告功能。

MYSQLI_DEBUG_TRACE_ENABLED (int)

如果 mysqli_debug() 功能启用,设置为 1。

MYSQLI_SERVER_QUERY_NO_GOOD_INDEX_USED (int)

MYSQLI_SERVER_QUERY_NO_INDEX_USED (int)

MYSQLI_SERVER_PUBLIC_KEY (int)

MYSQLI_REFRESH_GRANT (int)

刷新授权表。

MYSQLI_REFRESH_LOG (int)

刷新日志,就像执行 FLUSH LOGS SQL 语句。

MYSQLI_REFRESH_TABLES (int)

刷新表缓存,就像执行 FLUSH TABLES SQL 语句。

MYSQLI_REFRESH_HOSTS (int)

刷新主机缓存,就像执行刷新 FLUSH HOSTS SQL 语句一样。

MYSQLI_REFRESH_REPLICA (int)

MYSQLI_REFRESH_SLAVE 常量的别名。自 PHP 8.1.0 起可用。

MYSQLI_REFRESH_STATUS (int)

重置状态变量,如执行 FLUSH STATUS SQL 语句。

MYSQLI_REFRESH_THREADS (int)

刷新线程缓存。

MYSQLI_REFRESH_SLAVE (int)

在从复制服务器上:重置主服务器信息,并重新启动从服务器。就像执行 RESET SLAVE SQL 语句一样。

MYSQLI_REFRESH_MASTER (int)

在主复制服务器上:删除二进制日志索引中列出的二进制日志文件,并截断索引文件。就像执行 RESET MASTER SQL 语句一样。

MYSQLI_TRANS_COR_AND_CHAIN (int)

追加“AND CHAIN”到 mysqli_commit()mysqli_rollback()

MYSQLI_TRANS_COR_AND_NO_CHAIN (int)

追加“AND NO CHAIN”到 mysqli_commit()mysqli_rollback()

MYSQLI_TRANS_COR_RELEASE (int)

追加“RELEASE”到 mysqli_commit()mysqli_rollback()

MYSQLI_TRANS_COR_NO_RELEASE (int)

追加“NO RELEASE”到 mysqli_commit()mysqli_rollback()

MYSQLI_TRANS_START_READ_ONLY (int)

使用 mysqli_begin_transaction() 作为“START TRANSACTION READ ONLY”启动事务。

MYSQLI_TRANS_START_READ_WRITE (int)

使用 mysqli_begin_transaction() 作为“START TRANSACTION READ WRITE”启动事务。

MYSQLI_TRANS_START_CONSISTENT_SNAPSHOT (int)

使用 mysqli_begin_transaction() 作为“START TRANSACTION WITH CONSISTENT SNAPSHOT” 启动事务。

MYSQLI_CLIENT_SSL_DONT_VERIFY_SERVER_CERT (int)

需要 MySQL 5.6.5 及其以上版本。

MYSQLI_IS_MARIADB (bool)

mysqli 扩展是否针对 MariaDB 客户端库编译。自 PHP 8.1.2 起有效。