dbstreams Provider Reference: Reference Manual for a dbstreams Provider class | ||
---|---|---|
Prev | Chapter 2. provider Methods |
public const } virtual bool extract(int icol, std::string& datum, size_t& len);
|
public virtual const bool extract(int icol, int& datum, size_t& len);
|
public virtual const bool extract(int icol, double& datum, size_t& len);
|
public virtual const bool extract(int icol, const char*& datum, size_t& len);
|
public virtual const bool extract(int icol, const void*& datum, size_t& len);
|
public virtual const const cell& extract(int icol);
|
public const const cell& extract(const std::string& colname);
|
The extract
methods modify their second argument. The datatype is provided by the function's signature, and data conversion is done using functions provided by the native library.
The len
argument and the return code are related. For normal fetches, len
will hold the length of the variable-length string or, for fixed-length datatypes (e.g. int), the value returned by the sizeof() operator. The return code of extract
indicates whether or not the value is NULL; a TRUE value indicates data are present, i.e. not NULL.
As of this writing, dbstream
discards the return code of extract
because the only way for an application to discover a column is NULL is through the cell interface (invoked via operator[])
Experience suggests that applications seldom request NULL data and anyway can't represent it using built-in types. Only general-purpose tools, such as interactive SQL tools, need to distinguish between zero data and NULL data. Such tools will likely use the cell interface anyway.