Member Functions | |
operator RWBoolean() |
#include <rw/db/nullind.h> RWDBNullIndicator nullInd;
RWDBNullIndicator allows application code:
to determine whether a particular piece of data extracted from an RWDBReader is NULL
to specify whether a bound value is NULL when using an RWDBBoundExpr
An RWDBNullIndicator instance may be interpreted as a boolean value: TRUE means a data item is NULL; FALSE means a data item is not NULL.
RWDBNullIndicator is designed specifically to detect NULL values as they are extracted from an RWDBReader. See RWDBReader for more details.
This code fragment selects an integer and a string from a table, and checks for NULL before processing the results:
RWDBTable myTable = myDBase.table("myTable"); RWDBSelector select = myDBase.selector(); select << myTable["id"] << myTable["name"]; RWDBReader rdr = select.reader(); int id; RWCString name; RWDBNullIndicator idIsNull; RWDBNullIndicator nameIsNull; while (rdr()) { rdr >> idIsNull >> id >> nameIsNull >> name; if (idIsNull || nameIsNull) { // handle NULL case } else { // process name and id normally } }
RWDBNullIndicator(RWBoolean value = 0);
Constructs an RWDBNullIndicator with the given initial value.
operator RWBoolean();
Returns the current boolean value of self.
©Copyright 1999, Rogue Wave Software, Inc.
Contact Rogue Wave about documentation or support issues.