sqlobject-cvs Mailing List for SQLObject (Page 28)
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...> - 2013-04-20 11:07:23
|
Author: phd Date: Sat Apr 20 04:24:27 2013 New Revision: 4584 Log: print => printDebug to avoid problems with unicode Modified: SQLObject/trunk/sqlobject/mssql/mssqlconnection.py SQLObject/trunk/sqlobject/sybase/sybaseconnection.py Modified: SQLObject/trunk/sqlobject/mssql/mssqlconnection.py ============================================================================== --- SQLObject/trunk/sqlobject/mssql/mssqlconnection.py Wed Apr 10 14:25:03 2013 (r4583) +++ SQLObject/trunk/sqlobject/mssql/mssqlconnection.py Sat Apr 20 04:24:27 2013 (r4584) @@ -140,7 +140,7 @@ q = self._insertSQL(table, names, values) if self.debug: - print 'QueryIns: %s' % q + self.printDebug(conn, q, 'QueryIns') c.execute(q) if has_identity: c.execute('SET IDENTITY_INSERT %s OFF' % table) Modified: SQLObject/trunk/sqlobject/sybase/sybaseconnection.py ============================================================================== --- SQLObject/trunk/sqlobject/sybase/sybaseconnection.py Wed Apr 10 14:25:03 2013 (r4583) +++ SQLObject/trunk/sqlobject/sybase/sybaseconnection.py Sat Apr 20 04:24:27 2013 (r4584) @@ -83,7 +83,7 @@ q = self._insertSQL(table, names, values) if self.debug: - print 'QueryIns: %s' % q + self.printDebug(conn, q, 'QueryIns') c.execute(q) if has_identity and identity_insert_on: c.execute('SET IDENTITY_INSERT %s OFF' % table) |
From: <sub...@co...> - 2013-02-10 18:51:04
|
Author: phd Date: Sun Feb 10 11:50:54 2013 New Revision: 4582 Log: Made the test works in all databases Modified: SQLObject/trunk/sqlobject/tests/test_identity.py Modified: SQLObject/trunk/sqlobject/tests/test_identity.py ============================================================================== --- SQLObject/trunk/sqlobject/tests/test_identity.py Tue Feb 5 13:23:32 2013 (r4581) +++ SQLObject/trunk/sqlobject/tests/test_identity.py Sun Feb 10 11:50:54 2013 (r4582) @@ -9,10 +9,8 @@ n = IntCol() def test_identity(): - if getConnection().dbName != "mssql": - return - - # create table + # (re)create table + TestIdentity.dropTable(connection=getConnection(), ifExists=True) setupClass(TestIdentity) # insert without giving identity @@ -22,7 +20,7 @@ assert(i1get.n == 100) # insert while giving identity - i1 = TestIdentity(id=2, n=200) + i2 = TestIdentity(id=2, n=200) # verify result i2get = TestIdentity.get(2) assert(i2get.n == 200) |
From: <sub...@co...> - 2013-02-05 20:23:41
|
Author: phd Date: Tue Feb 5 13:23:32 2013 New Revision: 4581 Log: Changed the way to get if the table has identity in MS SQL Added: SQLObject/trunk/sqlobject/tests/test_identity.py Modified: SQLObject/trunk/docs/Authors.txt SQLObject/trunk/docs/News.txt SQLObject/trunk/sqlobject/mssql/mssqlconnection.py Modified: SQLObject/trunk/docs/Authors.txt ============================================================================== --- SQLObject/trunk/docs/Authors.txt Sun Feb 3 04:23:15 2013 (r4580) +++ SQLObject/trunk/docs/Authors.txt Tue Feb 5 13:23:32 2013 (r4581) @@ -26,6 +26,7 @@ * Daniel Fetchinson <fetchinson at googlemail.com> * Neil Muller <drnlmuller+sqlobject at gmail.com> * Petr Jakes <petr.jakes at tpc.cz> +* Andrew Ziem <ahz001 at gmail.com> * Oleg Broytman <ph...@ph...> .. image:: http://sflogo.sourceforge.net/sflogo.php?group_id=74338&type=10 Modified: SQLObject/trunk/docs/News.txt ============================================================================== --- SQLObject/trunk/docs/News.txt Sun Feb 3 04:23:15 2013 (r4580) +++ SQLObject/trunk/docs/News.txt Tue Feb 5 13:23:32 2013 (r4581) @@ -18,7 +18,9 @@ * Optimization in PostgresConnection: use INSERT...RETURNING id to get the autoincremented id in one query instead of two - (SELECT id + INSERT). + (INSERT + SELECT id). + +* Changed the way to get if the table has identity in MS SQL. SQLObject 1.3.2 =============== Modified: SQLObject/trunk/sqlobject/mssql/mssqlconnection.py ============================================================================== --- SQLObject/trunk/sqlobject/mssql/mssqlconnection.py Sun Feb 3 04:23:15 2013 (r4580) +++ SQLObject/trunk/sqlobject/mssql/mssqlconnection.py Tue Feb 5 13:23:32 2013 (r4581) @@ -100,13 +100,10 @@ return con HAS_IDENTITY = """ - SELECT col.name, col.status, obj.name - FROM syscolumns col - JOIN sysobjects obj - ON obj.id = col.id - WHERE obj.name = '%s' - and col.autoval is not null - + select 1 + from INFORMATION_SCHEMA.COLUMNS + where TABLE_NAME = '%s' + and COLUMNPROPERTY(object_id(TABLE_NAME), COLUMN_NAME, 'IsIdentity') = 1 """ def _hasIdentity(self, conn, table): query = self.HAS_IDENTITY % table Added: SQLObject/trunk/sqlobject/tests/test_identity.py ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ SQLObject/trunk/sqlobject/tests/test_identity.py Tue Feb 5 13:23:32 2013 (r4581) @@ -0,0 +1,28 @@ +from sqlobject import * +from sqlobject.tests.dbtest import * + +######################################## +## Identity (MS SQL) +######################################## + +class TestIdentity(SQLObject): + n = IntCol() + +def test_identity(): + if getConnection().dbName != "mssql": + return + + # create table + setupClass(TestIdentity) + + # insert without giving identity + i1 = TestIdentity(n=100) + # verify result + i1get = TestIdentity.get(1) + assert(i1get.n == 100) + + # insert while giving identity + i1 = TestIdentity(id=2, n=200) + # verify result + i2get = TestIdentity.get(2) + assert(i2get.n == 200) |
From: <sub...@co...> - 2013-02-03 11:23:22
|
Author: phd Date: Sun Feb 3 04:23:15 2013 New Revision: 4580 Log: Merged revision 4578 from branch 1.2: corrected grammar Modified: SQLObject/trunk/docs/SQLObject.txt Modified: SQLObject/trunk/docs/SQLObject.txt ============================================================================== --- SQLObject/trunk/docs/SQLObject.txt Sun Feb 3 04:22:51 2013 (r4579) +++ SQLObject/trunk/docs/SQLObject.txt Sun Feb 3 04:23:15 2013 (r4580) @@ -772,8 +772,9 @@ .. _UnicodeCol: `Column Types`_ -The following attributes provide introspection but should not be set or -directly - see `Runtime Column and Join Changes`_ for dynamically modifying these class elements. +The following attributes provide introspection but should not be set directly - +see `Runtime Column and Join Changes`_ for dynamically modifying these class +elements. `columns`: A dictionary of ``{columnName: anSOColInstance}``. You can get |
From: <sub...@co...> - 2013-02-03 11:22:58
|
Author: phd Date: Sun Feb 3 04:22:51 2013 New Revision: 4579 Log: Merged revision 4578 from branch 1.2: corrected grammar Modified: SQLObject/branches/1.3/docs/SQLObject.txt Modified: SQLObject/branches/1.3/docs/SQLObject.txt ============================================================================== --- SQLObject/branches/1.3/docs/SQLObject.txt Sun Feb 3 04:21:36 2013 (r4578) +++ SQLObject/branches/1.3/docs/SQLObject.txt Sun Feb 3 04:22:51 2013 (r4579) @@ -772,8 +772,9 @@ .. _UnicodeCol: `Column Types`_ -The following attributes provide introspection but should not be set or -directly - see `Runtime Column and Join Changes`_ for dynamically modifying these class elements. +The following attributes provide introspection but should not be set directly - +see `Runtime Column and Join Changes`_ for dynamically modifying these class +elements. `columns`: A dictionary of ``{columnName: anSOColInstance}``. You can get |
From: <sub...@co...> - 2013-02-03 11:21:44
|
Author: phd Date: Sun Feb 3 04:21:36 2013 New Revision: 4578 Log: Corrected grammar Modified: SQLObject/branches/1.2/docs/SQLObject.txt Modified: SQLObject/branches/1.2/docs/SQLObject.txt ============================================================================== --- SQLObject/branches/1.2/docs/SQLObject.txt Sun Feb 3 04:17:07 2013 (r4577) +++ SQLObject/branches/1.2/docs/SQLObject.txt Sun Feb 3 04:21:36 2013 (r4578) @@ -772,8 +772,9 @@ .. _UnicodeCol: `Column Types`_ -The following attributes provide introspection but should not be set or -directly - see `Runtime Column and Join Changes`_ for dynamically modifying these class elements. +The following attributes provide introspection but should not be set directly - +see `Runtime Column and Join Changes`_ for dynamically modifying these class +elements. `columns`: A dictionary of ``{columnName: anSOColInstance}``. You can get |
From: <sub...@co...> - 2013-02-03 11:17:14
|
Author: phd Date: Sun Feb 3 04:17:07 2013 New Revision: 4577 Log: Merged revision 4575 from branch 1.2: CodeSpeak.net has stopped hosting code Modified: SQLObject/trunk/docs/DeveloperGuide.txt SQLObject/trunk/docs/links.txt Modified: SQLObject/trunk/docs/DeveloperGuide.txt ============================================================================== --- SQLObject/trunk/docs/DeveloperGuide.txt Sun Feb 3 04:16:36 2013 (r4576) +++ SQLObject/trunk/docs/DeveloperGuide.txt Sun Feb 3 04:17:07 2013 (r4577) @@ -144,12 +144,11 @@ Tests are important. Tests keep everything from falling apart. All new additions should have tests. -Testing uses `py.test`__, an alternative to ``unittest``. It is -available via subversion at http://codespeak.net/svn/py/dist. Read -its `getting started`_ document for more. +Testing uses py.test, an alternative to ``unittest``. It is available at +http://pytest.org/ and http://pypi.python.org/pypi/pytest. Read its `getting +started`_ document for more. -.. __: http://codespeak.net/py/current/doc/test.html -.. _getting started: http://codespeak.net/py/dist/test.html#starting-point-py-test-command-line-tool +.. _getting started: http://pytest.org/latest/getting-started.html To actually run the test, you have to give it a database to connect to. You do so with the option ``-D``. You can either give a complete URI or @@ -175,7 +174,7 @@ ``inserts`` function that can create instances for you, and a couple miscellaneous functions. -.. _raises: http://codespeak.net/py/current/doc/test.html#id4 +.. _raises: http://pytest.org/latest/assert.html#assertions-about-expected-exceptions If you submit a patch or implement a feature without a test, I'll be Modified: SQLObject/trunk/docs/links.txt ============================================================================== --- SQLObject/trunk/docs/links.txt Sun Feb 3 04:16:36 2013 (r4576) +++ SQLObject/trunk/docs/links.txt Sun Feb 3 04:17:07 2013 (r4577) @@ -29,9 +29,6 @@ Open Source Projects -------------------- -* `sqlos Zope 3 SQLObject integration - <http://codespeak.net/z3/sqlos/>`_. - * `TurboGears <http://turbogears.org/>`_ Web Framework: also integrates with SQLObject. |
From: <sub...@co...> - 2013-02-03 11:16:44
|
Author: phd Date: Sun Feb 3 04:16:36 2013 New Revision: 4576 Log: Merged revision 4575 from branch 1.2: CodeSpeak.net has stopped hosting code Modified: SQLObject/branches/1.3/docs/DeveloperGuide.txt SQLObject/branches/1.3/docs/links.txt Modified: SQLObject/branches/1.3/docs/DeveloperGuide.txt ============================================================================== --- SQLObject/branches/1.3/docs/DeveloperGuide.txt Sun Feb 3 04:12:43 2013 (r4575) +++ SQLObject/branches/1.3/docs/DeveloperGuide.txt Sun Feb 3 04:16:36 2013 (r4576) @@ -144,12 +144,11 @@ Tests are important. Tests keep everything from falling apart. All new additions should have tests. -Testing uses `py.test`__, an alternative to ``unittest``. It is -available via subversion at http://codespeak.net/svn/py/dist. Read -its `getting started`_ document for more. +Testing uses py.test, an alternative to ``unittest``. It is available at +http://pytest.org/ and http://pypi.python.org/pypi/pytest. Read its `getting +started`_ document for more. -.. __: http://codespeak.net/py/current/doc/test.html -.. _getting started: http://codespeak.net/py/dist/test.html#starting-point-py-test-command-line-tool +.. _getting started: http://pytest.org/latest/getting-started.html To actually run the test, you have to give it a database to connect to. You do so with the option ``-D``. You can either give a complete URI or @@ -175,7 +174,7 @@ ``inserts`` function that can create instances for you, and a couple miscellaneous functions. -.. _raises: http://codespeak.net/py/current/doc/test.html#id4 +.. _raises: http://pytest.org/latest/assert.html#assertions-about-expected-exceptions If you submit a patch or implement a feature without a test, I'll be Modified: SQLObject/branches/1.3/docs/links.txt ============================================================================== --- SQLObject/branches/1.3/docs/links.txt Sun Feb 3 04:12:43 2013 (r4575) +++ SQLObject/branches/1.3/docs/links.txt Sun Feb 3 04:16:36 2013 (r4576) @@ -29,9 +29,6 @@ Open Source Projects -------------------- -* `sqlos Zope 3 SQLObject integration - <http://codespeak.net/z3/sqlos/>`_. - * `TurboGears <http://turbogears.org/>`_ Web Framework: also integrates with SQLObject. |
From: <sub...@co...> - 2013-02-03 11:12:53
|
Author: phd Date: Sun Feb 3 04:12:43 2013 New Revision: 4575 Log: CodeSpeak.net has stopped hosting code projects Py.test got its own domain pytest.org. SQLOS died and disappeared from the net. Modified: SQLObject/branches/1.2/docs/DeveloperGuide.txt SQLObject/branches/1.2/docs/links.txt Modified: SQLObject/branches/1.2/docs/DeveloperGuide.txt ============================================================================== --- SQLObject/branches/1.2/docs/DeveloperGuide.txt Sat Jan 19 11:19:02 2013 (r4574) +++ SQLObject/branches/1.2/docs/DeveloperGuide.txt Sun Feb 3 04:12:43 2013 (r4575) @@ -144,12 +144,11 @@ Tests are important. Tests keep everything from falling apart. All new additions should have tests. -Testing uses `py.test`__, an alternative to ``unittest``. It is -available via subversion at http://codespeak.net/svn/py/dist. Read -its `getting started`_ document for more. +Testing uses py.test, an alternative to ``unittest``. It is available at +http://pytest.org/ and http://pypi.python.org/pypi/pytest. Read its `getting +started`_ document for more. -.. __: http://codespeak.net/py/current/doc/test.html -.. _getting started: http://codespeak.net/py/dist/test.html#starting-point-py-test-command-line-tool +.. _getting started: http://pytest.org/latest/getting-started.html To actually run the test, you have to give it a database to connect to. You do so with the option ``-D``. You can either give a complete URI or @@ -175,7 +174,7 @@ ``inserts`` function that can create instances for you, and a couple miscellaneous functions. -.. _raises: http://codespeak.net/py/current/doc/test.html#id4 +.. _raises: http://pytest.org/latest/assert.html#assertions-about-expected-exceptions If you submit a patch or implement a feature without a test, I'll be Modified: SQLObject/branches/1.2/docs/links.txt ============================================================================== --- SQLObject/branches/1.2/docs/links.txt Sat Jan 19 11:19:02 2013 (r4574) +++ SQLObject/branches/1.2/docs/links.txt Sun Feb 3 04:12:43 2013 (r4575) @@ -29,9 +29,6 @@ Open Source Projects -------------------- -* `sqlos Zope 3 SQLObject integration - <http://codespeak.net/z3/sqlos/>`_. - * `TurboGears <http://turbogears.org/>`_ Web Framework: also integrates with SQLObject. |
From: <sub...@co...> - 2013-01-19 18:37:20
|
Author: phd Date: Sat Jan 19 11:06:10 2013 New Revision: 4571 Log: Fixed a problem in test_paste - connection is None Modified: SQLObject/branches/1.2/sqlobject/col.py Modified: SQLObject/branches/1.2/sqlobject/col.py ============================================================================== --- SQLObject/branches/1.2/sqlobject/col.py Sat Dec 29 13:10:52 2012 (r4570) +++ SQLObject/branches/1.2/sqlobject/col.py Sat Jan 19 11:06:10 2013 (r4571) @@ -505,12 +505,12 @@ return None try: connection = state.connection or state.soObject._connection + binaryType = connection._binaryType except AttributeError: dbEncoding = "ascii" binaryType = type(None) # Just a simple workaround else: dbEncoding = getattr(connection, "dbEncoding", None) or "ascii" - binaryType = connection._binaryType if isinstance(value, unicode): return value.encode(dbEncoding) if self.dataType and isinstance(value, self.dataType): |
From: <sub...@co...> - 2013-01-19 18:37:14
|
Author: phd Date: Sat Jan 19 11:10:09 2013 New Revision: 4573 Log: Merged revision 4571 from branch 1.2: fixed a problem in test_paste - connection is None Modified: SQLObject/trunk/sqlobject/col.py Modified: SQLObject/trunk/sqlobject/col.py ============================================================================== --- SQLObject/trunk/sqlobject/col.py Sat Jan 19 11:09:27 2013 (r4572) +++ SQLObject/trunk/sqlobject/col.py Sat Jan 19 11:10:09 2013 (r4573) @@ -505,12 +505,12 @@ return None try: connection = state.connection or state.soObject._connection + binaryType = connection._binaryType except AttributeError: dbEncoding = "ascii" binaryType = type(None) # Just a simple workaround else: dbEncoding = getattr(connection, "dbEncoding", None) or "ascii" - binaryType = connection._binaryType if isinstance(value, unicode): return value.encode(dbEncoding) if self.dataType and isinstance(value, self.dataType): |
From: <sub...@co...> - 2013-01-19 18:37:08
|
Author: phd Date: Sat Jan 19 11:09:27 2013 New Revision: 4572 Log: Merged revision 4571 from branch 1.2: fixed a problem in test_paste - connection is None Modified: SQLObject/branches/1.3/sqlobject/col.py Modified: SQLObject/branches/1.3/sqlobject/col.py ============================================================================== --- SQLObject/branches/1.3/sqlobject/col.py Sat Jan 19 11:06:10 2013 (r4571) +++ SQLObject/branches/1.3/sqlobject/col.py Sat Jan 19 11:09:27 2013 (r4572) @@ -505,12 +505,12 @@ return None try: connection = state.connection or state.soObject._connection + binaryType = connection._binaryType except AttributeError: dbEncoding = "ascii" binaryType = type(None) # Just a simple workaround else: dbEncoding = getattr(connection, "dbEncoding", None) or "ascii" - binaryType = connection._binaryType if isinstance(value, unicode): return value.encode(dbEncoding) if self.dataType and isinstance(value, self.dataType): |
From: <sub...@co...> - 2013-01-19 18:19:09
|
Author: phd Date: Sat Jan 19 11:19:02 2013 New Revision: 4574 Log: Use INSERT...RETURNING id Optimization in PostgresConnection: use INSERT...RETURNING id to get the autoincremented id in one query instead of two (SELECT id + INSERT). The feature requires PostgreSQL 8.2+. Modified: SQLObject/trunk/docs/News.txt SQLObject/trunk/sqlobject/postgres/pgconnection.py Modified: SQLObject/trunk/docs/News.txt ============================================================================== --- SQLObject/trunk/docs/News.txt Sat Jan 19 11:10:09 2013 (r4573) +++ SQLObject/trunk/docs/News.txt Sat Jan 19 11:19:02 2013 (r4574) @@ -10,6 +10,16 @@ SQLObject (trunk) ================= +Features & Interface +-------------------- + +* Support for PostgreSQL 8.1 is dropped. The minimal supported version of + PostgreSQL is 8.2 now. + +* Optimization in PostgresConnection: use INSERT...RETURNING id + to get the autoincremented id in one query instead of two + (SELECT id + INSERT). + SQLObject 1.3.2 =============== Modified: SQLObject/trunk/sqlobject/postgres/pgconnection.py ============================================================================== --- SQLObject/trunk/sqlobject/postgres/pgconnection.py Sat Jan 19 11:10:09 2013 (r4573) +++ SQLObject/trunk/sqlobject/postgres/pgconnection.py Sat Jan 19 11:19:02 2013 (r4574) @@ -189,15 +189,20 @@ sequenceName = soInstance.sqlmeta.idSequence or \ '%s_%s_seq' % (table, idName) c = conn.cursor() + if id is not None: + names = [idName] + names + values = [id] + values + if names and values: + q = self._insertSQL(table, names, values) + else: + q = "INSERT INTO %s DEFAULT VALUES" % table if id is None: - self._executeRetry(conn, c, "SELECT NEXTVAL('%s')" % sequenceName) - id = c.fetchone()[0] - names = [idName] + names - values = [id] + values - q = self._insertSQL(table, names, values) + q += " RETURNING " + idName if self.debug: self.printDebug(conn, q, 'QueryIns') self._executeRetry(conn, c, q) + if id is None: + id = c.fetchone()[0] if self.debugOutput: self.printDebug(conn, id, 'QueryIns', 'result') return id |
From: SourceForge.net <no...@so...> - 2013-01-18 19:27:20
|
Patches item #3601405, was opened at 2013-01-18 10:39 Message generated for change (Comment added) made by phd You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540674&aid=3601405&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: Ken Lalonde (kenlalonde) >Assigned to: Oleg Broytman (phd) Summary: Use "insert ... returning id" with postgres Initial Comment: When inserting records with driver postgres, it's faster to use the single statement "INSERT ... RETURNING id", rather than 2 statements -- one to get the current sequence value (and increment it), and another to do the insert. Patch is against SQLObject-1.2.4/sqlobject/postgres/pgconnection.py. ---------------------------------------------------------------------- >Comment By: Oleg Broytman (phd) Date: 2013-01-18 11:27 Message: Good idea, thanks! Will test it. It's a major change (SQLObject currently supports Postgres back to 8.1 while INSERT/RETURNING requires at least 8.2) so I can only apply it to the trunk. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540674&aid=3601405&group_id=74338 |
From: SourceForge.net <no...@so...> - 2013-01-18 18:39:04
|
Patches item #3601405, was opened at 2013-01-18 10:39 Message generated for change (Tracker Item Submitted) made by kenlalonde You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540674&aid=3601405&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: Ken Lalonde (kenlalonde) Assigned to: Nobody/Anonymous (nobody) Summary: Use "insert ... returning id" with postgres Initial Comment: When inserting records with driver postgres, it's faster to use the single statement "INSERT ... RETURNING id", rather than 2 statements -- one to get the current sequence value (and increment it), and another to do the insert. Patch is against SQLObject-1.2.4/sqlobject/postgres/pgconnection.py. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540674&aid=3601405&group_id=74338 |
From: SourceForge.net <no...@so...> - 2012-12-08 15:00:56
|
Patches item #3588789, was opened at 2012-11-20 12:30 Message generated for change (Comment added) made by phd You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540674&aid=3588789&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: Invalid Priority: 5 Private: No Submitted By: Darren Janeczek (darren_janeczek) Assigned to: Oleg Broytman (phd) Summary: Columns with keyword names are problematic for some queries Initial Comment: Assume you create a SQLObject out of an existing table that happens to have a column named "group". This crude patch will protect most queries that involve columns with names like "group" etc, by using a function that wraps the names with back quotes: `group`. NOT THOROUGHLY TESTED. ---------------------------------------------------------------------- >Comment By: Oleg Broytman (phd) Date: 2012-12-08 07:00 Message: Alas, doesn't work too. SQLite: cur.execute('INSERT INTO test (test.name) VALUES (?)', ('text',)) pysqlite2.dbapi2.OperationalError: near ".": syntax error PostgreSQL: cur.execute('INSERT INTO test VALUES (test.id, test.value)', (1, 'test')) psycopg2.ProgrammingError: invalid reference to FROM-clause entry for table "tes t" LINE 1: INSERT INTO test VALUES (test.id, test.value) ^ HINT: There is an entry for table "test", but it cannot be referenced from this part of the query. ---------------------------------------------------------------------- Comment By: Oleg Broytman (phd) Date: 2012-11-23 10:26 Message: Using a complex set of shell wrapper over py.test. The central part is like the following: for test in "$@"; do py.test "$test" -D "$TESTDB_URI" done If you are interested in all details I can send you an archive of all shell scripts I use to maintain SQLObject. Give me your email; if you don't want to publish it -- send it to me by a private message. I'm going to try nose. The usage should be something like python -c "import nose; nose.run_exit()" ---------------------------------------------------------------------- Comment By: Darren Janeczek (darren_janeczek) Date: 2012-11-23 09:48 Message: Thanks. How do you invoke the tests anyway? ---------------------------------------------------------------------- Comment By: Oleg Broytman (phd) Date: 2012-11-23 07:53 Message: Interesting approach. I'll have a deeper look into into it and fix tests if possible. ---------------------------------------------------------------------- Comment By: Darren Janeczek (darren_janeczek) Date: 2012-11-23 07:30 Message: I wrote a simplistic test which covers some of the functionality. Unfortunately, I wasn't able to invoke the testing suite, and I won't have time to dive too deeply into the docs for a while. The new solution should be more generally compatible. ---------------------------------------------------------------------- Comment By: Darren Janeczek (darren_janeczek) Date: 2012-11-21 09:24 Message: (Removed invalid patch. Will try again shortly) ---------------------------------------------------------------------- Comment By: Darren Janeczek (darren_janeczek) Date: 2012-11-20 17:33 Message: Another possibly more generally compatible solution would be to explicitly state table_name.field_name for each. Note however that the use of "`" is coded in a central function (escape_keywords) and could easily be changed to get the quotes from the db-specific abstraction. I have a few deadlines to fight and don't know the inner workings to do it efficiently at this time. ---------------------------------------------------------------------- Comment By: Darren Janeczek (darren_janeczek) Date: 2012-11-20 17:29 Message: This patch actually causes another problem: `table_name.field_name` is produced instead of `table_name`.`field_name` My work around was to change the method to: def escape_keywords(keyword): #Use this function to allow for the potential of field items with SQL syntax if '.' in keyword: #The dot implies that this item contains the table name -- making it legal return keyword return "`%s`" % (keyword) ---------------------------------------------------------------------- Comment By: Oleg Broytman (phd) Date: 2012-11-20 12:43 Message: Thanks. Alas, the patch quotes special names with backticks which AFAIK are only valid on MySQL. Any idea if there are other backends that use backticks to quote names? Postgres, as well as most other databases use double quotes (") to quote names. Can you rework the patch so it takes the quote character from the DB Connection? ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540674&aid=3588789&group_id=74338 |
From: SourceForge.net <no...@so...> - 2012-11-23 18:26:59
|
Patches item #3588789, was opened at 2012-11-20 12:30 Message generated for change (Comment added) made by phd You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540674&aid=3588789&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: Darren Janeczek (darren_janeczek) Assigned to: Oleg Broytman (phd) Summary: Columns with keyword names are problematic for some queries Initial Comment: Assume you create a SQLObject out of an existing table that happens to have a column named "group". This crude patch will protect most queries that involve columns with names like "group" etc, by using a function that wraps the names with back quotes: `group`. NOT THOROUGHLY TESTED. ---------------------------------------------------------------------- >Comment By: Oleg Broytman (phd) Date: 2012-11-23 10:26 Message: Using a complex set of shell wrapper over py.test. The central part is like the following: for test in "$@"; do py.test "$test" -D "$TESTDB_URI" done If you are interested in all details I can send you an archive of all shell scripts I use to maintain SQLObject. Give me your email; if you don't want to publish it -- send it to me by a private message. I'm going to try nose. The usage should be something like python -c "import nose; nose.run_exit()" ---------------------------------------------------------------------- Comment By: Darren Janeczek (darren_janeczek) Date: 2012-11-23 09:48 Message: Thanks. How do you invoke the tests anyway? ---------------------------------------------------------------------- Comment By: Oleg Broytman (phd) Date: 2012-11-23 07:53 Message: Interesting approach. I'll have a deeper look into into it and fix tests if possible. ---------------------------------------------------------------------- Comment By: Darren Janeczek (darren_janeczek) Date: 2012-11-23 07:30 Message: I wrote a simplistic test which covers some of the functionality. Unfortunately, I wasn't able to invoke the testing suite, and I won't have time to dive too deeply into the docs for a while. The new solution should be more generally compatible. ---------------------------------------------------------------------- Comment By: Darren Janeczek (darren_janeczek) Date: 2012-11-21 09:24 Message: (Removed invalid patch. Will try again shortly) ---------------------------------------------------------------------- Comment By: Darren Janeczek (darren_janeczek) Date: 2012-11-20 17:33 Message: Another possibly more generally compatible solution would be to explicitly state table_name.field_name for each. Note however that the use of "`" is coded in a central function (escape_keywords) and could easily be changed to get the quotes from the db-specific abstraction. I have a few deadlines to fight and don't know the inner workings to do it efficiently at this time. ---------------------------------------------------------------------- Comment By: Darren Janeczek (darren_janeczek) Date: 2012-11-20 17:29 Message: This patch actually causes another problem: `table_name.field_name` is produced instead of `table_name`.`field_name` My work around was to change the method to: def escape_keywords(keyword): #Use this function to allow for the potential of field items with SQL syntax if '.' in keyword: #The dot implies that this item contains the table name -- making it legal return keyword return "`%s`" % (keyword) ---------------------------------------------------------------------- Comment By: Oleg Broytman (phd) Date: 2012-11-20 12:43 Message: Thanks. Alas, the patch quotes special names with backticks which AFAIK are only valid on MySQL. Any idea if there are other backends that use backticks to quote names? Postgres, as well as most other databases use double quotes (") to quote names. Can you rework the patch so it takes the quote character from the DB Connection? ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540674&aid=3588789&group_id=74338 |
From: SourceForge.net <no...@so...> - 2012-11-23 17:48:36
|
Patches item #3588789, was opened at 2012-11-20 12:30 Message generated for change (Comment added) made by darren_janeczek You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540674&aid=3588789&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: Darren Janeczek (darren_janeczek) Assigned to: Oleg Broytman (phd) Summary: Columns with keyword names are problematic for some queries Initial Comment: Assume you create a SQLObject out of an existing table that happens to have a column named "group". This crude patch will protect most queries that involve columns with names like "group" etc, by using a function that wraps the names with back quotes: `group`. NOT THOROUGHLY TESTED. ---------------------------------------------------------------------- >Comment By: Darren Janeczek (darren_janeczek) Date: 2012-11-23 09:48 Message: Thanks. How do you invoke the tests anyway? ---------------------------------------------------------------------- Comment By: Oleg Broytman (phd) Date: 2012-11-23 07:53 Message: Interesting approach. I'll have a deeper look into into it and fix tests if possible. ---------------------------------------------------------------------- Comment By: Darren Janeczek (darren_janeczek) Date: 2012-11-23 07:30 Message: I wrote a simplistic test which covers some of the functionality. Unfortunately, I wasn't able to invoke the testing suite, and I won't have time to dive too deeply into the docs for a while. The new solution should be more generally compatible. ---------------------------------------------------------------------- Comment By: Darren Janeczek (darren_janeczek) Date: 2012-11-21 09:24 Message: (Removed invalid patch. Will try again shortly) ---------------------------------------------------------------------- Comment By: Darren Janeczek (darren_janeczek) Date: 2012-11-20 17:33 Message: Another possibly more generally compatible solution would be to explicitly state table_name.field_name for each. Note however that the use of "`" is coded in a central function (escape_keywords) and could easily be changed to get the quotes from the db-specific abstraction. I have a few deadlines to fight and don't know the inner workings to do it efficiently at this time. ---------------------------------------------------------------------- Comment By: Darren Janeczek (darren_janeczek) Date: 2012-11-20 17:29 Message: This patch actually causes another problem: `table_name.field_name` is produced instead of `table_name`.`field_name` My work around was to change the method to: def escape_keywords(keyword): #Use this function to allow for the potential of field items with SQL syntax if '.' in keyword: #The dot implies that this item contains the table name -- making it legal return keyword return "`%s`" % (keyword) ---------------------------------------------------------------------- Comment By: Oleg Broytman (phd) Date: 2012-11-20 12:43 Message: Thanks. Alas, the patch quotes special names with backticks which AFAIK are only valid on MySQL. Any idea if there are other backends that use backticks to quote names? Postgres, as well as most other databases use double quotes (") to quote names. Can you rework the patch so it takes the quote character from the DB Connection? ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540674&aid=3588789&group_id=74338 |
From: SourceForge.net <no...@so...> - 2012-11-23 15:53:00
|
Patches item #3588789, was opened at 2012-11-20 12:30 Message generated for change (Comment added) made by phd You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540674&aid=3588789&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: Darren Janeczek (darren_janeczek) Assigned to: Oleg Broytman (phd) Summary: Columns with keyword names are problematic for some queries Initial Comment: Assume you create a SQLObject out of an existing table that happens to have a column named "group". This crude patch will protect most queries that involve columns with names like "group" etc, by using a function that wraps the names with back quotes: `group`. NOT THOROUGHLY TESTED. ---------------------------------------------------------------------- >Comment By: Oleg Broytman (phd) Date: 2012-11-23 07:53 Message: Interesting approach. I'll have a deeper look into into it and fix tests if possible. ---------------------------------------------------------------------- Comment By: Darren Janeczek (darren_janeczek) Date: 2012-11-23 07:30 Message: I wrote a simplistic test which covers some of the functionality. Unfortunately, I wasn't able to invoke the testing suite, and I won't have time to dive too deeply into the docs for a while. The new solution should be more generally compatible. ---------------------------------------------------------------------- Comment By: Darren Janeczek (darren_janeczek) Date: 2012-11-21 09:24 Message: (Removed invalid patch. Will try again shortly) ---------------------------------------------------------------------- Comment By: Darren Janeczek (darren_janeczek) Date: 2012-11-20 17:33 Message: Another possibly more generally compatible solution would be to explicitly state table_name.field_name for each. Note however that the use of "`" is coded in a central function (escape_keywords) and could easily be changed to get the quotes from the db-specific abstraction. I have a few deadlines to fight and don't know the inner workings to do it efficiently at this time. ---------------------------------------------------------------------- Comment By: Darren Janeczek (darren_janeczek) Date: 2012-11-20 17:29 Message: This patch actually causes another problem: `table_name.field_name` is produced instead of `table_name`.`field_name` My work around was to change the method to: def escape_keywords(keyword): #Use this function to allow for the potential of field items with SQL syntax if '.' in keyword: #The dot implies that this item contains the table name -- making it legal return keyword return "`%s`" % (keyword) ---------------------------------------------------------------------- Comment By: Oleg Broytman (phd) Date: 2012-11-20 12:43 Message: Thanks. Alas, the patch quotes special names with backticks which AFAIK are only valid on MySQL. Any idea if there are other backends that use backticks to quote names? Postgres, as well as most other databases use double quotes (") to quote names. Can you rework the patch so it takes the quote character from the DB Connection? ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540674&aid=3588789&group_id=74338 |
From: SourceForge.net <no...@so...> - 2012-11-23 15:30:37
|
Patches item #3588789, was opened at 2012-11-20 12:30 Message generated for change (Comment added) made by darren_janeczek You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540674&aid=3588789&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: Invalid Priority: 5 Private: No Submitted By: Darren Janeczek (darren_janeczek) Assigned to: Oleg Broytman (phd) Summary: Columns with keyword names are problematic for some queries Initial Comment: Assume you create a SQLObject out of an existing table that happens to have a column named "group". This crude patch will protect most queries that involve columns with names like "group" etc, by using a function that wraps the names with back quotes: `group`. NOT THOROUGHLY TESTED. ---------------------------------------------------------------------- >Comment By: Darren Janeczek (darren_janeczek) Date: 2012-11-23 07:30 Message: I wrote a simplistic test which covers some of the functionality. Unfortunately, I wasn't able to invoke the testing suite, and I won't have time to dive too deeply into the docs for a while. The new solution should be more generally compatible. ---------------------------------------------------------------------- Comment By: Darren Janeczek (darren_janeczek) Date: 2012-11-21 09:24 Message: (Removed invalid patch. Will try again shortly) ---------------------------------------------------------------------- Comment By: Darren Janeczek (darren_janeczek) Date: 2012-11-20 17:33 Message: Another possibly more generally compatible solution would be to explicitly state table_name.field_name for each. Note however that the use of "`" is coded in a central function (escape_keywords) and could easily be changed to get the quotes from the db-specific abstraction. I have a few deadlines to fight and don't know the inner workings to do it efficiently at this time. ---------------------------------------------------------------------- Comment By: Darren Janeczek (darren_janeczek) Date: 2012-11-20 17:29 Message: This patch actually causes another problem: `table_name.field_name` is produced instead of `table_name`.`field_name` My work around was to change the method to: def escape_keywords(keyword): #Use this function to allow for the potential of field items with SQL syntax if '.' in keyword: #The dot implies that this item contains the table name -- making it legal return keyword return "`%s`" % (keyword) ---------------------------------------------------------------------- Comment By: Oleg Broytman (phd) Date: 2012-11-20 12:43 Message: Thanks. Alas, the patch quotes special names with backticks which AFAIK are only valid on MySQL. Any idea if there are other backends that use backticks to quote names? Postgres, as well as most other databases use double quotes (") to quote names. Can you rework the patch so it takes the quote character from the DB Connection? ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540674&aid=3588789&group_id=74338 |
From: SourceForge.net <no...@so...> - 2012-11-21 17:24:17
|
Patches item #3588789, was opened at 2012-11-20 12:30 Message generated for change (Comment added) made by darren_janeczek You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540674&aid=3588789&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: Invalid Priority: 5 Private: No Submitted By: Darren Janeczek (darren_janeczek) Assigned to: Oleg Broytman (phd) Summary: Columns with keyword names are problematic for some queries Initial Comment: Assume you create a SQLObject out of an existing table that happens to have a column named "group". This crude patch will protect most queries that involve columns with names like "group" etc, by using a function that wraps the names with back quotes: `group`. NOT THOROUGHLY TESTED. ---------------------------------------------------------------------- >Comment By: Darren Janeczek (darren_janeczek) Date: 2012-11-21 09:24 Message: (Removed invalid patch. Will try again shortly) ---------------------------------------------------------------------- Comment By: Darren Janeczek (darren_janeczek) Date: 2012-11-20 17:33 Message: Another possibly more generally compatible solution would be to explicitly state table_name.field_name for each. Note however that the use of "`" is coded in a central function (escape_keywords) and could easily be changed to get the quotes from the db-specific abstraction. I have a few deadlines to fight and don't know the inner workings to do it efficiently at this time. ---------------------------------------------------------------------- Comment By: Darren Janeczek (darren_janeczek) Date: 2012-11-20 17:29 Message: This patch actually causes another problem: `table_name.field_name` is produced instead of `table_name`.`field_name` My work around was to change the method to: def escape_keywords(keyword): #Use this function to allow for the potential of field items with SQL syntax if '.' in keyword: #The dot implies that this item contains the table name -- making it legal return keyword return "`%s`" % (keyword) ---------------------------------------------------------------------- Comment By: Oleg Broytman (phd) Date: 2012-11-20 12:43 Message: Thanks. Alas, the patch quotes special names with backticks which AFAIK are only valid on MySQL. Any idea if there are other backends that use backticks to quote names? Postgres, as well as most other databases use double quotes (") to quote names. Can you rework the patch so it takes the quote character from the DB Connection? ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540674&aid=3588789&group_id=74338 |
From: SourceForge.net <no...@so...> - 2012-11-21 01:33:22
|
Patches item #3588789, was opened at 2012-11-20 12:30 Message generated for change (Comment added) made by darren_janeczek You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540674&aid=3588789&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: Invalid Priority: 5 Private: No Submitted By: Darren Janeczek (darren_janeczek) Assigned to: Oleg Broytman (phd) Summary: Columns with keyword names are problematic for some queries Initial Comment: Assume you create a SQLObject out of an existing table that happens to have a column named "group". This crude patch will protect most queries that involve columns with names like "group" etc, by using a function that wraps the names with back quotes: `group`. NOT THOROUGHLY TESTED. ---------------------------------------------------------------------- >Comment By: Darren Janeczek (darren_janeczek) Date: 2012-11-20 17:33 Message: Another possibly more generally compatible solution would be to explicitly state table_name.field_name for each. Note however that the use of "`" is coded in a central function (escape_keywords) and could easily be changed to get the quotes from the db-specific abstraction. I have a few deadlines to fight and don't know the inner workings to do it efficiently at this time. ---------------------------------------------------------------------- Comment By: Darren Janeczek (darren_janeczek) Date: 2012-11-20 17:29 Message: This patch actually causes another problem: `table_name.field_name` is produced instead of `table_name`.`field_name` My work around was to change the method to: def escape_keywords(keyword): #Use this function to allow for the potential of field items with SQL syntax if '.' in keyword: #The dot implies that this item contains the table name -- making it legal return keyword return "`%s`" % (keyword) ---------------------------------------------------------------------- Comment By: Oleg Broytman (phd) Date: 2012-11-20 12:43 Message: Thanks. Alas, the patch quotes special names with backticks which AFAIK are only valid on MySQL. Any idea if there are other backends that use backticks to quote names? Postgres, as well as most other databases use double quotes (") to quote names. Can you rework the patch so it takes the quote character from the DB Connection? ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540674&aid=3588789&group_id=74338 |
From: SourceForge.net <no...@so...> - 2012-11-21 01:29:29
|
Patches item #3588789, was opened at 2012-11-20 12:30 Message generated for change (Comment added) made by darren_janeczek You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540674&aid=3588789&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: Invalid Priority: 5 Private: No Submitted By: Darren Janeczek (darren_janeczek) Assigned to: Oleg Broytman (phd) Summary: Columns with keyword names are problematic for some queries Initial Comment: Assume you create a SQLObject out of an existing table that happens to have a column named "group". This crude patch will protect most queries that involve columns with names like "group" etc, by using a function that wraps the names with back quotes: `group`. NOT THOROUGHLY TESTED. ---------------------------------------------------------------------- >Comment By: Darren Janeczek (darren_janeczek) Date: 2012-11-20 17:29 Message: This patch actually causes another problem: `table_name.field_name` is produced instead of `table_name`.`field_name` My work around was to change the method to: def escape_keywords(keyword): #Use this function to allow for the potential of field items with SQL syntax if '.' in keyword: #The dot implies that this item contains the table name -- making it legal return keyword return "`%s`" % (keyword) ---------------------------------------------------------------------- Comment By: Oleg Broytman (phd) Date: 2012-11-20 12:43 Message: Thanks. Alas, the patch quotes special names with backticks which AFAIK are only valid on MySQL. Any idea if there are other backends that use backticks to quote names? Postgres, as well as most other databases use double quotes (") to quote names. Can you rework the patch so it takes the quote character from the DB Connection? ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540674&aid=3588789&group_id=74338 |
From: SourceForge.net <no...@so...> - 2012-11-20 20:43:32
|
Patches item #3588789, was opened at 2012-11-20 12:30 Message generated for change (Comment added) made by phd You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540674&aid=3588789&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: Invalid Priority: 5 Private: No Submitted By: Darren Janeczek (darren_janeczek) >Assigned to: Oleg Broytman (phd) Summary: Columns with keyword names are problematic for some queries Initial Comment: Assume you create a SQLObject out of an existing table that happens to have a column named "group". This crude patch will protect most queries that involve columns with names like "group" etc, by using a function that wraps the names with back quotes: `group`. NOT THOROUGHLY TESTED. ---------------------------------------------------------------------- >Comment By: Oleg Broytman (phd) Date: 2012-11-20 12:43 Message: Thanks. Alas, the patch quotes special names with backticks which AFAIK are only valid on MySQL. Any idea if there are other backends that use backticks to quote names? Postgres, as well as most other databases use double quotes (") to quote names. Can you rework the patch so it takes the quote character from the DB Connection? ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540674&aid=3588789&group_id=74338 |
From: SourceForge.net <no...@so...> - 2012-11-20 20:30:13
|
Patches item #3588789, was opened at 2012-11-20 12:30 Message generated for change (Tracker Item Submitted) made by darren_janeczek You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540674&aid=3588789&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: Darren Janeczek (darren_janeczek) Assigned to: Nobody/Anonymous (nobody) Summary: Columns with keyword names are problematic for some queries Initial Comment: Assume you create a SQLObject out of an existing table that happens to have a column named "group". This crude patch will protect most queries that involve columns with names like "group" etc, by using a function that wraps the names with back quotes: `group`. NOT THOROUGHLY TESTED. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540674&aid=3588789&group_id=74338 |