How to retrieve an int value rather than a boolean from a TINYINT(1) column?

前端 未结 3 1248
难免孤独
难免孤独 2020-12-17 02:06

I have a MySQL column specified as:

`type` TINYINT(1) NOT NULL DEFAULT \'0\'

The intent of the column is to store an integer value not to e

3条回答
  •  不思量自难忘°
    2020-12-17 02:45

    The answer for the Connector's confusion may be this part from MySQL docs; Numeric Types:

    As of MySQL 5.0.3, a BIT data type is available for storing bit-field values. (Before 5.0.3, MySQL interprets BIT as TINYINT(1).) ...

    or (even more probable) this part from Numeric Type Overview:

    BOOL, BOOLEAN

    These types are synonyms for TINYINT(1). A value of zero is considered false. Nonzero values are considered true ...

提交回复
热议问题