简体   繁体   English

如何在delphi中解压缩mysql字符串

[英]How to uncompress mysql string in delphi

I want to compress MySQL result or string inside MySQL query and the result will send to delphi application. 我想在MySQL查询中压缩MySQL结果或字符串,结果将发送到delphi应用程序。 I use this to speed up connectivity. 我用它来加快连接速度。 The problem is how to uncompress string from MySQL result inside delphi. 问题是如何在delphi中从MySQL结果中解压缩字符串。

Here is my sample query 这是我的示例查询

Select Compress(AColumn), Compress(BColumn) from ATable

Compress is for storage 压缩用于存储
The compress keyword in MySQL is not meant to reduce network traffic, but rather to reduce storage requirements. MySQL中的compress关键字并不是要减少网络流量,而是要减少存储需求。
The details of the compression are not documented and may vary from server to server. 压缩的详细信息没有记录,并且可能因服务器而异。

COMPRESS(string_to_compress)

Compresses a string and returns the result as a binary string. 压缩字符串并将结果作为二进制字符串返回。 This function requires MySQL to have been compiled with a compression library such as zlib. 此功能要求MySQL已使用诸如zlib之类的压缩库进行编译。 Otherwise, the return value is always NULL. 否则,返回值始终为NULL。 The compressed string can be uncompressed with UNCOMPRESS() . 可以使用UNCOMPRESS()将压缩后的字符串解压缩。

Note that the ability to uncompress depends on the compression library that your MySQL version was compiled with. 请注意,解压缩的能力取决于使用您的MySQL版本编译的压缩库。

Modify the connection string if you want network compression 如果要网络压缩,请修改连接字符串
If you want to compress the network data you specify this in the connection settings: Add the following string to the Properties property. 如果要压缩网络数据,请在连接设置中指定此内容:将以下字符串添加到Properties属性中。
UseCompression = true;

在此处输入图片说明

A list of all connection properties can be found here: 可以在此处找到所有连接属性的列表:
https://www.connectionstrings.com/mysql/ https://www.connectionstrings.com/mysql/

More info can be found here: http://dev.mysql.com/doc/refman/5.0/es/connector-net-examples-mysqlconnection.html#connector-net-examples-mysqlconnection-connectionstring 可以在这里找到更多信息: http : //dev.mysql.com/doc/refman/5.0/es/connector-net-examples-mysqlconnection.html#connector-net-examples-mysqlconnection-connectionstring
(note that this info is quite old, but I'm tweaking the url for the newer versions results in a 404 page not found error). (请注意,此信息已经很旧了,但是我对新版本的网址进行了调整,导致404页面未找到错误)。

Note that in Delphi the connectionstring is largly filed in by the properties: 请注意,在Delphi中, connectionstring字符串由属性较大地输入:
- Database -数据库
- Port - 港口
- Password -密码
etc 等等
In the Properties property you only supply those ConnectionString options that Delphi does not already cover in its other properties. 在“ Properties属性中,仅提供Delphi在其其他属性中尚未涵盖的那些ConnectionString选项。 Multiple arguments are separated by a ; 多个参数用;分隔; .

Further complications 进一步的并发症
Different component packs use different names for the extra data you can put into the ConnectionString. 对于可以放入ConnectionString中的额外数据,不同的组件包使用不同的名称。
ZEOS calls it properties ZEOS称之为properties
Other people call it other things. 其他人称之为其他事物。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM