OpenDBX

for Project:

Open Database abstraction layer

Register as a new user

Task #36 — fieldValue function only returns null after first null result

Attached to Project — OpenDBX
Opened by Dominic Jones (djones) - Wednesday, 26 Jan 2011, 9:40pm
Bug Report Medium
Library Normal
Unconfirmed 1.4.x
No-one Undecided
Windows 0% complete
If a field from a table being read via OpenDBX has the value null, it appears that any further reads from the column involved will also return null, even if the correct value for that row is different.

This problem occurred in the following code from a utility for moving data row-by-row from a query on one database to a table in another.

while ((transfer_status = data.getResult()) != ODBX_RES_DONE)
{
while (data.getRow() != ODBX_ROW_DONE)
{
std::string insert_str("INSERT INTO ");
insert_str.append(argv[optind+11]);
insert_str.append(" VALUES (");
for (int counter=0;counter < data.columnCount();++counter)
{
if (counter > 0) insert_str.append(",");
const char * value = data.fieldValue(counter);
if (value != NULL)
{
insert_str.append("'");
string valueStr(value);
string escapedValue;
target.escape(value,escapedValue);
insert_str.append(escapedValue);
insert_str.append("'");
}
else
{
insert_str.append("NULL");
}
}
insert_str.append(");");
Stmt s5 = target.create(insert_str);

(...)

Comments (6) | Attachments (0) | Related Tasks (0/0) | Notifications (1) | Reminders (0) | History |

These users will receive detailed notifications whenever this task changes.