Page 1 of 1

Change database without disconnecting

Posted: 23.03.2014, 08:03
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

Re: Change database without disconnecting

Posted: 30.03.2014, 09:19
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

Re: Change database without disconnecting

Posted: 13.04.2014, 22:29
by PetrHL
Hello Jan,

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

Petr