Subject | Solved. RE: [ib-support] API: Translate from c style to c++ style, isc_start_transaction, error: |
---|---|
Author | Henrik Sitter |
Post date | 2003-01-30T11:44:10Z |
I forgot to set my transaction handle to NULL before allocation...
-----Original Message-----
From: Henrik Sitter [mailto:henrik.sitter@...]
Sent: Thursday, January 30, 2003 11:51 AM
To: ib-support@yahoogroups.com
Subject: [ib-support] API: Translate from c style to c++ style,
isc_start_transaction, error: <expecting explicit transaction start>
Hello,
I have worked some with the firebird/interbase api, and right now I'm
trying to translate my code from "c style" to "c++ style". It should be
easy but...
My c style code works like I expect it to do:
1. isc_attach_database(status_vector, strlen(str), str, &db1,
dpb_length, dpb_buffer)
2. static char isc_tpb[] = {isc_tpb_version3,...,isc_tpb_protected)
3. isc_start_transaction(status_vector, &tr1, 1, &db1,
static_cast<unsigned short>(sizeof(isc_tpb)), isc_tpb)
Now db1 and tr1 contains valid database- and transaction handles.
My c++ style code doesn't return a valid transaction handle:
int main()
{
isc_db_handle* db1; // Database handle
isc_tr_handle tr1; // Transaction handle
// Singelton of the class CConnectToDatabase
CConnectToDatabase& DataBaseHandle = CConnectToDatabase::GetInstance();
// Return the address of the database handle (!!! THIS WORKS)
db1 = DataBaseHandle.ReturnDatabaseHandle();
// !!! HERE IS THE PROBLEM
CAllocateTransactionHandle TransactionHandle( db1 );
}
// Constructor of object TransactionHandle (of class
// CAllocateTransactionHandle)
CAllocateTransactionHandle::CAllocateTransactionHandle(isc_db_handle*
_db1)
: db1(_db1)
{
AllocateTransactionHandle();
}
CAllocateTransactionHandle::AllocateTransactionHandle()
{
isc_start_transaction( status_vector, &tr1, 1, (isc_db_handle *)db1,
static_cast<unsigned short>(sizeof(isc_tpb)), isc_tpb );
if ( (status_vector[0] == 1) && status_vector[1] )
isc_print_status(status_vector);
return 1;
}
isc_print_status returns <expecting explicit transaction start>, and no
valid transaction handle is returned.
I use firebird v.1.0.0, and I link with GDS32_ms.lib.
Well, I'm a bit stuck here. Anybody?
Thanks,
Henrik
To unsubscribe from this group, send an email to:
ib-support-unsubscribe@egroups.com
Your use of Yahoo! Groups is subject to
http://docs.yahoo.com/info/terms/
-----Original Message-----
From: Henrik Sitter [mailto:henrik.sitter@...]
Sent: Thursday, January 30, 2003 11:51 AM
To: ib-support@yahoogroups.com
Subject: [ib-support] API: Translate from c style to c++ style,
isc_start_transaction, error: <expecting explicit transaction start>
Hello,
I have worked some with the firebird/interbase api, and right now I'm
trying to translate my code from "c style" to "c++ style". It should be
easy but...
My c style code works like I expect it to do:
1. isc_attach_database(status_vector, strlen(str), str, &db1,
dpb_length, dpb_buffer)
2. static char isc_tpb[] = {isc_tpb_version3,...,isc_tpb_protected)
3. isc_start_transaction(status_vector, &tr1, 1, &db1,
static_cast<unsigned short>(sizeof(isc_tpb)), isc_tpb)
Now db1 and tr1 contains valid database- and transaction handles.
My c++ style code doesn't return a valid transaction handle:
int main()
{
isc_db_handle* db1; // Database handle
isc_tr_handle tr1; // Transaction handle
// Singelton of the class CConnectToDatabase
CConnectToDatabase& DataBaseHandle = CConnectToDatabase::GetInstance();
// Return the address of the database handle (!!! THIS WORKS)
db1 = DataBaseHandle.ReturnDatabaseHandle();
// !!! HERE IS THE PROBLEM
CAllocateTransactionHandle TransactionHandle( db1 );
}
// Constructor of object TransactionHandle (of class
// CAllocateTransactionHandle)
CAllocateTransactionHandle::CAllocateTransactionHandle(isc_db_handle*
_db1)
: db1(_db1)
{
AllocateTransactionHandle();
}
CAllocateTransactionHandle::AllocateTransactionHandle()
{
isc_start_transaction( status_vector, &tr1, 1, (isc_db_handle *)db1,
static_cast<unsigned short>(sizeof(isc_tpb)), isc_tpb );
if ( (status_vector[0] == 1) && status_vector[1] )
isc_print_status(status_vector);
return 1;
}
isc_print_status returns <expecting explicit transaction start>, and no
valid transaction handle is returned.
I use firebird v.1.0.0, and I link with GDS32_ms.lib.
Well, I'm a bit stuck here. Anybody?
Thanks,
Henrik
To unsubscribe from this group, send an email to:
ib-support-unsubscribe@egroups.com
Your use of Yahoo! Groups is subject to
http://docs.yahoo.com/info/terms/