Hi,
I have the following components TUniConnection,TUniTransaction,TUniQuery.
TUniConnection.DefaultTransaction->TUniTransaction
TUniQuery.Connection->TUniConnection
TUniConnection.Connected is set to false.
TUniConnection.AllowImplicitConnect is set to false.
When I Execute the TUniQuery, the UniConnection.Connected is set to true and a transaction is started.
How I can avoid the above? when executing a UniQuery and UniConnection is not active and/or no transaction active, I want to get a exception no a autoconnect or auto transaction start.
Any advice?
Thanks in advance,
Omar Zelaya
FireBird and AutoConnect and Auto Start Transaction.
Re: FireBird and AutoConnect and Auto Start Transaction.
Unfortunately, we couldn't reproduce the problem in the way you have described.
Here is a sample of a console application for С++ Builder XE4 to work with Firebird.
Please modify the sample so, that it reproduces the described error.
Here is a sample of a console application for С++ Builder XE4 to work with Firebird.
Please modify the sample so, that it reproduces the described error.
Code: Select all
#include <vcl.h>
#include <windows.h>
#pragma hdrstop
#pragma argsused
#include <tchar.h>
#include <stdio.h>
#include "DBAccess.hpp"
#include "MemDS.hpp"
#pragma link "ibprovider180.lib"
#pragma link "InterBaseUniProvider"
#include "Uni.hpp"
#include "UniProvider.hpp"
int _tmain(int argc, _TCHAR* argv[])
{
TUniTransaction *UniTransaction = new TUniTransaction(NULL);
TUniConnection *UniConnection = new TUniConnection(NULL);
try
{
UniConnection->ProviderName = "InterBase";
UniConnection->Server = "localhost";
UniConnection->Port = 3050;
UniConnection->Database = "d:\\vik\\empty.fdb";
UniConnection->Username = "sysdba";
UniConnection->Password = "masterkey";
UniConnection->DefaultTransaction = UniTransaction;
UniConnection->Options->AllowImplicitConnect = false;
UniConnection->Connected = false;
TUniQuery *UniQuery = new TUniQuery(NULL);
try
{
UniQuery->Connection = UniConnection;
UniQuery->SQL->Text = "SELECT * FROM DEPT";
UniQuery->Open();
}
__finally
{
UniQuery->Free();
}
}
__finally
{
UniConnection->Free();
UniTransaction->Free();
}
return 0;
}