About the value range of my_bool in mysql api

Source: Internet
Author: User


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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.