Re: DB_DataObject integer type

From: Date: Tue, 15 Nov 2005 03:41:12 +0000
Subject: Re: DB_DataObject integer type
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-21926@lists.php.net to get a copy of this message
On Sun, 2005-11-13 at 17:20 -0500, Jesse Vitrone wrote: > I'm using DB_DataObject to access the database in my app. In my > database, I have some fields in my table that are integers. When I get > my objects back, those fields return "string" when I call gettype. > Shouldn't these be integers? Not really, most database backends return string types for all entities, - Doing the type manipulation inside dataobjects, would probably add quite an overhead, that would not normally add much real value. - especially as PHP auto casts the types for you in most cases. Regards Alan > > The .ini file shows that these fields are int's in the table: > > length = 129 > width = 129 > height = 129 > > and I see in the generated class, it knows that they're ints: > > var $length; // int(11) not_null > var $width; // int(11) not_null > var $height; // int(11) not_null > > Why wouldn't the type of these be ints on my objects? I get back a type > of "string", which I need to be an int. Granted, I can convert them, > but I have a lot of cases like this, and it seems like it should be > casting these to the right type to begin with. Am I missing something? > > Thanks in advance, > Jesse

« previous php.pear.general (#21926) next »