Bugs item #1344338, was opened at 2005-11-01 01:28
Message generated for change (Comment added) made by phd
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=540672&aid=1344338&group_id=74338
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: MySQL
Group: SQLObject release (specify)
Status: Open
>Resolution: Fixed
Priority: 5
Submitted By: Andy Dustman (adustman)
>Assigned to: Oleg Broytmann (phd)
Summary: 0.7.0: autoCommit from URI wrong type
Initial Comment:
In dbconnection.py, when the URI is parsed, there is no
special treatment or type conversion of the autoCommit
parameter, so it is always stored as a string. In the
MySQL case (mysql.mysqlconnection), this causes the
call to conn.autocommit() to always, since that API
function requires an integer (booleans work too).
A workaround for this is to change
conn.autocommit(self.autoCommit) to
conn.autocommit(int(self.autoCommit)), though only
works if an integer is used as a parameter; it fails if
True or False is used.
Note that sybase support has this sequence in
SybaseConnection.__init__():
autoCommit = kw.get('autoCommit')
if autoCommit:
autoCommmit = int(autoCommit)
else:
autoCommit = None
kw['autoCommit'] = autoCommit
DBAPI.__init__(self, **kw)
A similar block of code would also work for MySQLdb.
----------------------------------------------------------------------
>Comment By: Oleg Broytmann (phd)
Date: 2006-01-12 19:28
Message:
Logged In: YES
user_id=4799
Fixed at the revision 1499. Please try and report if it
works for you.
----------------------------------------------------------------------
Comment By: Andy Dustman (adustman)
Date: 2006-01-03 16:38
Message:
Logged In: YES
user_id=71372
Either will work. The Python C API turns bool into int.
Actual boolean values would be more readable.
----------------------------------------------------------------------
Comment By: Oleg Broytmann (phd)
Date: 2006-01-03 15:32
Message:
Logged In: YES
user_id=4799
Documentation for MySQLdb says "Set the autocommit mode.
True values enable; False value disable." What are those
True and False - bools or ints? Should I write
conn.autocommit(int(self.autoCommit))
or
conn.autocommit(bool(self.autoCommit))
?
----------------------------------------------------------------------
Comment By: Mike Kent (mrmakent)
Date: 2005-12-09 20:11
Message:
Logged In: YES
user_id=1401261
I just ran into this same problem using SQLObject with
TurboGears. Passing autoCommit as an empty string:
mysql://server:port/db?autoCommit=&debug=
as the previous commenter suggested did NOT work; I got the
same TypeError exception.
----------------------------------------------------------------------
Comment By: Andy Dustman (adustman)
Date: 2005-11-03 00:05
Message:
Logged In: YES
user_id=71372
That doesn't work; I tried it previously. It results in
SQLObject trying to do conn.autocommit(''), which still
results in a TypeError. Even though '' == False, it is not
an integer, and thismethod requires an integer (or boolean).
----------------------------------------------------------------------
Comment By: Oleg Broytmann (phd)
Date: 2005-11-02 23:42
Message:
Logged In: YES
user_id=4799
Pass autoCommit as an empty string:
mysql://server:port/db?autoCommit=&debug=
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=540672&aid=1344338&group_id=74338
|