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 |

Date User Event
Wednesday, 26 Jan 2011, 9:40pm Dominic Jones (djones) Task opened
Wednesday, 26 Jan 2011, 9:40pm Dominic Jones (djones) User added to notification list: Dominic Jones (djones)
Saturday, 29 Jan 2011, 3:55pm Norbert Sendetzky (nose) Comment added
Monday, 31 Jan 2011, 6:54pm Dominic Jones (djones) Comment added
Tuesday, 1 Feb 2011, 11:35pm Norbert Sendetzky (nose) Comment added
Wednesday, 2 Feb 2011, 10:26pm Dominic Jones (djones) Comment added
Monday, 7 Feb 2011, 10:28am Norbert Sendetzky (nose) Comment added
Tuesday, 8 Feb 2011, 4:38pm Dominic Jones (djones) Comment added