Page 1 of 1

FirebirdDatabaselayer 1.8 problems

Posted: Sun Jul 18, 2010 1:13 pm
by bone
In FirebirdDatabaselayer 1.8 there are some conversions to and from void pointers in the code that are not cast at all. Surprisingly it works in 32bit but 64bit is not compilable.

void* m_pDatabase = isc_db_handle var
isc_db_handle var = void* m_pDatabase
void* m_pTransaction = isc_tr_handle var
isc_tr_handle var = void* m_pTransaction

For some reason these and ISC_STATUS_ARRAY m_pStatus have been changed to void pointers.

Also wxDELETE (ie delete) is used with an array instead of delete[] or wxDELETEA

Another is DatabaseLayer.cpp 158,242,326,410,494,578,662,732,785,838,892
if (field->IsType(_("string")))
comparing a string flagged for translation with a wxVariant constant string.

There are a few other perhaps inappropriate instances of _() in the code.

I guess this is not a bug forum but it might save a few people some time. I like Databaselayer's functionality and it would be a real competitor for IBPP if services like backup, restore and sweep were present.
Cheers, John

Posted: Tue Jul 20, 2010 1:22 am
by bone
Also when an application exits in debug build there are many of these messages:
"ResultSet NOT closed and cleaned up by the DatabaseLayer dtor"
VC++8 MSW Vista 32 & 64
I haven't had time to look at why but something has changed since the last version.

Posted: Tue Jul 20, 2010 1:44 pm
by bone
Ah, I see the log message in DatabaseLayer::CloseResultSets(). It is misleading because it is actually cleaning up. However, it shouldn't be cleaning up if project code is right.

Because FirebirdResultSet::Close() is public it can be called from project code either directly or through delete FirebirdResultSet.

This will close the result set but does not remove it from the DatabaseLayer hashmap of resultsets. So if FirebirdResultSet::Close() has been used then the item is still in the DatabaseLayer result set hashmap and will be deleted in the DatabaseLayer destructor hence the log message.

If delete FirebirdResultSet has been used then DatabaseLayer::CloseResultSets() will crash trying to close a result set that has already been closed and deleted.

So DatabaseLayer::CloseResultSet(FirebirdResultSet*) should be used when finished with the FirebirdResultSet. This will remove it from DatabaseLayer's map of resultsets.

I suppose FirebirdResultSet::Close() might be useful where reusing the FirebirdResultSet variable but it might be better if private. Stopping use of delete FirebirdResultSet would be a little more difficult.