Re: Re: DB_DataObject integer type
| From: | Jesse Vitrone | Date: | Tue, 15 Nov 2005 03:59:52 +0000 |
| Subject: | Re: Re: DB_DataObject integer type | ||
| References: | 1 2 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-21927@lists.php.net to get a copy of this message | ||
Thanks for the reply. I most cases it does, but in the case I'm running into, the value of this variable is the index in array, and it was looking it up as an associative array, rather then just the index. No big deal, I can convert it myself, just didn't know if I didn't have my DB_DataObject set up right.
Keep up the good work DB_DataObject. It's a great project, does just what I'm looking for, without too much overhead or complexity.
Thanks,
Jesse
Alan Knowles wrote:
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 AlanThe .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_nullWhy 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