fact: "Sorry, bastards first."
BastardDomain Forums \ Development \ databaseveld
databaseveld
Gorgeous George
Opmerk Bastard

Registered: 13 Jul 2001
Location: BehindMy21
Posts: 4748
4 Aug 2004

welk databaseveld kun je het beste gebruiken om een 1 of een 0 op te slaan in mysql?
int (1) ?
Fox
The Guzzler

avatar Fox

Registered: 10 Apr 2001
Location: North-Brabant
Posts: 9401
4 Aug 2004

ik doe tegenwoordig tinyint

die is volgens mij 1 byte.
misschien dat ze in een latere versie eindelijk de boolean geintroduceert hebben.
Ik verwacht echter dat ze een goede reden hebben om dat niet te doen, anders hadden ze het al wel eerder gedaan.

vroeger maakte ik een enum('true', 'false'), mijn eigen boolean zeg maar, maar als je die eruit haalt, worden ze toch niet als boolean behandeld (maar als tekst), dus daar heb je niet zo veel aan.
Refuse to do what you don't want to do.
"http("http://www.bastarddomain.com/dev/ico/quote.php") . "\" target=\"_blank\">"http($this->addslashes("http://www.bastarddomain.com/dev/ico/signature.php?show")) . "\" border=\"0\" alt=\"[user image]\" />""
Gorgeous George
Opmerk Bastard

Registered: 13 Jul 2001
Location: BehindMy21
Posts: 4748
4 Aug 2004

kan ik "http("http://dev.mysql.com/doc/mysql/en/Numeric_types.html") . "\" target=\"_blank\">hier" uit afleiden dat het van -128 -127 kan?
er is dus niks wat alleen 0 of 1 kan zijn?

standaard maakt ie em tinyint(4) wat houd die 4 dan in?
Rainman
BMW Bastard

avatar Rainman

Registered: 11 Apr 2001
Location: Everywhere
Posts: 5391
5 Aug 2004

Dat staat gewoon in de link die je post

    Quote

    This optional display width specification is used to left-pad the display of values having a width less than the width specified for the column.

    The display width does not constrain the range of values that can be stored in the column, nor the number of digits that will be displayed for values having a width exceeding that specified for the column.

    When used in conjunction with the optional extension attribute ZEROFILL, the default padding of spaces is replaced with zeros. For example, for a column declared as INT(5) ZEROFILL, a value of 4 is retrieved as 00004. Note that if you store larger values than the display width in an integer column, you may experience problems when MySQL generates temporary tables for some complicated joins, because in these cases MySQL trusts that the data did fit into the original column width.


The only reason that you're conscious right now is because I don't want to carry you. - Jack Bauer
"http($this->addslashes("http://87.233.202.7/stuff/bauer/sig.php")) . "\" border=\"0\" alt=\"[user image]\" />"
 1 
© 2000 - 2024 BastardDomain.com