Hi,
I am trying to use the limit(num) method.
http://www.sqlobject.org/SelectResults.html

For the SQLite everything works as expected.

For the Firebird database I am getting following error:

Traceback (most recent call last):
  File "testSqlObject.py", line 55, in <module>
    for r in os:
  File
"/usr/lib/python2.5/site-packages/SQLObject-0.10.1-py2.5.egg/sqlobject/sresults.py",
line 179, in __iter__
    return iter(list(self.lazyIter()))
  File
"/usr/lib/python2.5/site-packages/SQLObject-0.10.1-py2.5.egg/sqlobject/sresults.py",
line 187, in lazyIter
    return conn.iterSelect(self)
  File
"/usr/lib/python2.5/site-packages/SQLObject-0.10.1-py2.5.egg/sqlobject/dbconnection.py",
line 395, in iterSelect
    select, keepConnection=False)
  File
"/usr/lib/python2.5/site-packages/SQLObject-0.10.1-py2.5.egg/sqlobject/dbconnection.py",
line 631, in __init__
    self.query = self.dbconn.queryForSelect(select)
  File
"/usr/lib/python2.5/site-packages/SQLObject-0.10.1-py2.5.egg/sqlobject/dbconnection.py",
line 409, in queryForSelect
    return self.sqlrepr(select.queryForSelect())
  File
"/usr/lib/python2.5/site-packages/SQLObject-0.10.1-py2.5.egg/sqlobject/dbconnection.py",
line 591, in sqlrepr
    return sqlrepr(v, self.dbName)
  File
"/usr/lib/python2.5/site-packages/SQLObject-0.10.1-py2.5.egg/sqlobject/converters.py",
line 211, in sqlrepr
    return reprFunc(db)
  File
"/usr/lib/python2.5/site-packages/SQLObject-0.10.1-py2.5.egg/sqlobject/sqlbuilder.py",
line 677, in __sqlrepr__
    select = dbConnectionForScheme(db)._queryAddLimitOffset(select, start,
end)
  File
"/usr/lib/python2.5/site-packages/SQLObject-0.10.1-py2.5.egg/sqlobject/firebird/firebirdconnection.py",
line 120, in _queryAddLimitOffset
    match = cls.limit_re.match(query)
AttributeError: class FirebirdConnection has no attribute 'limit_re'



Adding the line :
cls.limit_re = re.compile('^\s*(select )(.*)', re.IGNORECASE)
before the line:
match = cls.limit_re.match(query)

in the method _queryAddLimitOffset before in the file firebirdconnection.py
solves the problem.

I am not a Python guru and I am sure this is not a "high-level" solution.
Oleg surely knows how to patch it properly :D

Regards

Petr
------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
_______________________________________________
sqlobject-discuss mailing list
sqlobject-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss

Reply via email to