Home >Database >Mysql Tutorial >MySQL Treat Tiny As Boolean简析_MySQL

MySQL Treat Tiny As Boolean简析_MySQL

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-01 13:41:041672browse

bitsCN.com
MySQL Treat Tiny As Boolean简析 使用MySqlClient访问tinyint unsign 字段返回布尔值 true 和 false,但是实际上该字段存储值为1-255分析:由于在Mysql中没有布尔类型值,MySqlClient在访问tinyint类型字段时默认作为布尔值使用。   解决:1.在连接串中增加 Treat Tiny As Boolean=false 配置.2.对应字段在SQL语句中*1,这样,读取出的字段值默认会被转换成int类型.  作者 bengda bitsCN.com

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn