2009年2月25日星期三

Re: [fw-db] Fetched values all converted to strings

I have to agree here, although there are a few issues in the issue tracker
for such features:

http://framework.zend.com/issues/browse/ZF-300
http://framework.zend.com/issues/browse/ZF-1457
http://framework.zend.com/issues/browse/ZF-220

Some are postgres specific, but the first is general. There definitely is a
cost associated to this type of magical casting, and this feature seems as
though its something that should be handled outside the core Zend_Db
infrastructure.

Jaka, your point is spot-on. Just as php-apache gets information from the
HTTP environment, php gets data from the database in the same typeless
manner... This is after all one of PHP's strengths ;)

-ralph


On 2/24/09 6:03 PM, "Jaka Jančar" <jaka@kubje.org> wrote:

> First of all, it would be slow(er).
>
> Secondly, how would you convert integers outside of PHP-supported
> bounds?
>
> And would you also covert timestamps to DateTime (or even Zend_Date)?
> Etc...
>
> Also, I don't know if table metadata is always available, for example
> when not using Zend_Db_Table. And what would you do when user just
> does $db->query("SELECT 1") or some other query which doesn't map
> directly to table columns?
>
> But most importantly, _WHY_ would you? :)
>
> PHP is a loosely typed language and stuff like this is done
> automagically for you. Think about all the times you get integers from
> HTTP requests and never worry about them being strings.
>
> Sent from my iPhone
>
> On Feb 25, 2009, at 0:40, Vince42 <zf@vineal.de> wrote:
>
>> Hi,
>>
>> Jaka Jančar schrieb:
>>> I can't imagine how this could happen. Can you provide an example
>>> table and selects?
>>
>> This is really odd ... i just removed all the type casts - and now it
>> works. Three seems no problem with the quoting anymore - great. :)
>>
>> But the point remains: the fetched values should be converted as the
>> meta data of the database table specifies the data type and it
>> shouldn't
>> be a big deal to implement such a functionality - or would it?
>>
>> --
>> Cheers, \\|//
>> Vince (o o)
>> ----------------------------ooO-(_)-Ooo-------------------------
>> ''' (o)_(o) [ ][0][ ]
>> ô¿ô (=°o°=) World Domination by Copy and Paste [ ][ ][0]
>> - (")_(") [0][0][0]
>>
>> () ascii ribbon campaign - against html e-mail
>> /\ www.asciiribbon.org - against proprietary attachments
>> Ooo.
>> ---------------------------.ooO----( )-------------------------
>> ( ) (_/
>> \_)
>>
>>
>

--
Ralph Schindler
Software Engineer | ralph.schindler@zend.com
Zend Framework | http://framework.zend.com/

没有评论: