| | | | Browse by category |
When checking the output of an RWDBBulkReader, some of the data which should be null in the receiving RWDBVector contains incorrect, non-null values.
Cause
This issue is most often caused by a program that does not check for null values in the receiving RWDBVector, RWDBDateVector or RWDBStringVector objects when processing the results of an RWDBBulkReader.
Action
To avoid this issue in your program, check each element of the RWDBVector, RWDBDateVector or RWDBStringVector objects mapped to a column in your database the allows NULL values. An example of this checking can be found in the following code sample.
#code
RWDBTable mlTable1 = mlResult1.table();
RWDBBulkReader mlBReader = mlTable1.bulkReader(mlConnection1);
RWDBVector<int> nNumber (1);
RWDBStringVector szText (1000, 1);
mlBReader << nNumber << szText;
int nRead = 0;
while (nRead = mlBReader())
{
cerr << "Read " << nRead << " record(s)" << endl;;
for (int i = 0; i < nRead ; i++)
{
cout << " nNumber[" << i << "] = " << nNumber[i]
<< " | szText[" << i << "] = " << (szText.isNull(i) ? "NULL" : szText[i])
<< " | Len " << szText.length() << endl << endl;
}
}