About the value range of my_bool in mysql api my_bool is defined as A boolean type in the official char document in mysql, for values that are true (non-zero) or false (zero ). 0 indicates false, and non-0 indicates true. However, in its interface and implementation, it does not seem to be determined in the way described in the document (the value of my_bool is false ). For example, you can find an interface: 22.9.3.2. mysql_autocommit () www.2cto.com my_bool mysql_autocommit (MYSQL * mysql, my_bool mode) Description Sets autocommit mode on if mode is 1, off if mode is 0. (Note that only when the mode is 1 is required, not 0.) Return Values Zero if successful. nonzero if an error occurred. (if you want to use my_bool as a bool, why does the returned value use its return error code .) Errors www.2cto.com None. We encountered a similar problem in the project. It is clear that the variable of my_bool type is not 0 and it is not true. Khan, which is contrary to the document description. Therefore, it is safer to use it as a bool, and use true false directly when assigning values.