sqlobject-cvs Mailing List for SQLObject (Page 55)
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
You can subscribe to this list here.
2003 |
Jan
|
Feb
|
Mar
(9) |
Apr
(74) |
May
(29) |
Jun
(16) |
Jul
(28) |
Aug
(10) |
Sep
(57) |
Oct
(9) |
Nov
(29) |
Dec
(12) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2004 |
Jan
(7) |
Feb
(14) |
Mar
(6) |
Apr
(3) |
May
(12) |
Jun
(34) |
Jul
(9) |
Aug
(29) |
Sep
(22) |
Oct
(2) |
Nov
(15) |
Dec
(52) |
2005 |
Jan
(47) |
Feb
(78) |
Mar
(14) |
Apr
(35) |
May
(33) |
Jun
(16) |
Jul
(26) |
Aug
(63) |
Sep
(40) |
Oct
(96) |
Nov
(96) |
Dec
(123) |
2006 |
Jan
(159) |
Feb
(144) |
Mar
(64) |
Apr
(31) |
May
(88) |
Jun
(48) |
Jul
(16) |
Aug
(64) |
Sep
(87) |
Oct
(92) |
Nov
(56) |
Dec
(76) |
2007 |
Jan
(94) |
Feb
(103) |
Mar
(126) |
Apr
(123) |
May
(85) |
Jun
(11) |
Jul
(130) |
Aug
(47) |
Sep
(65) |
Oct
(70) |
Nov
(12) |
Dec
(11) |
2008 |
Jan
(30) |
Feb
(55) |
Mar
(88) |
Apr
(20) |
May
(50) |
Jun
|
Jul
(38) |
Aug
(1) |
Sep
(9) |
Oct
(5) |
Nov
(6) |
Dec
(39) |
2009 |
Jan
(8) |
Feb
(16) |
Mar
(3) |
Apr
(33) |
May
(44) |
Jun
(1) |
Jul
(10) |
Aug
(33) |
Sep
(74) |
Oct
(22) |
Nov
|
Dec
(15) |
2010 |
Jan
(28) |
Feb
(22) |
Mar
(46) |
Apr
(29) |
May
(1) |
Jun
(1) |
Jul
(27) |
Aug
(8) |
Sep
(5) |
Oct
(33) |
Nov
(24) |
Dec
(41) |
2011 |
Jan
(4) |
Feb
(12) |
Mar
(35) |
Apr
(29) |
May
(19) |
Jun
(16) |
Jul
(32) |
Aug
(25) |
Sep
(5) |
Oct
(11) |
Nov
(21) |
Dec
(12) |
2012 |
Jan
(3) |
Feb
(4) |
Mar
(20) |
Apr
(4) |
May
(25) |
Jun
(13) |
Jul
|
Aug
|
Sep
(2) |
Oct
(25) |
Nov
(9) |
Dec
(1) |
2013 |
Jan
(6) |
Feb
(8) |
Mar
|
Apr
(10) |
May
(31) |
Jun
(7) |
Jul
(18) |
Aug
(33) |
Sep
(4) |
Oct
(16) |
Nov
|
Dec
(27) |
2014 |
Jan
(2) |
Feb
|
Mar
|
Apr
(11) |
May
(39) |
Jun
(8) |
Jul
(11) |
Aug
(4) |
Sep
|
Oct
(27) |
Nov
|
Dec
(71) |
2015 |
Jan
(17) |
Feb
(47) |
Mar
(33) |
Apr
|
May
|
Jun
(9) |
Jul
(7) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(8) |
2016 |
Jan
(4) |
Feb
(4) |
Mar
|
Apr
|
May
(12) |
Jun
(7) |
Jul
(9) |
Aug
(31) |
Sep
(8) |
Oct
(3) |
Nov
(15) |
Dec
(1) |
2017 |
Jan
(13) |
Feb
(7) |
Mar
(14) |
Apr
(8) |
May
(10) |
Jun
(4) |
Jul
(2) |
Aug
(1) |
Sep
|
Oct
(8) |
Nov
(4) |
Dec
(5) |
2018 |
Jan
(2) |
Feb
(8) |
Mar
|
Apr
(4) |
May
|
Jun
(6) |
Jul
|
Aug
(1) |
Sep
|
Oct
|
Nov
(1) |
Dec
|
2019 |
Jan
(1) |
Feb
(16) |
Mar
(1) |
Apr
(3) |
May
(5) |
Jun
(1) |
Jul
|
Aug
|
Sep
(2) |
Oct
|
Nov
(1) |
Dec
(3) |
2020 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
(1) |
Jun
|
Jul
|
Aug
(1) |
Sep
|
Oct
(2) |
Nov
|
Dec
(2) |
2021 |
Jan
|
Feb
(2) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(1) |
Nov
(1) |
Dec
|
2022 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(6) |
Oct
(1) |
Nov
(1) |
Dec
(4) |
2023 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
(3) |
Sep
(2) |
Oct
(2) |
Nov
(4) |
Dec
|
2024 |
Jan
|
Feb
(2) |
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
|
Sep
(1) |
Oct
|
Nov
|
Dec
(9) |
2025 |
Jan
|
Feb
(4) |
Mar
(2) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <sub...@co...> - 2009-09-25 14:38:04
|
Author: phd Date: 2009-09-25 08:37:54 -0600 (Fri, 25 Sep 2009) New Revision: 3992 Modified: SQLObject/branches/0.10/docs/News.txt SQLObject/branches/0.10/sqlobject/dbconnection.py Log: Fixed a bug in logging to console - convert unicode to str (bug 2865410). Modified: SQLObject/branches/0.10/docs/News.txt =================================================================== --- SQLObject/branches/0.10/docs/News.txt 2009-09-20 19:17:26 UTC (rev 3991) +++ SQLObject/branches/0.10/docs/News.txt 2009-09-25 14:37:54 UTC (rev 3992) @@ -7,6 +7,11 @@ .. _start: +SQLObject 0.10.8 +================ + +* Fixed a bug in logging to console - convert unicode to str. + SQLObject 0.10.7 ================ Modified: SQLObject/branches/0.10/sqlobject/dbconnection.py =================================================================== --- SQLObject/branches/0.10/sqlobject/dbconnection.py 2009-09-20 19:17:26 UTC (rev 3991) +++ SQLObject/branches/0.10/sqlobject/dbconnection.py 2009-09-25 14:37:54 UTC (rev 3992) @@ -28,26 +28,32 @@ conn.close() class ConsoleWriter: - def __init__(self, loglevel): + def __init__(self, connection, loglevel): self.loglevel = loglevel self.logfile = getattr(sys, loglevel or "stdout") + self.dbEncoding = getattr(connection, "dbEncoding", "ascii") def write(self, text): + if isinstance(text, unicode): + try: + text = text.encode(self.dbEncoding) + except UnicodeEncodeError: + text = repr(text)[2:-1] self.logfile.write(text + '\n') class LogWriter: - def __init__(self, logger, loglevel): + def __init__(self, connection, logger, loglevel): self.logger = logger self.loglevel = loglevel self.logmethod = getattr(logger, loglevel) def write(self, text): self.logmethod(text) -def makeDebugWriter(loggerName, loglevel): +def makeDebugWriter(connection, loggerName, loglevel): if not loggerName: - return ConsoleWriter(loglevel) + return ConsoleWriter(connection, loglevel) import logging logger = logging.getLogger(loggerName) - return LogWriter(logger, loglevel) + return LogWriter(connection, logger, loglevel) class Boolean(object): """A bool class that also understands some special string keywords (yes/no, true/false, on/off, 1/0)""" @@ -69,7 +75,7 @@ self.debug = Boolean(debug) self.debugOutput = Boolean(debugOutput) self.debugThreading = Boolean(debugThreading) - self.debugWriter = makeDebugWriter(logger, loglevel) + self.debugWriter = makeDebugWriter(self, logger, loglevel) self.doCache = Boolean(cache) self.cache = CacheSet(cache=self.doCache) self.style = style |
From: SourceForge.net <no...@so...> - 2009-09-25 14:02:16
|
Patches item #2866300, was opened at 2009-09-25 08:08 Message generated for change (Comment added) made by phd You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540674&aid=2866300&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: None Group: None Status: Open Resolution: None Priority: 5 Private: No Submitted By: Geoff Kassel (gkassel) >Assigned to: Oleg Broytmann (phd) Summary: ConnectionHub.__get__ TypeError and patch Initial Comment: Hi, Found a TypeError raised from ConnectionHub.__get__ that seems to happen when overriding the SQLObject.__init__ method. Here's the associated trace: Traceback (most recent call last): File "<console>", line 1, in <module> File "/lvm/var/www/localhost/webapp/product/product/model/dbfile.py", line 220, in __init__ SQLObject.__init__(self, contentType = contentType, _data = data) File "//usr/lib/python2.5/site-packages/sqlobject/main.py", line 1223, in __init__ self._create(id, **kw) File "//usr/lib/python2.5/site-packages/sqlobject/main.py", line 1271, in _create self._SO_finishCreate(id) File "//usr/lib/python2.5/site-packages/sqlobject/main.py", line 1294, in _SO_finishCreate id = self._connection.queryInsertID(self, File "//usr/lib/python2.5/site-packages/turbogears/database.py", line 273, in __get__ return self.hub.__get__(obj, type) File "/usr/lib/python2.5/site-packages/sqlobject/dbconnection.py", line 826, in __get__ if obj and obj.__dict__.has_key('_connection'): TypeError: an integer is required The object 'obj' in question is an uninitialized SQLObject (an object of a database-backed file class named DBFile), and the error is raised from the 'if obj' condition. I've fixed this with the attached patch. ---------------------------------------------------------------------- >Comment By: Oleg Broytmann (phd) Date: 2009-09-25 18:02 Message: I cannot get how 'obj' can be None there. Can you provide a short test program that demonstrates the problem? ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540674&aid=2866300&group_id=74338 |
From: SourceForge.net <no...@so...> - 2009-09-25 04:08:27
|
Patches item #2866300, was opened at 2009-09-25 14:08 Message generated for change (Tracker Item Submitted) made by gkassel You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540674&aid=2866300&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: None Group: None Status: Open Resolution: None Priority: 5 Private: No Submitted By: Geoff Kassel (gkassel) Assigned to: Nobody/Anonymous (nobody) Summary: ConnectionHub.__get__ TypeError and patch Initial Comment: Hi, Found a TypeError raised from ConnectionHub.__get__ that seems to happen when overriding the SQLObject.__init__ method. Here's the associated trace: Traceback (most recent call last): File "<console>", line 1, in <module> File "/lvm/var/www/localhost/webapp/product/product/model/dbfile.py", line 220, in __init__ SQLObject.__init__(self, contentType = contentType, _data = data) File "//usr/lib/python2.5/site-packages/sqlobject/main.py", line 1223, in __init__ self._create(id, **kw) File "//usr/lib/python2.5/site-packages/sqlobject/main.py", line 1271, in _create self._SO_finishCreate(id) File "//usr/lib/python2.5/site-packages/sqlobject/main.py", line 1294, in _SO_finishCreate id = self._connection.queryInsertID(self, File "//usr/lib/python2.5/site-packages/turbogears/database.py", line 273, in __get__ return self.hub.__get__(obj, type) File "/usr/lib/python2.5/site-packages/sqlobject/dbconnection.py", line 826, in __get__ if obj and obj.__dict__.has_key('_connection'): TypeError: an integer is required The object 'obj' in question is an uninitialized SQLObject (an object of a database-backed file class named DBFile), and the error is raised from the 'if obj' condition. I've fixed this with the attached patch. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540674&aid=2866300&group_id=74338 |
From: SourceForge.net <no...@so...> - 2009-09-24 00:45:37
|
Bugs item #2865410, was opened at 2009-09-23 20:45 Message generated for change (Tracker Item Submitted) made by bdoms You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540672&aid=2865410&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: None Group: SQLObject release (specify) Status: Open Resolution: None Priority: 5 Private: No Submitted By: Brendan Doms (bdoms) Assigned to: Nobody/Anonymous (nobody) Summary: createTable Fails When Table is Named "Transaction" Initial Comment: Bare bones, just try this (I'm working off of the easy_install version on Ubuntu, which is currently 0.11.0): from sqlobject import SQLObject, connectionForURI, sqlhub db_file = os.path.join(os.path.abspath(os.path.dirname(__file__)), 'finance.db') connection = connectionForURI('sqlite:' + db_file) sqlhub.processConnection = connection class Transaction(SQLObject): pass Transaction.createTable() If the table is named anything else (as far as I can find), then it works fine. But as it is, this generates the following error: File "/usr/local/lib/python2.6/dist-packages/SQLObject-0.11.0-py2.6.egg/sqlobject/sqlite/sqliteconnection.py", line 183, in _executeRetry raise OperationalError(ErrorMessage(e)) sqlobject.dberrors.OperationalError: near "transaction": syntax error Not very helpful right? Either this error should be changed to point out the fact that "Transaction" is invalid as a table name, or the preferred solution would be to eliminate the error altogether and allow this table name. Considering that the import list contains no * and nothing called "Transaction" I see no reason why SQLObject's name space should interfere here. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540672&aid=2865410&group_id=74338 |
From: SourceForge.net <no...@so...> - 2009-09-23 13:26:47
|
Bugs item #2865000, was opened at 2009-09-23 15:26 Message generated for change (Tracker Item Submitted) made by gregor_horvath You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540672&aid=2865000&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: General Group: SQLObject release (specify) Status: Open Resolution: None Priority: 5 Private: No Submitted By: greg (gregor_horvath) Assigned to: Nobody/Anonymous (nobody) Summary: UnicodeEncodeError with ?debug=1 and unciode query Initial Comment: If in the connection string ?debug=1 is enabled and the select query is unicode, then a UnicodeEncodeError is thrown: File "/usr/lib/python2.5/site-packages/sqlobject/sresults.py", line 179, in __iter__ return iter(list(self.lazyIter())) File "/usr/lib/python2.5/site-packages/sqlobject/sresults.py", line 187, in lazyIter return conn.iterSelect(self) File "/usr/lib/python2.5/site-packages/sqlobject/dbconnection.py", line 395, in iterSelect select, keepConnection=False) File "/usr/lib/python2.5/site-packages/sqlobject/dbconnection.py", line 633, in __init__ dbconn.printDebug(rawconn, self.query, 'Select') File "/usr/lib/python2.5/site-packages/sqlobject/dbconnection.py", line 324, in printDebug self.debugWriter.write(msg) File "/usr/lib/python2.5/site-packages/sqlobject/dbconnection.py", line 35, in write self.logfile.write(text + '\n') UnicodeEncodeError: 'ascii' codec can't encode character u'\xd6' in position 56: ordinal not in range(128) See in the attachment a test case wich demonstrates the error case and the ok case. Tested on Version 0.10.2 ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540672&aid=2865000&group_id=74338 |
From: <sub...@co...> - 2009-09-20 19:17:36
|
Author: phd Date: 2009-09-20 13:17:26 -0600 (Sun, 20 Sep 2009) New Revision: 3991 Modified: SQLObject/tags/0.11.1/setup.cfg SQLObject/tags/0.11.1/setup.py SQLObject/tags/0.11.1/sqlobject/__init__.py SQLObject/tags/0.11.1/sqlobject/main.py Log: Stable version 0.11.1. Modified: SQLObject/tags/0.11.1/setup.cfg =================================================================== --- SQLObject/tags/0.11.1/setup.cfg 2009-09-20 19:16:16 UTC (rev 3990) +++ SQLObject/tags/0.11.1/setup.cfg 2009-09-20 19:17:26 UTC (rev 3991) @@ -2,13 +2,6 @@ command_packages = buildutils.pudge_command, buildutils.publish_command -[easy_install] -#find_links = http://svn.pythonpaste.org/package_index.html - -[egg_info] -tag_build = dev -tag_svn_revision = true - [pudge] theme = pythonpaste.org docs = docs/index.txt docs/Authors.txt docs/DeveloperGuide.txt docs/FAQ.txt Modified: SQLObject/tags/0.11.1/setup.py =================================================================== --- SQLObject/tags/0.11.1/setup.py 2009-09-20 19:16:16 UTC (rev 3990) +++ SQLObject/tags/0.11.1/setup.py 2009-09-20 19:17:26 UTC (rev 3991) @@ -21,7 +21,7 @@ """ setup(name="SQLObject", - version="0.11", + version="0.11.1", description="Object-Relational Manager, aka database wrapper", long_description="""\ SQLObject is a popular *Object Relational Manager* for providing an @@ -49,7 +49,7 @@ author="Ian Bicking", author_email="ia...@co...", url="http://sqlobject.org/devel/", - download_url="http://cheeseshop.python.org/pypi/SQLObject/", + download_url="http://cheeseshop.python.org/pypi/SQLObject/0.11.1", license="LGPL", packages=["sqlobject"] + ['sqlobject.%s' % package for package in subpackages], scripts=["scripts/sqlobject-admin"], Modified: SQLObject/tags/0.11.1/sqlobject/__init__.py =================================================================== --- SQLObject/tags/0.11.1/sqlobject/__init__.py 2009-09-20 19:16:16 UTC (rev 3990) +++ SQLObject/tags/0.11.1/sqlobject/__init__.py 2009-09-20 19:17:26 UTC (rev 3991) @@ -1,5 +1,5 @@ """ -SQLObject 0.11 +SQLObject 0.11.1 """ from main import * Modified: SQLObject/tags/0.11.1/sqlobject/main.py =================================================================== --- SQLObject/tags/0.11.1/sqlobject/main.py 2009-09-20 19:16:16 UTC (rev 3990) +++ SQLObject/tags/0.11.1/sqlobject/main.py 2009-09-20 19:17:26 UTC (rev 3991) @@ -1,6 +1,6 @@ """ -SQLObject 0.11 --------------- +SQLObject 0.11.1 +---------------- :author: Ian Bicking <ia...@co...> |
From: <sub...@co...> - 2009-09-20 19:16:27
|
Author: phd Date: 2009-09-20 13:16:16 -0600 (Sun, 20 Sep 2009) New Revision: 3990 Modified: SQLObject/branches/0.11/setup.py Log: Added download_url. Modified: SQLObject/branches/0.11/setup.py =================================================================== --- SQLObject/branches/0.11/setup.py 2009-09-20 19:14:55 UTC (rev 3989) +++ SQLObject/branches/0.11/setup.py 2009-09-20 19:16:16 UTC (rev 3990) @@ -49,7 +49,7 @@ author="Ian Bicking", author_email="ia...@co...", url="http://sqlobject.org/devel/", - download_url="http://cheeseshop.python.org/pypi/SQLObject/", + download_url="http://cheeseshop.python.org/pypi/SQLObject/0.11", license="LGPL", packages=["sqlobject"] + ['sqlobject.%s' % package for package in subpackages], scripts=["scripts/sqlobject-admin"], |
From: <sub...@co...> - 2009-09-20 19:15:06
|
Author: phd Date: 2009-09-20 13:14:55 -0600 (Sun, 20 Sep 2009) New Revision: 3989 Added: SQLObject/tags/0.11.1/ Log: Tagging 0.11.1 Copied: SQLObject/tags/0.11.1 (from rev 3988, SQLObject/branches/0.11) |
From: <sub...@co...> - 2009-09-20 19:04:46
|
Author: phd Date: 2009-09-20 13:04:34 -0600 (Sun, 20 Sep 2009) New Revision: 3988 Modified: SQLObject/tags/0.10.7/setup.cfg SQLObject/tags/0.10.7/setup.py SQLObject/tags/0.10.7/sqlobject/__init__.py SQLObject/tags/0.10.7/sqlobject/main.py Log: Stable version 0.10.7. Modified: SQLObject/tags/0.10.7/setup.cfg =================================================================== --- SQLObject/tags/0.10.7/setup.cfg 2009-09-20 19:02:15 UTC (rev 3987) +++ SQLObject/tags/0.10.7/setup.cfg 2009-09-20 19:04:34 UTC (rev 3988) @@ -2,13 +2,6 @@ command_packages = buildutils.pudge_command, buildutils.publish_command -[easy_install] -#find_links = http://svn.pythonpaste.org/package_index.html - -[egg_info] -tag_build = dev -tag_svn_revision = true - [pudge] theme = pythonpaste.org docs = docs/index.txt docs/Authors.txt docs/DeveloperGuide.txt docs/FAQ.txt Modified: SQLObject/tags/0.10.7/setup.py =================================================================== --- SQLObject/tags/0.10.7/setup.py 2009-09-20 19:02:15 UTC (rev 3987) +++ SQLObject/tags/0.10.7/setup.py 2009-09-20 19:04:34 UTC (rev 3988) @@ -21,7 +21,7 @@ """ setup(name="SQLObject", - version="0.10", + version="0.10.7", description="Object-Relational Manager, aka database wrapper", long_description="""\ SQLObject is a popular *Object Relational Manager* for providing an @@ -49,7 +49,7 @@ author="Ian Bicking", author_email="ia...@co...", url="http://sqlobject.org/", - download_url="http://cheeseshop.python.org/pypi/SQLObject/0.10", + download_url="http://cheeseshop.python.org/pypi/SQLObject/0.10.7", license="LGPL", packages=["sqlobject"] + ['sqlobject.%s' % package for package in subpackages], scripts=["scripts/sqlobject-admin"], Modified: SQLObject/tags/0.10.7/sqlobject/__init__.py =================================================================== --- SQLObject/tags/0.10.7/sqlobject/__init__.py 2009-09-20 19:02:15 UTC (rev 3987) +++ SQLObject/tags/0.10.7/sqlobject/__init__.py 2009-09-20 19:04:34 UTC (rev 3988) @@ -1,5 +1,5 @@ """ -SQLObject 0.10 +SQLObject 0.10.7 """ from main import * Modified: SQLObject/tags/0.10.7/sqlobject/main.py =================================================================== --- SQLObject/tags/0.10.7/sqlobject/main.py 2009-09-20 19:02:15 UTC (rev 3987) +++ SQLObject/tags/0.10.7/sqlobject/main.py 2009-09-20 19:04:34 UTC (rev 3988) @@ -1,6 +1,6 @@ """ -SQLObject 0.10 --------------- +SQLObject 0.10.7 +---------------- :author: Ian Bicking <ia...@co...> |
From: <sub...@co...> - 2009-09-20 19:02:28
|
Author: phd Date: 2009-09-20 13:02:15 -0600 (Sun, 20 Sep 2009) New Revision: 3987 Added: SQLObject/tags/0.10.7/ Log: Tagging 0.10.7 Copied: SQLObject/tags/0.10.7 (from rev 3986, SQLObject/branches/0.10) |
From: <sub...@co...> - 2009-09-20 19:01:20
|
Author: phd Date: 2009-09-20 13:01:10 -0600 (Sun, 20 Sep 2009) New Revision: 3986 Modified: SQLObject/trunk/docs/News.txt Log: SQLObject 0.11.1 and SQLObject 0.10.7 were released 20 Sep 2009. Modified: SQLObject/trunk/docs/News.txt =================================================================== --- SQLObject/trunk/docs/News.txt 2009-09-20 18:59:37 UTC (rev 3985) +++ SQLObject/trunk/docs/News.txt 2009-09-20 19:01:10 UTC (rev 3986) @@ -51,6 +51,8 @@ SQLObject 0.11.1 ================ +Released 20 Sep 2009 + * A number of changes ported from `SQLObject 0.10.7`_. SQLObject 0.11.0 @@ -104,6 +106,8 @@ SQLObject 0.10.7 ================ +Released 20 Sep 2009 + * Fixed a bug: Sybase tables with identity column fire two identity_inserts. * Fixed a bug: q.startswith(), q.contains() and q.endswith() escape (with a |
From: <sub...@co...> - 2009-09-20 18:59:50
|
Author: phd Date: 2009-09-20 12:59:37 -0600 (Sun, 20 Sep 2009) New Revision: 3985 Modified: SQLObject/branches/0.11/docs/News.txt Log: SQLObject 0.11.1 and SQLObject 0.10.7 released 20 Sep 2009. Modified: SQLObject/branches/0.11/docs/News.txt =================================================================== --- SQLObject/branches/0.11/docs/News.txt 2009-09-20 18:57:54 UTC (rev 3984) +++ SQLObject/branches/0.11/docs/News.txt 2009-09-20 18:59:37 UTC (rev 3985) @@ -10,6 +10,8 @@ SQLObject 0.11.1 ================ +Released 20 Sep 2009 + * A number of changes ported from `SQLObject 0.10.7`_. SQLObject 0.11.0 @@ -63,6 +65,8 @@ SQLObject 0.10.7 ================ +Released 20 Sep 2009 + * Fixed a bug: Sybase tables with identity column fire two identity_inserts. * Fixed a bug: q.startswith(), q.contains() and q.endswith() escape (with a |
From: <sub...@co...> - 2009-09-20 18:58:05
|
Author: phd Date: 2009-09-20 12:57:54 -0600 (Sun, 20 Sep 2009) New Revision: 3984 Modified: SQLObject/branches/0.10/docs/News.txt Log: SQLObject 0.10.7 released 20 Sep 2009. Modified: SQLObject/branches/0.10/docs/News.txt =================================================================== --- SQLObject/branches/0.10/docs/News.txt 2009-09-20 16:34:07 UTC (rev 3983) +++ SQLObject/branches/0.10/docs/News.txt 2009-09-20 18:57:54 UTC (rev 3984) @@ -10,6 +10,8 @@ SQLObject 0.10.7 ================ +Released 20 Sep 2009 + * Fixed a bug: Sybase tables with identity column fire two identity_inserts. * Fixed a bug: q.startswith(), q.contains() and q.endswith() escape (with a |
From: SourceForge.net <no...@so...> - 2009-09-20 16:38:50
|
Bugs item #2853734, was opened at 2009-09-07 21:38 Message generated for change (Settings changed) made by phd You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540672&aid=2853734&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: None Group: None >Status: Closed >Resolution: Fixed Priority: 5 Private: No Submitted By: Mario Gala (mariogala) Assigned to: Oleg Broytmann (phd) Summary: Underscore not escaped for LIKE Initial Comment: The _LikeQuoted class (in sqlbuilder.py) is not escaping the underscore character '_' (whereas the percent character '%' is escaped correctly). Indeed in MySQL the underscore character in a LIKE pattern represents a wildcard to match exactly one character (http://dev.mysql.com/doc/refman/5.0/en/string-comparison-functions.html), so it should be probably escaped there (at least for MySQL, not sure about other databases). ---------------------------------------------------------------------- >Comment By: Oleg Broytmann (phd) Date: 2009-09-20 20:38 Message: Fixed in the revisions 3981-3983 (branches 0.10, 0.11 and the trunk). Will be in the next round of releases. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540672&aid=2853734&group_id=74338 |
From: <sub...@co...> - 2009-09-20 16:34:17
|
Author: phd Date: 2009-09-20 10:34:07 -0600 (Sun, 20 Sep 2009) New Revision: 3983 Modified: SQLObject/trunk/docs/News.txt SQLObject/trunk/sqlobject/sqlbuilder.py SQLObject/trunk/sqlobject/tests/test_select.py Log: Fixed a bug: q.startswith(), q.contains() and q.endswith() escape (with a backslash) all special characters (backslashes, underscores and percent signs). Modified: SQLObject/trunk/docs/News.txt =================================================================== --- SQLObject/trunk/docs/News.txt 2009-09-20 16:27:23 UTC (rev 3982) +++ SQLObject/trunk/docs/News.txt 2009-09-20 16:34:07 UTC (rev 3983) @@ -106,6 +106,10 @@ * Fixed a bug: Sybase tables with identity column fire two identity_inserts. +* Fixed a bug: q.startswith(), q.contains() and q.endswith() escape (with a + backslash) all special characters (backslashes, underscores and percent + signs). + SQLObject 0.10.6 ================ Modified: SQLObject/trunk/sqlobject/sqlbuilder.py =================================================================== --- SQLObject/trunk/sqlobject/sqlbuilder.py 2009-09-20 16:27:23 UTC (rev 3982) +++ SQLObject/trunk/sqlobject/sqlbuilder.py 2009-09-20 16:34:07 UTC (rev 3983) @@ -840,13 +840,13 @@ return NOT(_IN(item, list)) def STARTSWITH(expr, pattern): - return SQLOp("LIKE", expr, _LikeQuoted(pattern) + '%') + return LIKE(expr, _LikeQuoted(pattern) + '%', escape='\\') def ENDSWITH(expr, pattern): - return SQLOp("LIKE", expr, '%' + _LikeQuoted(pattern)) + return LIKE(expr, '%' + _LikeQuoted(pattern), escape='\\') def CONTAINSSTRING(expr, pattern): - return SQLOp("LIKE", expr, '%' + _LikeQuoted(pattern) + '%') + return LIKE(expr, '%' + _LikeQuoted(pattern) + '%', escape='\\') def ISNULL(expr): return SQLOp("IS", expr, None) @@ -888,7 +888,7 @@ values = [] if self.prefix: values.append("'%s'" % self.prefix) - s = _quote_percent(sqlrepr(s, db), db) + s = _quote_like_special(sqlrepr(s, db), db) values.append(s) if self.postfix: values.append("'%s'" % self.postfix) @@ -897,16 +897,17 @@ else: return " || ".join(values) elif isinstance(s, basestring): - s = _quote_percent(sqlrepr(s, db)[1:-1], db) + s = _quote_like_special(sqlrepr(s, db)[1:-1], db) return "'%s%s%s'" % (self.prefix, s, self.postfix) else: raise TypeError, "expected str, unicode or SQLExpression, got %s" % type(s) -def _quote_percent(s, db): - if db in ('postgres', 'mysql'): - s = s.replace('%', '\\%') +def _quote_like_special(s, db): + if db == 'postgres': + escape = r'\\' else: - s = s.replace('%', '%%') + escape = '\\' + s = s.replace('\\', r'\\').replace('%', escape+'%').replace('_', escape+'_') return s ######################################## @@ -1135,11 +1136,17 @@ class LIKE(SQLExpression): op = "LIKE" - def __init__(self, expr, string): + def __init__(self, expr, string, escape=None): self.expr = expr self.string = string + self.escape = escape def __sqlrepr__(self, db): - return "(%s %s (%s))" % (sqlrepr(self.expr, db), self.op, sqlrepr(self.string, db)) + escape = self.escape + like = "%s %s (%s)" % (sqlrepr(self.expr, db), self.op, sqlrepr(self.string, db)) + if escape is None: + return "(%s)" % like + else: + return "(%s ESCAPE %s)" % (like, sqlrepr(escape, db)) def components(self): return [self.expr, self.string] def execute(self, executor): @@ -1157,15 +1164,16 @@ class RLIKE(LIKE): op = "RLIKE" + op_db = { + 'firebird': 'RLIKE', + 'maxdb': 'RLIKE', + 'mysql': 'RLIKE', + 'postgres': '~', + 'sqlite': 'REGEXP' + } + def _get_op(self, db): - if db in ('mysql', 'maxdb', 'firebird'): - return "RLIKE" - elif db == 'sqlite': - return "REGEXP" - elif db == 'postgres': - return "~" - else: - return "LIKE" + return self.op_db.get(db, 'LIKE') def __sqlrepr__(self, db): return "(%s %s (%s))" % ( sqlrepr(self.expr, db), self._get_op(db), sqlrepr(self.string, db) Modified: SQLObject/trunk/sqlobject/tests/test_select.py =================================================================== --- SQLObject/trunk/sqlobject/tests/test_select.py 2009-09-20 16:27:23 UTC (rev 3982) +++ SQLObject/trunk/sqlobject/tests/test_select.py 2009-09-20 16:34:07 UTC (rev 3983) @@ -69,14 +69,23 @@ assert len(list(IterTest.select(limit=2))) == 2 raises(AssertionError, IterTest.select(limit=2).count) -def test_06_like(): +def test_06_contains(): setupIter() assert len(list(IterTest.select(IterTest.q.name.startswith('a')))) == 1 - assert len(list(IterTest.select(IterTest.q.name.endswith('a')))) == 1 assert len(list(IterTest.select(IterTest.q.name.contains('a')))) == 1 assert len(list(IterTest.select(IterTest.q.name.contains(func.lower('A'))))) == 1 assert len(list(IterTest.select(IterTest.q.name.contains("a'b")))) == 0 + assert len(list(IterTest.select(IterTest.q.name.endswith('a')))) == 1 +def test_07_contains_special(): + setupClass(IterTest) + a = IterTest(name='\\test') + b = IterTest(name='100%') + c = IterTest(name='test_') + assert list(IterTest.select(IterTest.q.name.startswith('\\'))) == [a] + assert list(IterTest.select(IterTest.q.name.contains('%'))) == [b] + assert list(IterTest.select(IterTest.q.name.endswith('_'))) == [c] + def test_select_getOne(): setupClass(IterTest) a = IterTest(name='a') |
From: <sub...@co...> - 2009-09-20 16:27:33
|
Author: phd Date: 2009-09-20 10:27:23 -0600 (Sun, 20 Sep 2009) New Revision: 3982 Modified: SQLObject/branches/0.11/docs/News.txt SQLObject/branches/0.11/sqlobject/sqlbuilder.py SQLObject/branches/0.11/sqlobject/tests/test_select.py Log: Fixed a bug: q.startswith(), q.contains() and q.endswith() escape (with a backslash) all special characters (backslashes, underscores and percent signs). Modified: SQLObject/branches/0.11/docs/News.txt =================================================================== --- SQLObject/branches/0.11/docs/News.txt 2009-09-20 16:25:09 UTC (rev 3981) +++ SQLObject/branches/0.11/docs/News.txt 2009-09-20 16:27:23 UTC (rev 3982) @@ -65,6 +65,10 @@ * Fixed a bug: Sybase tables with identity column fire two identity_inserts. +* Fixed a bug: q.startswith(), q.contains() and q.endswith() escape (with a + backslash) all special characters (backslashes, underscores and percent + signs). + SQLObject 0.10.6 ================ Modified: SQLObject/branches/0.11/sqlobject/sqlbuilder.py =================================================================== --- SQLObject/branches/0.11/sqlobject/sqlbuilder.py 2009-09-20 16:25:09 UTC (rev 3981) +++ SQLObject/branches/0.11/sqlobject/sqlbuilder.py 2009-09-20 16:27:23 UTC (rev 3982) @@ -853,13 +853,13 @@ return NOT(_IN(item, list)) def STARTSWITH(expr, pattern): - return SQLOp("LIKE", expr, _LikeQuoted(pattern) + '%') + return LIKE(expr, _LikeQuoted(pattern) + '%', escape='\\') def ENDSWITH(expr, pattern): - return SQLOp("LIKE", expr, '%' + _LikeQuoted(pattern)) + return LIKE(expr, '%' + _LikeQuoted(pattern), escape='\\') def CONTAINSSTRING(expr, pattern): - return SQLOp("LIKE", expr, '%' + _LikeQuoted(pattern) + '%') + return LIKE(expr, '%' + _LikeQuoted(pattern) + '%', escape='\\') def ISNULL(expr): return SQLOp("IS", expr, None) @@ -901,7 +901,7 @@ values = [] if self.prefix: values.append("'%s'" % self.prefix) - s = _quote_percent(sqlrepr(s, db), db) + s = _quote_like_special(sqlrepr(s, db), db) values.append(s) if self.postfix: values.append("'%s'" % self.postfix) @@ -910,16 +910,17 @@ else: return " || ".join(values) elif isinstance(s, basestring): - s = _quote_percent(sqlrepr(s, db)[1:-1], db) + s = _quote_like_special(sqlrepr(s, db)[1:-1], db) return "'%s%s%s'" % (self.prefix, s, self.postfix) else: raise TypeError, "expected str, unicode or SQLExpression, got %s" % type(s) -def _quote_percent(s, db): - if db in ('postgres', 'mysql'): - s = s.replace('%', '\\%') +def _quote_like_special(s, db): + if db == 'postgres': + escape = r'\\' else: - s = s.replace('%', '%%') + escape = '\\' + s = s.replace('\\', r'\\').replace('%', escape+'%').replace('_', escape+'_') return s ######################################## @@ -1148,11 +1149,17 @@ class LIKE(SQLExpression): op = "LIKE" - def __init__(self, expr, string): + def __init__(self, expr, string, escape=None): self.expr = expr self.string = string + self.escape = escape def __sqlrepr__(self, db): - return "(%s %s (%s))" % (sqlrepr(self.expr, db), self.op, sqlrepr(self.string, db)) + escape = self.escape + like = "%s %s (%s)" % (sqlrepr(self.expr, db), self.op, sqlrepr(self.string, db)) + if escape is None: + return "(%s)" % like + else: + return "(%s ESCAPE %s)" % (like, sqlrepr(escape, db)) def components(self): return [self.expr, self.string] def execute(self, executor): @@ -1170,15 +1177,16 @@ class RLIKE(LIKE): op = "RLIKE" + op_db = { + 'firebird': 'RLIKE', + 'maxdb': 'RLIKE', + 'mysql': 'RLIKE', + 'postgres': '~', + 'sqlite': 'REGEXP' + } + def _get_op(self, db): - if db in ('mysql', 'maxdb', 'firebird'): - return "RLIKE" - elif db == 'sqlite': - return "REGEXP" - elif db == 'postgres': - return "~" - else: - return "LIKE" + return self.op_db.get(db, 'LIKE') def __sqlrepr__(self, db): return "(%s %s (%s))" % ( sqlrepr(self.expr, db), self._get_op(db), sqlrepr(self.string, db) Modified: SQLObject/branches/0.11/sqlobject/tests/test_select.py =================================================================== --- SQLObject/branches/0.11/sqlobject/tests/test_select.py 2009-09-20 16:25:09 UTC (rev 3981) +++ SQLObject/branches/0.11/sqlobject/tests/test_select.py 2009-09-20 16:27:23 UTC (rev 3982) @@ -69,14 +69,23 @@ assert len(list(IterTest.select(limit=2))) == 2 raises(AssertionError, IterTest.select(limit=2).count) -def test_06_like(): +def test_06_contains(): setupIter() assert len(list(IterTest.select(IterTest.q.name.startswith('a')))) == 1 - assert len(list(IterTest.select(IterTest.q.name.endswith('a')))) == 1 assert len(list(IterTest.select(IterTest.q.name.contains('a')))) == 1 assert len(list(IterTest.select(IterTest.q.name.contains(func.lower('A'))))) == 1 assert len(list(IterTest.select(IterTest.q.name.contains("a'b")))) == 0 + assert len(list(IterTest.select(IterTest.q.name.endswith('a')))) == 1 +def test_07_contains_special(): + setupClass(IterTest) + a = IterTest(name='\\test') + b = IterTest(name='100%') + c = IterTest(name='test_') + assert list(IterTest.select(IterTest.q.name.startswith('\\'))) == [a] + assert list(IterTest.select(IterTest.q.name.contains('%'))) == [b] + assert list(IterTest.select(IterTest.q.name.endswith('_'))) == [c] + def test_select_getOne(): setupClass(IterTest) a = IterTest(name='a') |
From: <sub...@co...> - 2009-09-20 16:25:21
|
Author: phd Date: 2009-09-20 10:25:09 -0600 (Sun, 20 Sep 2009) New Revision: 3981 Modified: SQLObject/branches/0.10/docs/News.txt SQLObject/branches/0.10/sqlobject/sqlbuilder.py SQLObject/branches/0.10/sqlobject/tests/test_select.py Log: Fixed a bug: q.startswith(), q.contains() and q.endswith() escape (with a backslash) all special characters (backslashes, underscores and percent signs). Modified: SQLObject/branches/0.10/docs/News.txt =================================================================== --- SQLObject/branches/0.10/docs/News.txt 2009-09-20 15:53:02 UTC (rev 3980) +++ SQLObject/branches/0.10/docs/News.txt 2009-09-20 16:25:09 UTC (rev 3981) @@ -12,6 +12,10 @@ * Fixed a bug: Sybase tables with identity column fire two identity_inserts. +* Fixed a bug: q.startswith(), q.contains() and q.endswith() escape (with a + backslash) all special characters (backslashes, underscores and percent + signs). + SQLObject 0.10.6 ================ Modified: SQLObject/branches/0.10/sqlobject/sqlbuilder.py =================================================================== --- SQLObject/branches/0.10/sqlobject/sqlbuilder.py 2009-09-20 15:53:02 UTC (rev 3980) +++ SQLObject/branches/0.10/sqlobject/sqlbuilder.py 2009-09-20 16:25:09 UTC (rev 3981) @@ -883,7 +883,7 @@ values = [] if self.prefix: values.append("'%s'" % self.prefix) - s = _quote_percent(sqlrepr(s, db), db) + s = _quote_like_special(sqlrepr(s, db), db) values.append(s) if self.postfix: values.append("'%s'" % self.postfix) @@ -892,16 +892,17 @@ else: return " || ".join(values) elif isinstance(s, basestring): - s = _quote_percent(sqlrepr(s, db)[1:-1], db) + s = _quote_like_special(sqlrepr(s, db)[1:-1], db) return "'%s%s%s'" % (self.prefix, s, self.postfix) else: raise TypeError, "expected str, unicode or SQLExpression, got %s" % type(s) -def _quote_percent(s, db): - if db in ('postgres', 'mysql'): - s = s.replace('%', '\\%') +def _quote_like_special(s, db): + if db == 'postgres': + escape = r'\\' else: - s = s.replace('%', '%%') + escape = '\\' + s = s.replace('\\', r'\\').replace('%', escape+'%').replace('_', escape+'_') return s ######################################## @@ -1140,7 +1141,7 @@ if escape is None: return "(%s)" % like else: - return "(%s ESCAPE '%s')" % (like, escape) + return "(%s ESCAPE %s)" % (like, sqlrepr(escape, db)) def components(self): return [self.expr, self.string] def execute(self, executor): Modified: SQLObject/branches/0.10/sqlobject/tests/test_select.py =================================================================== --- SQLObject/branches/0.10/sqlobject/tests/test_select.py 2009-09-20 15:53:02 UTC (rev 3980) +++ SQLObject/branches/0.10/sqlobject/tests/test_select.py 2009-09-20 16:25:09 UTC (rev 3981) @@ -69,14 +69,23 @@ assert len(list(IterTest.select(limit=2))) == 2 raises(AssertionError, IterTest.select(limit=2).count) -def test_06_like(): +def test_06_contains(): setupIter() assert len(list(IterTest.select(IterTest.q.name.startswith('a')))) == 1 - assert len(list(IterTest.select(IterTest.q.name.endswith('a')))) == 1 assert len(list(IterTest.select(IterTest.q.name.contains('a')))) == 1 assert len(list(IterTest.select(IterTest.q.name.contains(func.lower('A'))))) == 1 assert len(list(IterTest.select(IterTest.q.name.contains("a'b")))) == 0 + assert len(list(IterTest.select(IterTest.q.name.endswith('a')))) == 1 +def test_07_contains_special(): + setupClass(IterTest) + a = IterTest(name='\\test') + b = IterTest(name='100%') + c = IterTest(name='test_') + assert list(IterTest.select(IterTest.q.name.startswith('\\'))) == [a] + assert list(IterTest.select(IterTest.q.name.contains('%'))) == [b] + assert list(IterTest.select(IterTest.q.name.endswith('_'))) == [c] + def test_select_getOne(): setupClass(IterTest) a = IterTest(name='a') |
From: <sub...@co...> - 2009-09-20 15:53:14
|
Author: phd Date: 2009-09-20 09:53:02 -0600 (Sun, 20 Sep 2009) New Revision: 3980 Modified: SQLObject/branches/0.10/sqlobject/sqlbuilder.py Log: Use LIKE() instead of SQLOp('LIKE'); pass backslash as the escape. Modified: SQLObject/branches/0.10/sqlobject/sqlbuilder.py =================================================================== --- SQLObject/branches/0.10/sqlobject/sqlbuilder.py 2009-09-20 15:50:22 UTC (rev 3979) +++ SQLObject/branches/0.10/sqlobject/sqlbuilder.py 2009-09-20 15:53:02 UTC (rev 3980) @@ -835,13 +835,13 @@ return NOT(_IN(item, list)) def STARTSWITH(expr, pattern): - return SQLOp("LIKE", expr, _LikeQuoted(pattern) + '%') + return LIKE(expr, _LikeQuoted(pattern) + '%', escape='\\') def ENDSWITH(expr, pattern): - return SQLOp("LIKE", expr, '%' + _LikeQuoted(pattern)) + return LIKE(expr, '%' + _LikeQuoted(pattern), escape='\\') def CONTAINSSTRING(expr, pattern): - return SQLOp("LIKE", expr, '%' + _LikeQuoted(pattern) + '%') + return LIKE(expr, '%' + _LikeQuoted(pattern) + '%', escape='\\') def ISNULL(expr): return SQLOp("IS", expr, None) |
From: <sub...@co...> - 2009-09-20 15:50:35
|
Author: phd Date: 2009-09-20 09:50:22 -0600 (Sun, 20 Sep 2009) New Revision: 3979 Modified: SQLObject/branches/0.10/sqlobject/sqlbuilder.py Log: LIKE ... ESCAPE ... Modified: SQLObject/branches/0.10/sqlobject/sqlbuilder.py =================================================================== --- SQLObject/branches/0.10/sqlobject/sqlbuilder.py 2009-09-20 15:42:20 UTC (rev 3978) +++ SQLObject/branches/0.10/sqlobject/sqlbuilder.py 2009-09-20 15:50:22 UTC (rev 3979) @@ -1130,11 +1130,17 @@ class LIKE(SQLExpression): op = "LIKE" - def __init__(self, expr, string): + def __init__(self, expr, string, escape=None): self.expr = expr self.string = string + self.escape = escape def __sqlrepr__(self, db): - return "(%s %s (%s))" % (sqlrepr(self.expr, db), self.op, sqlrepr(self.string, db)) + escape = self.escape + like = "%s %s (%s)" % (sqlrepr(self.expr, db), self.op, sqlrepr(self.string, db)) + if escape is None: + return "(%s)" % like + else: + return "(%s ESCAPE '%s')" % (like, escape) def components(self): return [self.expr, self.string] def execute(self, executor): |
From: <sub...@co...> - 2009-09-20 15:42:36
|
Author: phd Date: 2009-09-20 09:42:20 -0600 (Sun, 20 Sep 2009) New Revision: 3978 Modified: SQLObject/branches/0.10/sqlobject/sqlbuilder.py Log: Refactored RLIKE. Modified: SQLObject/branches/0.10/sqlobject/sqlbuilder.py =================================================================== --- SQLObject/branches/0.10/sqlobject/sqlbuilder.py 2009-09-14 16:07:38 UTC (rev 3977) +++ SQLObject/branches/0.10/sqlobject/sqlbuilder.py 2009-09-20 15:42:20 UTC (rev 3978) @@ -1152,15 +1152,16 @@ class RLIKE(LIKE): op = "RLIKE" + op_db = { + 'firebird': 'RLIKE', + 'maxdb': 'RLIKE', + 'mysql': 'RLIKE', + 'postgres': '~', + 'sqlite': 'REGEXP' + } + def _get_op(self, db): - if db in ('mysql', 'maxdb', 'firebird'): - return "RLIKE" - elif db == 'sqlite': - return "REGEXP" - elif db == 'postgres': - return "~" - else: - return "LIKE" + return self.op_db.get(db, 'LIKE') def __sqlrepr__(self, db): return "(%s %s (%s))" % ( sqlrepr(self.expr, db), self._get_op(db), sqlrepr(self.string, db) |
From: <sub...@co...> - 2009-09-14 16:07:45
|
Author: phd Date: 2009-09-14 10:07:38 -0600 (Mon, 14 Sep 2009) New Revision: 3977 Modified: SQLObject/trunk/docs/News.txt SQLObject/trunk/docs/SQLObject.txt SQLObject/trunk/sqlobject/mssql/mssqlconnection.py Log: The user can choose a DB API driver for MSSQL by using a "backend" parameter in DB URI or MSSQLConnection. Possible backends are: "adodb" (alias "adodbapi") and "pymssql". Default is to test adodbapi and pymssql in that order. Modified: SQLObject/trunk/docs/News.txt =================================================================== --- SQLObject/trunk/docs/News.txt 2009-09-09 19:54:43 UTC (rev 3976) +++ SQLObject/trunk/docs/News.txt 2009-09-14 16:07:38 UTC (rev 3977) @@ -28,6 +28,11 @@ WARNING: API change! PostgresConnection's parameter "usePygresql" is now replaced with "backend=pygresql". +* The user can choose a DB API driver for MSSQL by using a "backend" + parameter in DB URI or MSSQLConnection. Possible backends are: "adodb" + (alias "adodbapi") and "pymssql". Default is to test adodbapi and pymssql + in that order. + * alternateMethodName is defined for all unique fields, not only alternateID; this makes SQLObject create .by*() methods for all unique fields. Modified: SQLObject/trunk/docs/SQLObject.txt =================================================================== --- SQLObject/trunk/docs/SQLObject.txt 2009-09-09 19:54:43 UTC (rev 3976) +++ SQLObject/trunk/docs/SQLObject.txt 2009-09-14 16:07:38 UTC (rev 3977) @@ -1845,6 +1845,11 @@ .. _pymssql: http://pymssql.sourceforge.net/ .. _adodbapi: http://adodbapi.sourceforge.net/ +The user can choose a DB API driver for MSSQL by using a "backend" +parameter in DB URI or MSSQLConnection. Possible backends are: "adodb" +(alias "adodbapi") and "pymssql". Default is to test adodbapi and pymssql +in that order. + Events (signals) ================ Modified: SQLObject/trunk/sqlobject/mssql/mssqlconnection.py =================================================================== --- SQLObject/trunk/sqlobject/mssql/mssqlconnection.py 2009-09-09 19:54:43 UTC (rev 3976) +++ SQLObject/trunk/sqlobject/mssql/mssqlconnection.py 2009-09-14 16:07:38 UTC (rev 3977) @@ -10,10 +10,19 @@ def __init__(self, db, user, password='', host='localhost', autoCommit=0, **kw): - try: + backend = kw.pop('backend', None) + if backend is None: + try: + import adodbapi as sqlmodule + except ImportError: + import pymssql as sqlmodule + elif backend in ('adodb', 'adodbapi'): import adodbapi as sqlmodule - except ImportError: + elif backend == 'pymssql ': import pymssql as sqlmodule + else: + raise ValueError('Unknown MSSQL backend "%s", expected adodb or pymssql' % backend) + self.module = sqlmodule if sqlmodule.__name__ == 'adodbapi': self.dbconnection = sqlmodule.connect @@ -54,7 +63,6 @@ self.password = password self.limit_re = re.compile('^\s*(select )(.*)', re.IGNORECASE) self.password = password - self.module = sqlmodule self._can_use_max_types = None DBAPI.__init__(self, **kw) |
From: SourceForge.net <no...@so...> - 2009-09-09 19:55:24
|
Patches item #2855422, was opened at 2009-09-09 23:13 Message generated for change (Settings changed) made by phd You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540674&aid=2855422&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: None Group: None Status: Closed Resolution: Accepted Priority: 5 Private: No Submitted By: Matthew Wright (mcw_chi) Assigned to: Oleg Broytmann (phd) Summary: Sybase tables with identity column fire two identity_inserts Initial Comment: All tables with an identity column will cause the sybaseconnection to execute two 'SET IDENTITY_INSERT tablename on/off' for every row insert, even if the user is not supplying the id. The set identity_insert command requires object ownership or sa privs. Attaching a patch that allows inserts to work for the usual case of not supplying the identity column. ---------------------------------------------------------------------- Comment By: Oleg Broytmann (phd) Date: 2009-09-09 23:55 Message: Applied and committed in the revisions 3973-3976 (branches 0.10, 0.11 and the trunk.) Thank you! ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540674&aid=2855422&group_id=74338 |
From: SourceForge.net <no...@so...> - 2009-09-09 19:55:14
|
Patches item #2855422, was opened at 2009-09-09 23:13 Message generated for change (Comment added) made by phd You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540674&aid=2855422&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: None Group: None >Status: Closed >Resolution: Accepted Priority: 5 Private: No Submitted By: Matthew Wright (mcw_chi) Assigned to: Oleg Broytmann (phd) >Summary: Sybase tables with identity column fire two identity_inserts Initial Comment: All tables with an identity column will cause the sybaseconnection to execute two 'SET IDENTITY_INSERT tablename on/off' for every row insert, even if the user is not supplying the id. The set identity_insert command requires object ownership or sa privs. Attaching a patch that allows inserts to work for the usual case of not supplying the identity column. ---------------------------------------------------------------------- >Comment By: Oleg Broytmann (phd) Date: 2009-09-09 23:55 Message: Applied and committed in the revisions 3973-3976 (branches 0.10, 0.11 and the trunk.) Thank you! ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540674&aid=2855422&group_id=74338 |
From: <sub...@co...> - 2009-09-09 19:54:53
|
Author: phd Date: 2009-09-09 13:54:43 -0600 (Wed, 09 Sep 2009) New Revision: 3976 Modified: SQLObject/trunk/docs/News.txt SQLObject/trunk/sqlobject/sybase/sybaseconnection.py Log: Merged a bugfix from rev. 3974 from branch 0.11: Sybase tables with identity column fire two identity_inserts. Modified: SQLObject/trunk/docs/News.txt =================================================================== --- SQLObject/trunk/docs/News.txt 2009-09-09 19:52:10 UTC (rev 3975) +++ SQLObject/trunk/docs/News.txt 2009-09-09 19:54:43 UTC (rev 3976) @@ -43,9 +43,14 @@ * Removed all deprecated attribute and functions. -SQLObject 0.11 -============== +SQLObject 0.11.1 +================ +* A number of changes ported from `SQLObject 0.10.7`_. + +SQLObject 0.11.0 +================ + Released 12 Aug 2009 Features & Interface @@ -91,6 +96,11 @@ * Changed the order of testing of SQLite modules - look for external PySQLite2 before sqlite3. +SQLObject 0.10.7 +================ + +* Fixed a bug: Sybase tables with identity column fire two identity_inserts. + SQLObject 0.10.6 ================ Modified: SQLObject/trunk/sqlobject/sybase/sybaseconnection.py =================================================================== --- SQLObject/trunk/sqlobject/sybase/sybaseconnection.py 2009-09-09 19:52:10 UTC (rev 3975) +++ SQLObject/trunk/sqlobject/sybase/sybaseconnection.py 2009-09-09 19:54:43 UTC (rev 3976) @@ -76,17 +76,16 @@ values = [id] + values has_identity = self._hasIdentity(conn, table) - if has_identity: - if id is not None: - c.execute('SET IDENTITY_INSERT %s ON' % table) - else: - c.execute('SET IDENTITY_INSERT %s OFF' % table) + identity_insert_on = False + if has_identity and (id is not None): + identity_insert_on = True + c.execute('SET IDENTITY_INSERT %s ON' % table) q = self._insertSQL(table, names, values) if self.debug: print 'QueryIns: %s' % q c.execute(q) - if has_identity: + if has_identity and identity_insert_on: c.execute('SET IDENTITY_INSERT %s OFF' % table) if id is None: id = self.insert_id(conn) |
From: <sub...@co...> - 2009-09-09 19:52:32
|
Author: phd Date: 2009-09-09 13:52:10 -0600 (Wed, 09 Sep 2009) New Revision: 3975 Modified: SQLObject/branches/0.11/docs/News.txt SQLObject/branches/0.11/sqlobject/sybase/sybaseconnection.py Log: Merged a bugfix from rev. 3973 from branch 0.10: Sybase tables with identity column fire two identity_inserts. Modified: SQLObject/branches/0.11/docs/News.txt =================================================================== --- SQLObject/branches/0.11/docs/News.txt 2009-09-09 19:48:16 UTC (rev 3974) +++ SQLObject/branches/0.11/docs/News.txt 2009-09-09 19:52:10 UTC (rev 3975) @@ -7,6 +7,11 @@ .. _start: +SQLObject 0.11.1 +================ + +* A number of changes ported from `SQLObject 0.10.7`_. + SQLObject 0.11.0 ================ @@ -55,6 +60,11 @@ * Changed the order of testing of SQLite modules - look for external PySQLite2 before sqlite3. +SQLObject 0.10.7 +================ + +* Fixed a bug: Sybase tables with identity column fire two identity_inserts. + SQLObject 0.10.6 ================ Modified: SQLObject/branches/0.11/sqlobject/sybase/sybaseconnection.py =================================================================== --- SQLObject/branches/0.11/sqlobject/sybase/sybaseconnection.py 2009-09-09 19:48:16 UTC (rev 3974) +++ SQLObject/branches/0.11/sqlobject/sybase/sybaseconnection.py 2009-09-09 19:52:10 UTC (rev 3975) @@ -76,17 +76,16 @@ values = [id] + values has_identity = self._hasIdentity(conn, table) - if has_identity: - if id is not None: - c.execute('SET IDENTITY_INSERT %s ON' % table) - else: - c.execute('SET IDENTITY_INSERT %s OFF' % table) + identity_insert_on = False + if has_identity and (id is not None): + identity_insert_on = True + c.execute('SET IDENTITY_INSERT %s ON' % table) q = self._insertSQL(table, names, values) if self.debug: print 'QueryIns: %s' % q c.execute(q) - if has_identity: + if has_identity and identity_insert_on: c.execute('SET IDENTITY_INSERT %s OFF' % table) if id is None: id = self.insert_id(conn) |