|
Boost : |
From: Brock Peabody (brock.peabody_at_[hidden])
Date: 2005-08-18 08:18:14
> -----Original Message-----
> From: boost-bounces_at_[hidden]
[mailto:boost-bounces_at_[hidden]]
> On Behalf Of Jonathan Wakely
> > How do you handle NULL values? the postgresql::row_set_imp::get()
> function
> > doesn't seem to account for NULL, which would crash strlen(), atof()
> etc.
>
> I see from the docs that PQgetvalue() never returns a NULL char*.
Does
> that mean some way of distinguishing empty strings from NULL fields is
> needed? i.e. a wrapper for PQgetisnull.
We could make abstract_row_set::get return an optional<field> instead of
a field. Then row::get_field could return an optional as well.
I'd suggest that row::get, however, continue its current behavior which
is to return a default constructed value in the presence of null fields.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk