Le 29/03/2013 21:57, Girvin R. Herr a écrit :

Hi Girvin,


> Why not use NULLs?  I use them all the time when a field is unknown. 
> The only places I do not allow NULLs are the primary and foreign keys
> and maybe some fields that are in calculated field formulas, such as:
> <price> * <quantity>. Hope this helps.

That is exactly the problem. Using NULL as an allowable value in
concatenated or function associated string manipulation will, depending
on the db engine, potentially lead to a NULL result being returned where
one of the values to be concatenated is NULL, see the example below for
mysql :



mysql> select * from devices;
+----+------+-------+----------------+--------------------------------------+------------+-----------+
| id | type | label | lastmountpoint | uuid
    | servername | sharename |
+----+------+-------+----------------+--------------------------------------+------------+-----------+
|  1 | uuid | NULL  | /home          |
97be65ae-c0b9-4f3d-9edc-2c65afe15311 | NULL       | NULL      |
|  2 | uuid | NULL  | /              |
0e98860b-bd1e-4e78-ab42-2d2adbb18eed | NULL       | NULL      |
+----+------+-------+----------------+--------------------------------------+------------+-----------+
2 rows in set (0.02 sec)

mysql> select concat(type,label,uuid) from devices;
+-------------------------+
| concat(type,label,uuid) |
+-------------------------+
| NULL                    |
| NULL                    |
+-------------------------+
2 rows in set (0.00 sec)

If Dan's aim is to concatenate the components of the name in a query,
then he'll be stuffed if any of those fields have NULL values.



Alex



-- 
For unsubscribe instructions e-mail to: users+h...@global.libreoffice.org
Problems? http://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: http://wiki.documentfoundation.org/Netiquette
List archive: http://listarchives.libreoffice.org/global/users/
All messages sent to this list will be publicly archived and cannot be deleted

Reply via email to