|
From: <m.e...@ls...> - 2004-07-29 13:33:33
|
Thanks Christian! I didn't even think of looking at the length... I only have pqsql, but it looks as if for this one at least the length is always 0 except for strings, where it is equal to the length of the string (as you say it does not seem to implement what's in the comment). I tried implementing your suggestion myself in dbd_pgsql.c, and got as far as 512a513 > row->field_sizes[curfield] = -1; Unfortunately, now I get a length of -2 for NULLs??? Maybe someone familiar with the driver could have a look at this? It would be neat to be able to distinguish between NULL, "" and 0... Max On Thu, 2004-07-29 at 12:41, Christian Stamgren wrote: > Hello. > > I belive this is a short comming of the libdbi-drivers as it looks today. > > By reading dbi-dev.h you will find this row part of dbi_row_t struct.: > > unsigned long long *field_sizes; /* NULL field = 0, string field = len, > anything else = -1 */ > > But the drivers does not implemet it this way. > > > I'll suggest that we change it so that: > NULL field = -1, string field = len, anything else = 0 > > That way we will have distinction between NULL and a string of 0 chars (which > is not the same as NULL). > > It would then be easy to implement a couple of funtions like: > > dbi_result_field_isnull(result, "fieldname"); > or > dbi_result_field_isnull_idx(result, 2); > > > > Regards, > > //Christian > > > > On Wednesday 28 July 2004 15.45, m.e...@ls... wrote: > > Hi, > > > > I have been running some queries that return NULLs at times (in fields > > that contain doubles). > > > > It looks as if you use dbi_result_get_double() you get 0 whenever the > > query returned a NULL. > > > > How can I distinguish between a NULL and 0? It looks like I might have > > missed something obvious here... > > > > Thanks, > > > > Max > > > > > > ------------------------------------------------------- > > This SF.Net email is sponsored by BEA Weblogic Workshop > > FREE Java Enterprise J2EE developer tools! > > Get your free copy of BEA WebLogic Workshop 8.1 today. > > http://ads.osdn.com/?ad_id=4721&alloc_id=10040&op=click > > _______________________________________________ > > libdbi-users mailing list > > lib...@li... > > https://lists.sourceforge.net/lists/listinfo/libdbi-users > |