FireBird and AutoConnect and Auto Start Transaction.

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
ozelaya
Posts: 11
Joined: Wed 01 Jul 2009 17:45

FireBird and AutoConnect and Auto Start Transaction.

Post by ozelaya » Fri 29 May 2015 00:30

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

ViktorV
Devart Team
Posts: 3168
Joined: Wed 30 Jul 2014 07:16

Re: FireBird and AutoConnect and Auto Start Transaction.

Post by ViktorV » Fri 29 May 2015 13:44

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.

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;
}

Post Reply