有布尔类型Postgres里的PHP [英] To have boolean type in Postgres for PHP
本文介绍了有布尔类型Postgres里的PHP的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我无法相信下面的语句的似乎仍然如此
I can't believe that the following statement seems to be still true
So, I switched to integers and 0 or 1 works fine, but it is
stupid, that the database system has boolean variables of a smaller
size, but I should use integers for boolean values!
如何使用布尔数据类型在Postgres / PHP?
在换句话说,
是获得那种布尔数据类型来使用假1表示是; 0的唯一途径?
推荐答案
使用1和0是重新present布尔值一种非常明智的和可移植的方法。和之间的尺寸的任何差异int和原生布尔类型是真的要做出很少或没有区别应用程序的性能,或者你的数据库的大小(KB)。
Using 1 and 0 is a very sensible and portable way to represent boolean values. Any difference in size between and int and a native boolean type is really going to make little or no difference to your application's performance, or the KB size of your database.
这篇关于有布尔类型Postgres里的PHP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文