Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Zope: DB
[Zope] ZSQL Methods and transaction control
 

Index | Next | Previous | View Flat


robert at redcor

Jan 10, 2007, 4:00 AM


Views: 1421
Permalink
[Zope] ZSQL Methods and transaction control

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi there,

I am implementing a tool to handle userdata that is stored in a MySQL
db. The underlaying logic of the stored procedures used to maintain the
db content dictate that I have to control the transactions myself.

I understand that there is a way to handle transaction control in the
ZMySQL methods. However I find no documentation at all on how to use it.

Without using ZMySQL methods I would be using the following piece of code:
db = mysql.connect(host="localhost" ...)
cursor = db.cursor()
query = "CALL insertUser('%s', '$xxx$', @id, @error);select @id, \
@error" % 'JohnTheUser')
cursor.execute(query)
# get the next resultset, it has the result of the select
cursor.nextset()
result = cursor.fetchall()[0]
error = int(result[1])
if error:
print "error %s when trying to add user %s" % (ERRRORS[error],\
'JohnTheUser')
db.rollback()
continue #we are in a loop actually
..
db.commit()

How can I mimic that using ZSQL Methods

thanks for any pointers
Robert


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (GNU/Linux)
Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org

iD8DBQFFpNVkGaryJ0T9kUYRAhWfAJ9MTOqEu2PXnUQlVJRfof8hj5zXcgCeJoCt
Dij5NsSXbjc6FWYE5i9nMTE=
=6Qql
-----END PGP SIGNATURE-----
_______________________________________________
Zope-DB mailing list
Zope-DB[at]zope.org
http://mail.zope.org/mailman/listinfo/zope-db

Subject User Time
[Zope] ZSQL Methods and transaction control robert at redcor Jan 10, 2007, 4:00 AM
    Re: [Zope] ZSQL Methods and transaction control charlie at egenix Jan 10, 2007, 4:03 AM
        Re: [Zope] ZSQL Methods and transaction control robert at redcor Jan 10, 2007, 4:16 AM
            Re: [Zope] ZSQL Methods and transaction control charlie at egenix Jan 10, 2007, 4:30 AM
                Re: [Zope] ZSQL Methods and transaction control maciej.wisniowski at coig Jan 10, 2007, 5:10 AM
                Re: [Zope] ZSQL Methods and transaction control robert at redcor Jan 10, 2007, 8:00 AM
                    Re: [Zope] ZSQL Methods and transaction control charlie at egenix Jan 10, 2007, 11:09 AM

  Index | Next | Previous | View Flat
 
 


Interested in having your list archived? Contact lists@gossamer-threads.com
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.