Hello,

I have been using connection for a while with this statement:

import sqlobject as so
so.sqlhub.processConnection = so.connectionForURI(uri) # sqlite

When I have to use raw SQL I use this function:

def db_query(*args):
   c = so.sqlhub.processConnection.getConnection()
   try:
       cr = c.cursor()
       cr.execute(*arg)
       res = cr.fetchall()
   finally:
       so.sqlhub.processConnection.releaseConnection(c)
   return res

Now I have to speed up bulk inserts/updates and I managed to use transactions:

so.sqlhub.processConnection = so.connectionForURI(uri).transaction()

The problem is that I can not use the same function. I suppose that I
have to try/catch to explicitly commit/rollback. I would like to have
my db_query function work in both cases (with or without transaction).
So what is the best practice to be able to execute SQL statements
wheter you use "pure connection" or transaction? My problem is that
one can pass two completly different objects to
so.sqlhub.processConnection... is it the right way to do these things
in most recent version of sqlobject?

config: sqlobject-0.7.1dev_r1788-py2.4.egg, pysqlite2.2.2

--
jt
Ym�杽��j������Ljv�y���ا�h��������Z��b�An�\����y�^r�r&��8^�(!z�g�fޮ��y�ڵǫ�'�q�b�{"��^��-�x"�۬���jv��ƥJ�i��B�'$��^j�梷����ǥjˬ}�dj
        ޷��ɝ

Reply via email to