MySQL Variables sql_auto_is_null 数据库 参数变量解释及正确配置使用

本站中文解释

sql_auto_is_null 是MySQL中的一个用于开启或关闭空值检测的参数。当参数值为1时,空值检测被开启,当为0时,空值检测被关闭。此参数的设定值是全局的,可以控制SQL语句中对空值的检测是否被系统执行,设定值可在MySQL的配置文件中做出变更,修改例子如下:

sql_auto_is_null=0

这将会关闭空值检测,也就是消除对NULL值的检测动作,同时设置需要重启MySQL服务来使设定生效,例如:

sudo service mysql restart

官方英文解释

sql_auto_is_null

System Variable sql_auto_is_null
Scope Global, Session
Dynamic Yes
Type Boolean
Default Value OFF

If this variable is enabled, then after a statement that
successfully inserts an automatically generated
AUTO_INCREMENT value, you can find that
value by issuing a statement of the following form:

SELECT * FROM tbl_name WHERE auto_col IS NULL

If the statement returns a row, the value returned is the same
as if you invoked the
LAST_INSERT_ID() function. For
details, including the return value after a multiple-row
insert, see Section 12.16, “Information Functions”. If no
AUTO_INCREMENT value was successfully
inserted, the SELECT statement
returns no row.

The behavior of retrieving an
AUTO_INCREMENT value by using an
IS NULL comparison is used by
some ODBC programs, such as Access. See
Obtaining Auto-Increment Values.
This behavior can be disabled by setting
sql_auto_is_null to
OFF.

The default value of
sql_auto_is_null is
OFF.


数据运维技术 » MySQL Variables sql_auto_is_null 数据库 参数变量解释及正确配置使用