My_bool is defined as char in MySQL.
The description in the official document is: A boolean type, for values that are true (non-zero) or false (zero). It means 0 is false, and non-0 is 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 ()
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 mode is 1 is performed, not 0)
Return values
Zero if successful. Nonzero if an error occurred. (Since you want to use my_bool as a bool, why does the returned value return an error code .)
Errors
None.
We encountered a similar problem in the project. It is clear that the variable of the my_bool type is not 0 and cannot be determined as 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.