How migrate project from Delphi 7 to Delphi XE5?

Discussion of open issues, suggestions and bugs regarding usage of dbExpress drivers for InterBase & Firebird in Delphi and C++Builder
Post Reply
VadimMescheryakov
Posts: 11
Joined: Tue 30 Nov 2010 04:17

How migrate project from Delphi 7 to Delphi XE5?

Post by VadimMescheryakov » Sun 26 Oct 2014 06:52

Hello.
I bought new version DevArt dbExpress driver for InterBase and want migrate my project from Delphi 7 to Delphi XE5.

But I see error in my code (code from DevArt Readme)

..............
const
coPrepared = TSQLConnectionOption(302); // boolean
.................

What unit do I need used now?

Where I can read any manuals about migration from DBXprese 2 to DBXpress 4?

Thanks

Vadim Mescheryakov

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

Re: How migrate project from Delphi 7 to Delphi XE5?

Post by ViktorV » Mon 27 Oct 2014 09:24

You should assign parameter values to TSQLConnection in CodeGear RAD Studio XE5 at run time in this way:

Code: Select all

SQLConnection.Params.Values['Prepared'] := 'True';
You can find more details in Readme.html at: %DBXInterBase%\Readme.html
where %DBXInterBase% is the path to the installed dbExpress вriver for InterBase and Firebird.

VadimMescheryakov
Posts: 11
Joined: Tue 30 Nov 2010 04:17

Re: How migrate project from Delphi 7 to Delphi XE5?

Post by VadimMescheryakov » Tue 28 Oct 2014 19:13

ViktorV wrote:You should assign parameter values to TSQLConnection in CodeGear RAD Studio XE5 at run time in this way:
Thanks.

Next problem - Property TSQLQuery.TransactionLevel missing in Delphi XE5.
I use two transaction on some time (long ReadOnly for read all data and short Write for change data). How set transaction for execute query in DBExpress 4?

Thanks.
Vadim Mescheryakov

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

Re: How migrate project from Delphi 7 to Delphi XE5?

Post by ViktorV » Wed 29 Oct 2014 10:39

The similar question has already been discussed on our forum. Follow the link http://forums.devart.com/viewtopic.php? ... 068#p85190 for details.

VadimMescheryakov
Posts: 11
Joined: Tue 30 Nov 2010 04:17

Re: How migrate project from Delphi 7 to Delphi XE5?

Post by VadimMescheryakov » Wed 29 Oct 2014 11:18

ViktorV wrote:The similar question has already been discussed on our forum. Follow the link http://forums.devart.com/viewtopic.php? ... 068#p85190 for details.
I read this topic
tr.TransactionID := 1;
How execute SQLQuery in transaction 1 or 2? How say Open Statement in transaction №1?

What replace SQLQuery.TransactionLevel?
I not found this information in ex[amples and documentation.

Thanks
Vadim Mescheryakov

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

Re: How migrate project from Delphi 7 to Delphi XE5?

Post by ViktorV » Wed 29 Oct 2014 12:15

This functionality is not related to dbExpress driver for InterBase and Firebird functionality, but to DBExpress technologies.
To learn about transaction management, refer to the Embarcadero documentation.

VadimMescheryakov
Posts: 11
Joined: Tue 30 Nov 2010 04:17

Re: How migrate project from Delphi 7 to Delphi XE5?

Post by VadimMescheryakov » Wed 29 Oct 2014 16:56

I did not find about it

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

Re: How migrate project from Delphi 7 to Delphi XE5?

Post by ViktorV » Thu 30 Oct 2014 10:37

Transaction management in dbExpress 4 is performed with the meethods:
http://docwiki.embarcadero.com/Librarie ... ransaction
http://docwiki.embarcadero.com/Librarie ... ransaction
http://docwiki.embarcadero.com/Librarie ... FreeAndNil
http://docwiki.embarcadero.com/Librarie ... FreeAndNil

After transaction starts, all further operations with data (reading or writing) are performed inside the transaction until the transaction ends, or until another transaction starts.

For example:

Code: Select all

var
  Transaction1, Transaction2: TDBXTransaction;
begin
  Transaction1 := SQLConnection1.BeginTransaction(0); // start transaction with a "ReadCommitted" isolation level
  SQLQuery1.Open; // SQLQuery1 opens in the context of Transaction1
  Transaction2 := SQLConnection1.BeginTransaction(0); // start another transaction
  try
    SQLQuery2.ExecSQL; // execute some updates on data in the context of Transaction2
    SQLConnection1.CommitFreeAndNil(Transaction2); // commit changes, Transaction1 remains open
  except
    SQLConnection1.RollbackFreeAndNil(Transaction2); // rollback changes
  end;
end;

VadimMescheryakov
Posts: 11
Joined: Tue 30 Nov 2010 04:17

Re: How migrate project from Delphi 7 to Delphi XE5?

Post by VadimMescheryakov » Thu 30 Oct 2014 11:11

I read this.

My Problem: Property TSQLQuery.TransactionLevel removed from DBExpress 4.X.
Query execute in last started transaction.
I not find any property for setting transaction context for TSQLQuery.

In my application for Firebird I use first long readonly transaction,
and second write transaction for edit data.

After start second transaction I can't open next SQLQuery in readonly transaction.


Thanks
Vadim Mescheryakov

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

Re: How migrate project from Delphi 7 to Delphi XE5?

Post by ViktorV » Fri 31 Oct 2014 09:18

Unfortunately, this behavior is related to dbExpress technologies - and we can't influence it in any way. Obviously, due to such changes in the behavior of dbExpress 4, you will have to change the business logic of your application somehow.

Post Reply