L
Lothar Behrens
Hi,
this is an unusual question here, but I think, it is C++ related due to
the fact that my code is written with it.
I have written an ODBC wrapper that - if checked out with my last working
tag - works fine.
I have identified the reason, why the update of a column fails with
updating the column with an empty string. I have corrected it and it runs.
But if I checkout the latest version of all files, I see the corrected code
but it does not work.
I can not explain the why. I don't cope with the code changes.
I tought I can correct the problem in one file and solve the problem.
It seems not.
The problem was an instance - containing a pointer to a memory structure,
that where bound to an ODBC column. The instance was inserted into a container
and this container clones the object instance - therefore the pointer of
the orginal object instance was copied to a new pointer.
The result was, the orginal instance has been destroied and the pointer in it
was reset to p[0] = 0.
Now my questions:
My code is actually corrected in both variants, why can it be, that the error
comes again ?
Can it be that other code areas would be involved ?
I have found a bug with the help of Electric Fence. Is it possible to
use a similar tool under Windows ?
You can find the complete code at http://sourceforge.net/projects/lbdmf/
It is too much to put it here.
Hint: The relevant code is at line 486 in file lbDB.cpp.
The file is located in Basedevelopment/lbDB
The following code is in a loop of amount of columns.
lbErrCodes err = ERR_NONE;
printf("Bind a column\n");
// Create the instance ...
lbBoundColumn* bc = new lbBoundColumn();
bc->setModuleManager(*&manager, __FILE__, __LINE__);
bc->prepareBoundColumn(q, i);
integerKey->setData(i);
UAP(lb_I_Unknown, uk, __FILE__, __LINE__)
UAP(lb_I_KeyBase, key, __FILE__, __LINE__)
bc->queryInterface("lb_I_Unknown", (void**) &uk, __FILE__, __LINE__);
integerKey->queryInterface("lb_I_KeyBase", (void**) &key, __FILE__, __LINE__);
printf("Insert the bound column\n");
// Clones the instance
boundColumns->insert(&uk, &key);
UAP(lb_I_BoundColumn, bc1, __FILE__, __LINE__)
printf("Get the bound column back\n");
bc1 = getBoundColumn(i);
// Avoid the '' by binding the column to the cloned instance.
// Retrieving the column returns a reference, not a clone.
bc1->bindColumn(q, i);
I hope that any can help me with that problem.
Thanks
Lothar
this is an unusual question here, but I think, it is C++ related due to
the fact that my code is written with it.
I have written an ODBC wrapper that - if checked out with my last working
tag - works fine.
I have identified the reason, why the update of a column fails with
updating the column with an empty string. I have corrected it and it runs.
But if I checkout the latest version of all files, I see the corrected code
but it does not work.
I can not explain the why. I don't cope with the code changes.
I tought I can correct the problem in one file and solve the problem.
It seems not.
The problem was an instance - containing a pointer to a memory structure,
that where bound to an ODBC column. The instance was inserted into a container
and this container clones the object instance - therefore the pointer of
the orginal object instance was copied to a new pointer.
The result was, the orginal instance has been destroied and the pointer in it
was reset to p[0] = 0.
Now my questions:
My code is actually corrected in both variants, why can it be, that the error
comes again ?
Can it be that other code areas would be involved ?
I have found a bug with the help of Electric Fence. Is it possible to
use a similar tool under Windows ?
You can find the complete code at http://sourceforge.net/projects/lbdmf/
It is too much to put it here.
Hint: The relevant code is at line 486 in file lbDB.cpp.
The file is located in Basedevelopment/lbDB
The following code is in a loop of amount of columns.
lbErrCodes err = ERR_NONE;
printf("Bind a column\n");
// Create the instance ...
lbBoundColumn* bc = new lbBoundColumn();
bc->setModuleManager(*&manager, __FILE__, __LINE__);
bc->prepareBoundColumn(q, i);
integerKey->setData(i);
UAP(lb_I_Unknown, uk, __FILE__, __LINE__)
UAP(lb_I_KeyBase, key, __FILE__, __LINE__)
bc->queryInterface("lb_I_Unknown", (void**) &uk, __FILE__, __LINE__);
integerKey->queryInterface("lb_I_KeyBase", (void**) &key, __FILE__, __LINE__);
printf("Insert the bound column\n");
// Clones the instance
boundColumns->insert(&uk, &key);
UAP(lb_I_BoundColumn, bc1, __FILE__, __LINE__)
printf("Get the bound column back\n");
bc1 = getBoundColumn(i);
// Avoid the '' by binding the column to the cloned instance.
// Retrieving the column returns a reference, not a clone.
bc1->bindColumn(q, i);
I hope that any can help me with that problem.
Thanks
Lothar