Change database without disconnecting

The official tester's forum for ZeosLib 7.1. Ask for help, post proposals or solutions.
Post Reply
PetrHL
Fresh Boarder
Fresh Boarder
Posts: 6
Joined: 21.09.2012, 12:28

Change database without disconnecting

Post by PetrHL »

Hi,

I use Lazarus and FreePascal under Ubuntu 12.04. Because of missing features (transaction support for MySQL) I decided to move to ZeosLib. So far so good but I've found something I don't know what to do.

When I used internal FPC and Lazarus components, I could do something like this:

Code: Select all

q.SQL.Text := 'use database1';
q.ExecSQL;

q.SQL.Text := 'select aaa from something';
q.Open;

q.SQL.Text := 'use database2';
q.ExecSQL;

q.SQL.Text := 'select aaa from something1';
q.Open;
I tried the same with Zeos TZQuery but it didn't work. Is there any way how to switch to another database without disconnect and connect again, please?

Thank you!

Petr
marsupilami
Platinum Boarder
Platinum Boarder
Posts: 1962
Joined: 17.01.2011, 14:17

Re: Change database without disconnecting

Post by marsupilami »

Hello Petr,

I am not an expert on MySQL but I think there is no way to change the database while connected. What happens if you try to execute the 'use database2'?
Best regards,

Jan
PetrHL
Fresh Boarder
Fresh Boarder
Posts: 6
Joined: 21.09.2012, 12:28

Re: Change database without disconnecting

Post by PetrHL »

Hello Jan,

nothing happens. It looks like the query went fine but no effect to any other queries.

Petr
Post Reply