On Wed, Apr 29, 2015 at 11:54 PM, Yasuo Ohgaki <yohg...@ohgaki.net> wrote:
> Hi Arvids, > > On Thu, Apr 30, 2015 at 3:40 PM, Arvids Godjuks <arvids.godj...@gmail.com> > wrote: > >> Stop trying to fix clever idiots from shooting themselves in the foot. The >>> standard result from these actions is to make life a pain for regular or >>> better programmers while only adding mild speed bumps to those clever >>> idiots. >>> >>> Things like a numeric type will only encourage the clever idiots to write >>> half broken code. >>> >> >> Hello, just want to chip in. >> >> I use "INT UNSIGNED" for the MySQL primary keys since ages, because >> negative primary keys make no sense. Well, mostly ID's for the records >> actually can stay strings, but I will have to remember to use a string type >> hint every time I pass a record ID. I expect a lot of times to forget that >> and write int... >> I was bitten a few times by the limits of 32 bit integer sizes too (moved >> to a 64 bit server that time), but there are also unsigned 64 bit integers >> that can and will be used in math operations and passed around. And we >> don't have the "unsigned int". >> > > Use of unsigned int8 for ID makes sense almost always if database supports > it. > I may do such mistake even if I know I should use "string" (or "numeric") > for record IDs once I > start using type hints. > > Okay, we have GMP. I will have to use it. But let me just ask - if I work >> with a DB handling 64 bit integers (all I know handle them) or use a >> DECIMAL field - automaticly use GMP then? Oh gosh.... >> > > I'm planning to introduce type affinity like SQLite. Then appropriate > types for the value may > be used automatically/semi-automatically. It's good for both security and > performance. > > Regards, > > -- > Yasuo Ohgaki > yohg...@ohgaki.net > > Great! A Class or RFC that defined types that mapped one to one to DB types sounds useful. But this is not the same thing as generic pseudo type that are little more that predefined regexs applied to strings (a.k.a the numeric type). Walter -- The greatest dangers to liberty lurk in insidious encroachment by men of zeal, well-meaning but without understanding. -- Justice Louis D. Brandeis