SQLObject connection/transaction blowing up

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • jacob.miles@gmail.com

    #1

    SQLObject connection/transaction blowing up

    I'm trying to connect to a mysql database, with autoCommit and caching
    off, and I'm trying to create a transaction. Why does this blow up?
    [color=blue][color=green][color=darkred]
    >>> from sqlobject import *
    >>> connectionStrin g = 'mysql://admin@localhost/mc_image_librar y_dev?cache=&au toCommit='
    >>> connection = connectionForUR I (connectionStri ng)
    >>> sqlhub.processC onnection = connection
    >>> oldConn = sqlhub.getConne ction()
    >>> trans = oldConn.transac tion()[/color][/color][/color]
    Traceback (most recent call last):
    File "<stdin>", line 1, in ?
    File
    "/usr/local/lib/python2.4/site-packages/SQLObject-0.7.0-py2.4.egg/sqlobject/dbconnection.py ",
    line 354, in transaction
    return Transaction(sel f)
    File
    "/usr/local/lib/python2.4/site-packages/SQLObject-0.7.0-py2.4.egg/sqlobject/dbconnection.py ",
    line 722, in __init__
    self._connectio n = dbConnection.ge tConnection()
    File
    "/usr/local/lib/python2.4/site-packages/SQLObject-0.7.0-py2.4.egg/sqlobject/dbconnection.py ",
    line 226, in getConnection
    conn = self.makeConnec tion()
    File
    "/usr/local/lib/python2.4/site-packages/SQLObject-0.7.0-py2.4.egg/sqlobject/mysql/mysqlconnection .py",
    line 49, in makeConnection
    conn.autocommit (self.autoCommi t)
    TypeError: an integer is required

  • paul kölle

    #2
    Re: SQLObject connection/transaction blowing up

    jacob.miles@gma il.com wrote:[color=blue]
    > I'm trying to connect to a mysql database, with autoCommit and caching
    > off, and I'm trying to create a transaction. Why does this blow up?[/color]
    As the traceback is telling you, your connectionStrin g is missing the
    actual values. Not sure about the cache parameter but:
    connectionStrin g =
    'mysql://admin@localhost/mc_image_librar y_dev?autoCommi t=1' should work.

    cheers
    Paul[color=blue]
    >[color=green][color=darkred]
    >>>> from sqlobject import *
    >>>> connectionStrin g = 'mysql://admin@localhost/mc_image_librar y_dev?cache=&au toCommit='[/color][/color][/color]
    [snipp][color=blue]
    > conn.autocommit (self.autoCommi t)
    > TypeError: an integer is required
    >[/color]

    Comment

    • jacob.miles@gmail.com

      #3
      Re: SQLObject connection/transaction blowing up

      No - I want autoCommit to be false. It defaults to true. SQLObject's
      documentation says to leave the value blank for false, and to specify
      any non-blank value for true.

      Is the SQLObject documentation wrong? Should I specify autoCommit=0?

      Comment

      Working...