Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#27 client_flag option to enable MULTI_STATEMENTS

ZMySQLDA
closed
Andy Dustman
ZMySQLDA (17)
5
2014-08-17
2005-07-22
Greg
No

I am sure there is a better way to do this, but...

In db.py, _parse_connection_string function, it would
be nice to have the ability to use 'client_flag'. This
is so we can use MySQL 5.x with stored procedures in
Zope. In Python, simply specifying the connection
option for client_flag is fine, but the Zope DA doesnt
give us that ability. Here is the lines I have added
(I believe line 234):

---------------

if not items: return kwargs
kwargs['client_flag'], items = int(items[0]), items[1:]

---------------

This is just before the checking for 'unix_socket'
argument. (because, IMHO, you would want to specify
client_flag more often than unix_socket)

Maybe this is best implements as a checkbox option or
something else, but for me this at least works good.

One other thing to note, you must use a '-' (dash)
right before your connection string to disable
transaction. Not sure why, but it wouldnt work
properly using stored procedures without that.

My blog has more info:
http://www.1stbyte.com/site/blogs_dtml?#blog22

Basically I want client_flag to be specified on the
connection string like so:
-adatabase auser apassword 65536

This enables MULTI_STATEMENTS.

Thank you.

Greg

Discussion

  • Andy Dustman
    Andy Dustman
    2006-02-25

    Logged In: YES
    user_id=71372

    I decided it would be simpler to just enable
    MULTI_STATEMENTS when using a 5.0 or newer client library.