RE: [PEAR-DEV] RFC: slight modification to the get*Value() methods
| From: | Lorenzo Alberton | Date: | Sun, 29 Dec 2002 23:41:56 +0000 |
| Subject: | RE: [PEAR-DEV] RFC: slight modification to the get*Value() methods | ||
| Groups: | php.pear.dev | ||
| Request: | Send a blank email to pear-dev+get-11935@lists.php.net to get a copy of this message | ||
> Currently working with NULL values is a bit clumsy imho.
> If you want a NULL value from getTimestampValue() for example you will
> have to set the value passed to the method to 'Null'. Its even worse
> for getTextValue where this is currently not even handled internally.
> You will have to determine if to use getTextValue() or not yourself.
> This is done because the string 'Null' passed to getTextValue() could
> very well mean that you want the string 'Null' inserted into your DB.
>
>
> Therefore I am proposing the following change:
> If you pass the PHP constant NULL to any of the get*Value() methods
> you will get the string 'NULL' returned.
>
>
> Then we don't need the old method used in all but getTextValue() of
> passing the string 'Null', so I would like to drop it.
Could you expand the part regarding getTextValue?
In particular, what are the differences between the
following statements:
----
$var = NULL;
$db->getTextValue($var);
----
$var = 'NULL';
$db->getTextValue($var);
----
To me it's quite obvious that the first one should return a NULL
constant, while the second one should return the 'NULL' string.
What the current behaviour is and what the proposed one is?
If I use get*Value(null) I'd like to have a NULL constant back, don't
care what the field datatype is. But if I use getTextValue('null') I'd
like to have the 'null' string back...
I don't think that having the string 'NULL' back on NULL fields would
be welcome... I mean, yes, maybe the MDB method is a bit faster, but
then it's up to the user to check if a 'NULL' string is returned, so
this only means more work for the user and zero gained time.
But I really think I didn't understand what you meant :-)
Regards,
Lorenzo
---
[Quipo ISP - Questa E-mail e' stata controllata dal programma Declude Virus]
[Quipo ISP - This E-mail was scanned for viruses by Declude Virus]