Commit a44ed061 authored by Vincent Pelletier's avatar Vincent Pelletier

Add a connection string prefix to allow access to "compress" option of MySQL connector.

WARNING: this is an upstream-incompatible feature. If upstream allows access to compression in another way and you enable this feature, you will have to update your connection string yourself.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@16312 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent d05fe624
......@@ -49,7 +49,7 @@
The connection string used for Z MySQL Database Connection
is of the form:
<pre>
[*lock] [+/-][database][@host[:port]] [user [password [unix_socket]]]
[~] [*lock] [+/-][database][@host[:port]] [user [password [unix_socket]]]
</pre>
or typically:
<pre>
......@@ -76,7 +76,10 @@
supports TSTs, use '-'. If you require transactions, use '+'. If
you aren't sure, don't use either.
<p>
*<em>lock</em> at the begining of the connection string means to
A '~' at the begining of the connection string enables client-server
exchange compression (if supported by both client and server).
<p>
*<em>lock</em> means to
psuedo-transactional. When the transaction begins, it will acquire
a lock on the server named <em>lock</em> (i.e. MYLOCK). When the
transaction commits, the lock will be released. If the transaction
......
......@@ -200,6 +200,10 @@ class ThreadedDB:
items = split(connection)
self._use_TM = None
if not items: return kwargs
compress = items[0]
if compress == "~":
kwargs['compress'] = True
items = items[1:]
lockreq, items = items[0], items[1:]
if lockreq[0] == "*":
self._mysql_lock = lockreq[1:]
......
......@@ -49,7 +49,7 @@
The connection string used for Z MySQL Database Connection
is of the form:
<pre>
[*lock] [+/-][database][@host[:port]] [user [password [unix_socket]]]
[~] [*lock] [+/-][database][@host[:port]] [user [password [unix_socket]]]
</pre>
or typically:
<pre>
......@@ -76,7 +76,10 @@
supports TSTs, use '-'. If you require transactions, use '+'. If
you aren't sure, don't use either.
<p>
*<em>lock</em> at the begining of the connection string means to
A '~' at the begining of the connection string enables client-server
exchange compression (if supported by both client and server).
<p>
*<em>lock</em> means to
psuedo-transactional. When the transaction begins, it will acquire
a lock on the server named <em>lock</em> (i.e. MYLOCK). When the
transaction commits, the lock will be released. If the transaction
......
......@@ -198,6 +198,10 @@ class ThreadedDeferredDB:
items = split(connection)
self._use_TM = None
if not items: return kwargs
compress = items[0]
if compress == "~":
kwargs['compress'] = True
items = items[1:]
lockreq, items = items[0], items[1:]
if lockreq[0] == "*":
self._mysql_lock = lockreq[1:]
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment