Problem with localfilover and TmyQuery.Execute.

Discussion of open issues, suggestions and bugs regarding MyDAC (Data Access Components for MySQL) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
eduardosic
Posts: 387
Joined: Fri 18 Nov 2005 00:26
Location: Brazil

Problem with localfilover and TmyQuery.Execute.

Post by eduardosic » Wed 25 Apr 2007 23:30

Hi, i found a small problem.

the TmyQuery.Execute don't reconect on server with localfailover = true and OnLostConnection > RetryMode := TRetryMode( 2 )

with the TMyQuery.Open, all rigth.

the sample demonstrate it.

http://www.drdsistemas.com/util/failover.zip

Antaeus
Posts: 2098
Joined: Tue 14 Feb 2006 10:14

Post by Antaeus » Thu 26 Apr 2007 09:59

I do not have enough privileges to download this archive. Please send it to me at evgeniyd * crlab * com.
Exclude exe file(s) from the archive if it is included.

eduardosic
Posts: 387
Joined: Fri 18 Nov 2005 00:26
Location: Brazil

ok

Post by eduardosic » Thu 26 Apr 2007 12:11

Antaeus wrote:I do not have enough privileges to download this archive. Please send it to me at evgeniyd * crlab * com.
Exclude exe file(s) from the archive if it is included.
I finished to send.

Thank's.

eduardosic
Posts: 387
Joined: Fri 18 Nov 2005 00:26
Location: Brazil

Re: ok

Post by eduardosic » Fri 27 Apr 2007 13:01

eduardosic wrote:
Antaeus wrote:I do not have enough privileges to download this archive. Please send it to me at evgeniyd * crlab * com.
Exclude exe file(s) from the archive if it is included.
I finished to send.

Thank's.
Antaeus you it received the email with the example?

Jackson
Posts: 512
Joined: Thu 26 Jan 2006 10:06

Post by Jackson » Fri 27 Apr 2007 14:09

Currently MyDAC doesn't support reexecuting queries after the connection is lost.
We will add this functionality in the next build of MyDAC 5.

eduardosic
Posts: 387
Joined: Fri 18 Nov 2005 00:26
Location: Brazil

humm

Post by eduardosic » Fri 27 Apr 2007 17:43

Jackson wrote:Currently MyDAC doesn't support reexecuting queries after the connection is lost.
We will add this functionality in the next build of MyDAC 5.
Using TMyQuery.Open; the reconnection and reexecution are OK.

Using TMyQuery.Execute; the exception lost connection is raised.

TMyConnection works with
- DisconnectModel
- Pool of conections
- LocalFailOver
and OnLostConnection = ReconnectAndExecute.

thank's

eduardosic
Posts: 387
Joined: Fri 18 Nov 2005 00:26
Location: Brazil

LocalFailOver and Update/Insert without a transaction

Post by eduardosic » Tue 27 Jul 2010 20:43

Hi DevArt.

LocailFailOver don't work with a Update or Insert Statment. with Select works fine.. please, fix it. localfailover is a big feature.

Dimon
Devart Team
Posts: 2910
Joined: Mon 05 Mar 2007 16:32

Post by Dimon » Mon 02 Aug 2010 15:21

To solve the problem you should process the OnConnectionLost event of TMyConnection and set the RetryMode value to rmReconnectExecute, like this:

Code: Select all

procedure TForm1.MyConnectionConnectionLost(Sender: TObject;
  Component: TComponent; ConnLostCause: TConnLostCause; var RetryMode: TRetryMode);
begin
  if ConnLostCause = clExecute then
    RetryMode := rmReconnectExecute;
end;

eduardosic
Posts: 387
Joined: Fri 18 Nov 2005 00:26
Location: Brazil

Post by eduardosic » Tue 17 Aug 2010 16:40

Dimon wrote:To solve the problem you should process the OnConnectionLost event of TMyConnection and set the RetryMode value to rmReconnectExecute, like this:

Code: Select all

procedure TForm1.MyConnectionConnectionLost(Sender: TObject;
  Component: TComponent; ConnLostCause: TConnLostCause; var RetryMode: TRetryMode);
begin
  if ConnLostCause = clExecute then
    RetryMode := rmReconnectExecute;
end;
i use

procedure TForm1.MyConnectionConnectionLost(Sender: TObject;
Component: TComponent; ConnLostCause: TConnLostCause; var RetryMode: TRetryMode);
begin
RetryMode := rmReconnectExecute;
end;

But a found the problem. if a have a opened query (select * from) with a property FetchAll = False and try do execute a update and the connection is lost.. a exception is raised and the OnConnectionsLost event is'nt called.

uuf, 1hour to find the problem.

Dimon
Devart Team
Posts: 2910
Joined: Mon 05 Mar 2007 16:32

Post by Dimon » Wed 18 Aug 2010 09:45

MyDAC help says:
If a connection breaks, a fatal error occurs, and the OnConnectionLost event will be raised if the following conditions are fulfilled:
  • There are no active transactions;
  • There are no opened and not fetched datasets;
  • There are no explicitly prepared datasets or SQLs.

eduardosic
Posts: 387
Joined: Fri 18 Nov 2005 00:26
Location: Brazil

Post by eduardosic » Wed 18 Aug 2010 13:13

Dimon wrote:MyDAC help says:
If a connection breaks, a fatal error occurs, and the OnConnectionLost event will be raised if the following conditions are fulfilled:
  • There are no active transactions;
  • There are no opened and not fetched datasets;
  • There are no explicitly prepared datasets or SQLs.
FailOver under a Active Transaction is a Best Feature for MyDAC 6. :roll:

about fetchAll, i remove all fetchall = false in my app

Dimon
Devart Team
Posts: 2910
Joined: Mon 05 Mar 2007 16:32

Post by Dimon » Wed 18 Aug 2010 13:24

Thank you for your inquiry. We will investigate the possibility of adding this functionality in the future.

Post Reply