mySQL 4 Compress Option
Moderators: gto, cipto_kh, EgonHugeist
-
- Fresh Boarder
- Posts: 3
- Joined: 12.02.2006, 18:24
mySQL 4 Compress Option
Does anyone know if it's possible to turn on the mySQL 'Compress' option from within a Delphi (V6)/Zeoslib application? If I set it in the my.ini file then the mysql console will use compression when speaking to the server but it has no effect on my application.
thanks
john n
thanks
john n
-
- Fresh Boarder
- Posts: 3
- Joined: 12.02.2006, 18:24
The Unit ZDBCMySQL reads and sets the option "compress" on the "Open"-procedure:
The big question is, what is this "Info" and where is it set? Maybe it IS the properties-Property as Zippo said but who knows? So far I made the same experiance - didn't work at all if I set timeout or compress in properties.
Code: Select all
procedure TZMySQLConnection.Open;
...
{ Turn on compression protocol. }
if StrToBoolEx(Info.Values['compress']) then
FPlainDriver.SetOptions(FHandle, MYSQL_OPT_COMPRESS, nil);
{ Sets connection timeout. }
ConnectTimeout := StrToIntDef(Info.Values['timeout'], 0);
if ConnectTimeout >= 0 then
begin
FPlainDriver.SetOptions(FHandle, MYSQL_OPT_CONNECT_TIMEOUT,
PChar(@ConnectTimeout));
end;
{ Connect to MySQL database. }
if StrToBoolEx(Info.Values['dbless']) then
begin
...
Aahhh....
It really seems to be the Properties of the ZConnection. Try to set
and then, after being connected, execute this SQL-command:
It correspondents with the value set in the properties!
And the good info: We now know that the "Info"-list IS the properties and there are some other interesting properties like "dbless" to find in the open-procedure.
Greetings,
Anse
It really seems to be the Properties of the ZConnection. Try to set
Code: Select all
compress=1
Code: Select all
show status like "compr%"
And the good info: We now know that the "Info"-list IS the properties and there are some other interesting properties like "dbless" to find in the open-procedure.
Greetings,
Anse
- mdaems
- Zeos Project Manager
- Posts: 2766
- Joined: 20.09.2005, 15:28
- Location: Brussels, Belgium
- Contact:
Hi IGD,
I think these function do not change the connection behaviour in general. It just works for specific data you want to compress for whatever reason.
To theothers
When we are discussing the Info/Properties stuff : Some weeks ago I did modify the code shown by anse123 to include all clientflags currently provided by the mysql API. This modifications are in SVN testing branch. Please test them when you are working with this compression option.
BTW : according to mysql doc this compression only works when both server and client dll support it.
Just tested. Test project (initially made for the modifications mentioned above) is included. Hope it works for you. D7 and mysql5. You will have to change your connection parameters and can play with the properties property of the connection to see the result.
Mark
I think these function do not change the connection behaviour in general. It just works for specific data you want to compress for whatever reason.
To theothers
When we are discussing the Info/Properties stuff : Some weeks ago I did modify the code shown by anse123 to include all clientflags currently provided by the mysql API. This modifications are in SVN testing branch. Please test them when you are working with this compression option.
BTW : according to mysql doc this compression only works when both server and client dll support it.
Just tested. Test project (initially made for the modifications mentioned above) is included. Hope it works for you. D7 and mysql5. You will have to change your connection parameters and can play with the properties property of the connection to see the result.
Mark
You do not have the required permissions to view the files attached to this post.
- mdaems
- Zeos Project Manager
- Posts: 2766
- Joined: 20.09.2005, 15:28
- Location: Brussels, Belgium
- Contact:
Zippo,
Thanks for the compliment.
Yes I did, and you're not the first to ask. But, for the moment, I prefer to do the work on an volunteer base. What means : if I have time between spouse, kids, work, music playing, red cross activities,... I just look at the forum and see if there's something interesting to look at. If I'd become an official developer, there's (in my opinion) to much obligation to the part I would be assigned to. The more, I'm not a real Delphi developer. For work I'm a cobol/mainframe or Oracle developer. So I don't have any OO background. We'll see how everything goes on... (BTW, why's your status still 'just' senior boarder )
Mark
Thanks for the compliment.
Yes I did, and you're not the first to ask. But, for the moment, I prefer to do the work on an volunteer base. What means : if I have time between spouse, kids, work, music playing, red cross activities,... I just look at the forum and see if there's something interesting to look at. If I'd become an official developer, there's (in my opinion) to much obligation to the part I would be assigned to. The more, I'm not a real Delphi developer. For work I'm a cobol/mainframe or Oracle developer. So I don't have any OO background. We'll see how everything goes on... (BTW, why's your status still 'just' senior boarder )
Mark
For activate the cliente compression protocol (more faster and securely) only you must add to the properties the next line:
compress=true
Not compress=on!!
Example:
This property have effect in a new zeoslib connection (do not work with reconnect).
This property only work with some RDBMS like MySQL.
Before to test check that ZConnection.Connected is false.
compress=true
Not compress=on!!
Example:
Code: Select all
zeosConnection.Properties.Add('compress=true');
This property only work with some RDBMS like MySQL.
Before to test check that ZConnection.Connected is false.