sqlobject-cvs Mailing List for SQLObject (Page 56)
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
(1) |
Sep
|
Oct
|
Nov
(2) |
Dec
(2) |
|
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)
|
|
From: <sub...@co...> - 2009-09-09 19:48:29
|
Author: phd Date: 2009-09-09 13:48:16 -0600 (Wed, 09 Sep 2009) New Revision: 3974 Modified: SQLObject/branches/0.10/docs/News.txt Log: Fixed a bug: Sybase tables with identity column fire two identity_inserts. Modified: SQLObject/branches/0.10/docs/News.txt =================================================================== --- SQLObject/branches/0.10/docs/News.txt 2009-09-09 19:47:01 UTC (rev 3973) +++ SQLObject/branches/0.10/docs/News.txt 2009-09-09 19:48:16 UTC (rev 3974) @@ -7,6 +7,11 @@ .. _start: +SQLObject 0.10.7 +================ + +* Fixed a bug: Sybase tables with identity column fire two identity_inserts. + SQLObject 0.10.6 ================ |
|
From: <sub...@co...> - 2009-09-09 19:47:15
|
Author: phd
Date: 2009-09-09 13:47:01 -0600 (Wed, 09 Sep 2009)
New Revision: 3973
Modified:
SQLObject/branches/0.10/sqlobject/sybase/sybaseconnection.py
Log:
Applied patch 2855422: Sybase tables with identity column fire two identity_inserts.
Modified: SQLObject/branches/0.10/sqlobject/sybase/sybaseconnection.py
===================================================================
--- SQLObject/branches/0.10/sqlobject/sybase/sybaseconnection.py 2009-09-08 17:58:32 UTC (rev 3972)
+++ SQLObject/branches/0.10/sqlobject/sybase/sybaseconnection.py 2009-09-09 19:47:01 UTC (rev 3973)
@@ -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: SourceForge.net <no...@so...> - 2009-09-09 19:40:28
|
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: Open Resolution: None 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. ---------------------------------------------------------------------- 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:14:03
|
Bugs item #2855422, was opened at 2009-09-09 14:13 Message generated for change (Tracker Item Submitted) made by mcw_chi You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540672&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: Sybase Group: SQLObject from repository Status: Open Resolution: None Priority: 5 Private: No Submitted By: Matthew Wright (mcw_chi) Assigned to: Nobody/Anonymous (nobody) 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. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540672&aid=2855422&group_id=74338 |
|
From: SourceForge.net <no...@so...> - 2009-09-08 18:06:12
|
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: MySQL Group: None Status: Open Resolution: None 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). ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540672&aid=2853734&group_id=74338 |
|
From: SourceForge.net <no...@so...> - 2009-09-08 18:05:16
|
Bugs item #2059325, was opened at 2008-08-19 13:21 Message generated for change (Settings changed) made by phd You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540672&aid=2059325&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: None >Status: Closed >Resolution: Wont Fix Priority: 5 Private: No Submitted By: Klaus Warnke (kwarnke3) Assigned to: Oleg Broytmann (phd) Summary: SQLRelatedJoin: defaultOrder of intermediateTable not used Initial Comment: The SELECT build for a SQLRelatedJoin does not use the sqlmeta: defaultOrder from the intermediateTable. This is not urgent, because I can provide an orderBy in to the join constructor, but it would by nice if it works automatic. Btw: The documentation seems to be outdated, because the _defaultOrder class variable was replaced with class sqlmeta: defaultOrder I think. And what is about defaultOrderBy I have seen in a test_combining_joins.py? ---------------------------------------------------------------------- Comment By: Oleg Broytmann (phd) Date: 2009-04-29 18:20 Message: SQLRelatedJoin uses defaultOrder from the other table, but not from the intermediate table: if self.orderBy is NoDefault: self.orderBy = self.otherClass.sqlmeta.defaultOrder Do you want SQLObject to test the order of the other table then from the intermediate table and to use the first one that is not None? ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540672&aid=2059325&group_id=74338 |
|
From: <sub...@co...> - 2009-09-08 17:58:46
|
Author: phd
Date: 2009-09-08 11:58:32 -0600 (Tue, 08 Sep 2009)
New Revision: 3972
Modified:
SQLObject/trunk/docs/News.txt
SQLObject/trunk/docs/SQLObject.txt
SQLObject/trunk/sqlobject/postgres/pgconnection.py
Log:
The user can choose a DB API driver for PostgreSQL by using a "backend"
parameter in DB URI or PostgresConnection.
Modified: SQLObject/trunk/docs/News.txt
===================================================================
--- SQLObject/trunk/docs/News.txt 2009-09-08 17:56:19 UTC (rev 3971)
+++ SQLObject/trunk/docs/News.txt 2009-09-08 17:58:32 UTC (rev 3972)
@@ -21,6 +21,13 @@
"pysqlite2" (alias "sqlite2"), "sqlite3", "sqlite" (alias "sqlite1").
Default is to test pysqlite2, sqlite3 and sqlite in that order.
+* The user can choose a DB API driver for PostgreSQL by using a "backend"
+ parameter in DB URI or PostgresConnection. Possible backends are:
+ "psycopg2", "psycopg1", "psycopg" (tries psycopg2 and psycopg1),
+ "pygresql". Default is "psycopg".
+ WARNING: API change! PostgresConnection's parameter "usePygresql" is now
+ replaced with "backend=pygresql".
+
* 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-08 17:56:19 UTC (rev 3971)
+++ SQLObject/trunk/docs/SQLObject.txt 2009-09-08 17:58:32 UTC (rev 3972)
@@ -1733,6 +1733,11 @@
PostgresConnection supports transactions and all other features.
+The user can choose a DB API driver for PostgreSQL by using a "backend"
+parameter in DB URI or PostgresConnection. Possible backends are:
+"psycopg2", "psycopg1", "psycopg" (tries psycopg2 and psycopg1),
+"pygresql". Default is "psycopg".
+
SQLite
------
Modified: SQLObject/trunk/sqlobject/postgres/pgconnection.py
===================================================================
--- SQLObject/trunk/sqlobject/postgres/pgconnection.py 2009-09-08 17:56:19 UTC (rev 3971)
+++ SQLObject/trunk/sqlobject/postgres/pgconnection.py 2009-09-08 17:58:32 UTC (rev 3972)
@@ -8,22 +8,28 @@
supportTransactions = True
dbName = 'postgres'
- schemes = [dbName, 'postgresql', 'psycopg']
+ schemes = [dbName, 'postgresql']
def __init__(self, dsn=None, host=None, port=None, db=None,
- user=None, password=None, usePygresql=False, unicodeCols=False,
+ user=None, password=None, backend='psycopg', unicodeCols=False,
**kw):
- self.usePygresql = usePygresql
- if usePygresql:
- import pgdb
- self.module = pgdb
- else:
+ self.backend = backend
+ if backend == 'psycopg2':
+ import psycopg2 as psycopg
+ elif backend == 'psycopg1':
+ import psycopg
+ elif backend == 'psycopg':
try:
import psycopg2 as psycopg
except ImportError:
import psycopg
+ elif backend == 'pygresql':
+ import pgdb
+ self.module = pgdb
+ else:
+ raise ValueError('Unknown PostgreSQL backend "%s", expected psycopg2, psycopg1 or pygresql' % backend)
+ if backend.startswith('psycopg'):
self.module = psycopg
-
# Register a converter for psycopg Binary type.
registerConverter(type(psycopg.Binary('')),
PsycoBinaryConverter)
@@ -37,7 +43,7 @@
if host:
dsn_dict["host"] = host
if port:
- if usePygresql:
+ if backend == 'pygresql':
dsn_dict["host"] = "%s:%d" % (host, port)
else:
if psycopg.__version__.split('.')[0] == '1':
@@ -52,7 +58,7 @@
dsn_dict["password"] = password
self.use_dsn = dsn is not None
if dsn is None:
- if usePygresql:
+ if backend == 'pygresql':
dsn = ''
if host:
dsn += host
@@ -308,7 +314,7 @@
# We have to connect to *some* database, so we'll connect to
# template1, which is a common open database.
# @@: This doesn't use self.use_dsn or self.dsn_dict
- if self.usePygresql:
+ if self.backend == 'pygresql':
dsn = '%s:template1:%s:%s' % (
self.host or '', self.user or '', self.password or '')
else:
|
|
From: <sub...@co...> - 2009-09-08 17:56:39
|
Author: phd Date: 2009-09-08 11:56:19 -0600 (Tue, 08 Sep 2009) New Revision: 3971 Modified: SQLObject/trunk/docs/News.txt SQLObject/trunk/docs/SQLObject.txt Log: Default is to test pysqlite2, sqlite3 and sqlite in that order. Modified: SQLObject/trunk/docs/News.txt =================================================================== --- SQLObject/trunk/docs/News.txt 2009-08-28 01:31:44 UTC (rev 3970) +++ SQLObject/trunk/docs/News.txt 2009-09-08 17:56:19 UTC (rev 3971) @@ -19,6 +19,7 @@ * The user can choose a DB API driver for SQLite by using a "backend" parameter in DB URI or SQLiteConnection. Possible backends are: "pysqlite2" (alias "sqlite2"), "sqlite3", "sqlite" (alias "sqlite1"). + Default is to test pysqlite2, sqlite3 and sqlite 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-08-28 01:31:44 UTC (rev 3970) +++ SQLObject/trunk/docs/SQLObject.txt 2009-09-08 17:56:19 UTC (rev 3971) @@ -1749,7 +1749,8 @@ The user can choose a DB API driver for SQLite by using a "backend" parameter in DB URI or SQLiteConnection. Possible backends are: "pysqlite2" -(alias "sqlite2"), "sqlite3", "sqlite" (alias "sqlite1"). +(alias "sqlite2"), "sqlite3", "sqlite" (alias "sqlite1"). Default is to +test pysqlite2, sqlite3 and sqlite in that order. Firebird -------- |
|
From: SourceForge.net <no...@so...> - 2009-09-07 17:38:04
|
Bugs item #2853734, was opened at 2009-09-07 18:38 Message generated for change (Tracker Item Submitted) made by mariogala 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: MySQL Group: None Status: Open Resolution: None Priority: 5 Private: No Submitted By: Mario Gala (mariogala) Assigned to: Nobody/Anonymous (nobody) 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). ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540672&aid=2853734&group_id=74338 |
|
From: <sub...@co...> - 2009-08-28 02:08:15
|
Author: phd Date: 2009-08-27 19:31:44 -0600 (Thu, 27 Aug 2009) New Revision: 3970 Modified: SQLObject/trunk/docs/News.txt Log: Minor documentation update. Modified: SQLObject/trunk/docs/News.txt =================================================================== --- SQLObject/trunk/docs/News.txt 2009-08-26 16:34:40 UTC (rev 3969) +++ SQLObject/trunk/docs/News.txt 2009-08-28 01:31:44 UTC (rev 3970) @@ -13,12 +13,6 @@ Features & Interface -------------------- -* SET client_encoding for PostgreSQL to the value of '?charset=' parameter - in DB URI. - -* alternateMethodName defined for all unique fields, not only alternateID; - this makes SQLObject create by*() methods for all unique fields. - * .selectBy(), .deleteBy() and .by*() methods pass all values through .from_python(), not only unicode. @@ -26,6 +20,12 @@ parameter in DB URI or SQLiteConnection. Possible backends are: "pysqlite2" (alias "sqlite2"), "sqlite3", "sqlite" (alias "sqlite1"). +* alternateMethodName is defined for all unique fields, not only alternateID; + this makes SQLObject create .by*() methods for all unique fields. + +* SET client_encoding for PostgreSQL to the value of "charset" parameter + in DB URI or PostgresConnection. + Small Features -------------- |
|
From: <sub...@co...> - 2009-08-26 16:34:48
|
Author: phd Date: 2009-08-26 10:34:40 -0600 (Wed, 26 Aug 2009) New Revision: 3969 Modified: SQLObject/trunk/docs/SQLObject.txt Log: How to choose the backend. Modified: SQLObject/trunk/docs/SQLObject.txt =================================================================== --- SQLObject/trunk/docs/SQLObject.txt 2009-08-26 16:32:17 UTC (rev 3968) +++ SQLObject/trunk/docs/SQLObject.txt 2009-08-26 16:34:40 UTC (rev 3969) @@ -1747,6 +1747,10 @@ SQLite may have concurrency issues, depending on your usage in a multi-threaded environment. +The user can choose a DB API driver for SQLite by using a "backend" +parameter in DB URI or SQLiteConnection. Possible backends are: "pysqlite2" +(alias "sqlite2"), "sqlite3", "sqlite" (alias "sqlite1"). + Firebird -------- |
|
From: <sub...@co...> - 2009-08-26 16:32:32
|
Author: phd
Date: 2009-08-26 10:32:17 -0600 (Wed, 26 Aug 2009)
New Revision: 3968
Modified:
SQLObject/trunk/sqlobject/sqlite/sqliteconnection.py
Log:
Fixed a bug - show the wrong backend.
Modified: SQLObject/trunk/sqlobject/sqlite/sqliteconnection.py
===================================================================
--- SQLObject/trunk/sqlobject/sqlite/sqliteconnection.py 2009-08-26 16:27:28 UTC (rev 3967)
+++ SQLObject/trunk/sqlobject/sqlite/sqliteconnection.py 2009-08-26 16:32:17 UTC (rev 3968)
@@ -44,7 +44,7 @@
import sqlite
self.using_sqlite2 = False
else:
- raise ValueError('Unknown SQLite backend "%s", expected pysqlite2, sqlite3 or sqlite')
+ raise ValueError('Unknown SQLite backend "%s", expected pysqlite2, sqlite3 or sqlite' % backend)
if self.using_sqlite2:
sqlite.encode = base64.encodestring
sqlite.decode = base64.decodestring
|
|
From: <sub...@co...> - 2009-08-26 16:27:38
|
Author: phd
Date: 2009-08-26 10:27:28 -0600 (Wed, 26 Aug 2009)
New Revision: 3967
Modified:
SQLObject/trunk/docs/News.txt
SQLObject/trunk/sqlobject/sqlite/sqliteconnection.py
Log:
The user can choose a DB API driver for SQLite by using a "backend" parameter
in DB URI or SQLiteConnection. Possible backends are:
"pysqlite2" (alias "sqlite2"), "sqlite3", "sqlite" (alias "sqlite1").
Modified: SQLObject/trunk/docs/News.txt
===================================================================
--- SQLObject/trunk/docs/News.txt 2009-08-26 16:11:20 UTC (rev 3966)
+++ SQLObject/trunk/docs/News.txt 2009-08-26 16:27:28 UTC (rev 3967)
@@ -16,14 +16,16 @@
* SET client_encoding for PostgreSQL to the value of '?charset=' parameter
in DB URI.
-* Removed deprecated attribute and functions.
-
* alternateMethodName defined for all unique fields, not only alternateID;
this makes SQLObject create by*() methods for all unique fields.
* .selectBy(), .deleteBy() and .by*() methods pass all values through
.from_python(), not only unicode.
+* The user can choose a DB API driver for SQLite by using a "backend"
+ parameter in DB URI or SQLiteConnection. Possible backends are:
+ "pysqlite2" (alias "sqlite2"), "sqlite3", "sqlite" (alias "sqlite1").
+
Small Features
--------------
@@ -31,6 +33,8 @@
in global variables; this allows to use different DB API drivers at the
same time; for example, PySQLite2 and sqlite3.
+* Removed all deprecated attribute and functions.
+
SQLObject 0.11
==============
Modified: SQLObject/trunk/sqlobject/sqlite/sqliteconnection.py
===================================================================
--- SQLObject/trunk/sqlobject/sqlite/sqliteconnection.py 2009-08-26 16:11:20 UTC (rev 3966)
+++ SQLObject/trunk/sqlobject/sqlite/sqliteconnection.py 2009-08-26 16:27:28 UTC (rev 3967)
@@ -22,26 +22,37 @@
schemes = [dbName]
def __init__(self, filename, autoCommit=1, **kw):
- try:
- from pysqlite2 import dbapi2 as sqlite
- self.using_sqlite2 = True
- except ImportError:
+ backend = kw.pop('backend', None)
+ if backend is None:
try:
+ from pysqlite2 import dbapi2 as sqlite
+ self.using_sqlite2 = True
+ except ImportError:
+ try:
+ import sqlite3 as sqlite
+ self.using_sqlite2 = True
+ except ImportError:
+ import sqlite
+ self.using_sqlite2 = False
+ elif backend in ('sqlite2', 'pysqlite2'):
+ from pysqlite2 import dbapi2 as sqlite
+ self.using_sqlite2 = True
+ elif backend == 'sqlite3':
import sqlite3 as sqlite
self.using_sqlite2 = True
- except ImportError:
+ elif backend in ('sqlite', 'sqlite1'):
import sqlite
self.using_sqlite2 = False
+ else:
+ raise ValueError('Unknown SQLite backend "%s", expected pysqlite2, sqlite3 or sqlite')
if self.using_sqlite2:
sqlite.encode = base64.encodestring
sqlite.decode = base64.decodestring
self.module = sqlite
self.filename = filename # full path to sqlite-db-file
self._memory = filename == ':memory:'
- if self._memory:
- if not self.using_sqlite2:
- raise ValueError(
- "You must use sqlite2 to use in-memory databases")
+ if self._memory and not self.using_sqlite2:
+ raise ValueError("You must use sqlite2 to use in-memory databases")
# connection options
opts = {}
if self.using_sqlite2:
|
|
From: <sub...@co...> - 2009-08-26 16:11:30
|
Author: phd
Date: 2009-08-26 10:11:20 -0600 (Wed, 26 Aug 2009)
New Revision: 3966
Modified:
SQLObject/trunk/sqlobject/sqlite/sqliteconnection.py
Log:
Removed deprecated code.
Modified: SQLObject/trunk/sqlobject/sqlite/sqliteconnection.py
===================================================================
--- SQLObject/trunk/sqlobject/sqlite/sqliteconnection.py 2009-08-24 15:19:10 UTC (rev 3965)
+++ SQLObject/trunk/sqlobject/sqlite/sqliteconnection.py 2009-08-26 16:11:20 UTC (rev 3966)
@@ -47,9 +47,6 @@
if self.using_sqlite2:
if autoCommit:
opts["isolation_level"] = None
- if 'encoding' in kw:
- import warnings
- warnings.warn(DeprecationWarning("pysqlite2 does not support the encoding option"))
opts["detect_types"] = sqlite.PARSE_DECLTYPES
for col_type in "text", "char", "varchar", "date", "time", "datetime", "timestamp":
sqlite.register_converter(col_type, stop_pysqlite2_converting_strings)
|
|
From: <sub...@co...> - 2009-08-24 15:19:26
|
Author: phd
Date: 2009-08-24 09:19:10 -0600 (Mon, 24 Aug 2009)
New Revision: 3965
Modified:
SQLObject/trunk/sqlobject/sqlbuilder.py
SQLObject/trunk/sqlobject/tests/test_converters.py
SQLObject/trunk/sqlobject/views.py
Log:
Merged UnicodeSQLObjectField into SQLObjectField;
pass all values via .from_python, not only unicode.
Modified: SQLObject/trunk/sqlobject/sqlbuilder.py
===================================================================
--- SQLObject/trunk/sqlobject/sqlbuilder.py 2009-08-21 17:20:17 UTC (rev 3964)
+++ SQLObject/trunk/sqlobject/sqlbuilder.py 2009-08-24 15:19:10 UTC (rev 3965)
@@ -321,44 +321,38 @@
return executor.field(self.tableName, self.fieldName)
class SQLObjectField(Field):
- def __init__(self, tableName, fieldName, original):
- self.original = original
+ def __init__(self, tableName, fieldName, original, soClass, column):
Field.__init__(self, tableName, fieldName)
-
-registerConverter(SQLObjectField, SQLExprConverter)
-
-
-class UnicodeField(SQLObjectField):
- def __init__(self, tableName, fieldName, original, column):
- SQLObjectField.__init__(self, tableName, fieldName, original)
+ self.original = original
+ self.soClass = soClass
self.column = column
+ def _from_python(self, value):
+ column = self.column
+ if not isinstance(value, SQLExpression) and column and column.from_python:
+ value = column.from_python(value, self.soClass)
+ return value
def __eq__(self, other):
if other is None:
return ISNULL(self)
- if isinstance(other, unicode):
- other = other.encode(self.column.dbEncoding)
+ other = self._from_python(other)
return SQLOp('=', self, other)
def __ne__(self, other):
if other is None:
return ISNOTNULL(self)
- if isinstance(other, unicode):
- other = other.encode(self.column.dbEncoding)
+ other = self._from_python(other)
return SQLOp('<>', self, other)
def startswith(self, s):
- if isinstance(s, unicode):
- s = s.encode(self.column.dbEncoding)
+ s = self._from_python(s)
return STARTSWITH(self, s)
def endswith(self, s):
- if isinstance(s, unicode):
- s = s.encode(self.column.dbEncoding)
+ s = self._from_python(s)
return ENDSWITH(self, s)
def contains(self, s):
- if isinstance(s, unicode):
- s = s.encode(self.column.dbEncoding)
+ s = self._from_python(s)
return CONTAINSSTRING(self, s)
+registerConverter(SQLObjectField, SQLExprConverter)
-registerConverter(UnicodeField, SQLExprConverter)
class Table(SQLExpression):
FieldClass = Field
@@ -378,7 +372,6 @@
class SQLObjectTable(Table):
FieldClass = SQLObjectField
- UnicodeFieldClass = UnicodeField
def __init__(self, soClass):
self.soClass = soClass
@@ -394,10 +387,7 @@
return self._getattrFromID(attr)
elif attr in self.soClass.sqlmeta.columns:
column = self.soClass.sqlmeta.columns[attr]
- if hasattr(column, "dbEncoding"):
- return self._getattrFromUnicodeColumn(column, attr)
- else:
- return self._getattrFromColumn(column, attr)
+ return self._getattrFromColumn(column, attr)
elif attr+'ID' in [k for (k, v) in self.soClass.sqlmeta.columns.items() if v.foreignKey]:
attr += 'ID'
column = self.soClass.sqlmeta.columns[attr]
@@ -406,14 +396,11 @@
raise AttributeError("%s instance has no attribute '%s'" % (self.soClass.__name__, attr))
def _getattrFromID(self, attr):
- return self.FieldClass(self.tableName, self.soClass.sqlmeta.idName, attr)
+ return self.FieldClass(self.tableName, self.soClass.sqlmeta.idName, attr, self.soClass, None)
def _getattrFromColumn(self, column, attr):
- return self.FieldClass(self.tableName, column.dbName, attr)
+ return self.FieldClass(self.tableName, column.dbName, attr, self.soClass, column)
- def _getattrFromUnicodeColumn(self, column, attr):
- return self.UnicodeFieldClass(self.tableName, column.dbName, attr, column)
-
class SQLObjectTableWithJoins(SQLObjectTable):
def __getattr__(self, attr):
Modified: SQLObject/trunk/sqlobject/tests/test_converters.py
===================================================================
--- SQLObject/trunk/sqlobject/tests/test_converters.py 2009-08-21 17:20:17 UTC (rev 3964)
+++ SQLObject/trunk/sqlobject/tests/test_converters.py 2009-08-24 15:19:10 UTC (rev 3965)
@@ -105,7 +105,7 @@
assert sqlrepr(instance) == repr(instance)
def test_sqlobjectfield():
- instance = SQLObjectField('test', 'test', 'test')
+ instance = SQLObjectField('test', 'test', 'test', None, None)
assert sqlrepr(instance) == repr(instance)
def test_select():
Modified: SQLObject/trunk/sqlobject/views.py
===================================================================
--- SQLObject/trunk/sqlobject/views.py 2009-08-21 17:20:17 UTC (rev 3964)
+++ SQLObject/trunk/sqlobject/views.py 2009-08-24 15:19:10 UTC (rev 3965)
@@ -11,23 +11,15 @@
class ViewSQLObjectField(SQLObjectField):
def __init__(self, alias, *arg):
- self.alias = alias
SQLObjectField.__init__(self, *arg)
+ self.alias = alias
def __sqlrepr__(self, db):
return self.alias + "." + self.fieldName
def tablesUsedImmediate(self):
return [self.tableName]
-class UnicodeViewSQLObjectField(UnicodeField):
- def __init__(self, alias, *arg):
- self.alias = alias
- UnicodeField.__init__(self, *arg)
- __sqlrepr__ = ViewSQLObjectField.__sqlrepr__
- tablesUsedImmediate = ViewSQLObjectField.tablesUsedImmediate
-
class ViewSQLObjectTable(SQLObjectTable):
FieldClass = ViewSQLObjectField
- UnicodeFieldClass = UnicodeViewSQLObjectField
def __getattr__(self, attr):
if attr == 'sqlmeta':
@@ -35,15 +27,12 @@
return SQLObjectTable.__getattr__(self, attr)
def _getattrFromID(self, attr):
- return self.FieldClass(self.soClass.sqlmeta.alias, self.tableName, 'id', attr)
+ return self.FieldClass(self.soClass.sqlmeta.alias, self.tableName, 'id', attr, self.soClass, None)
def _getattrFromColumn(self, column, attr):
- return self.FieldClass(self.soClass.sqlmeta.alias, self.tableName, column.name, attr)
+ return self.FieldClass(self.soClass.sqlmeta.alias, self.tableName, column.name, attr, self.soClass, column)
- def _getattrFromUnicodeColumn(self, column, attr):
- return self.UnicodeFieldClass(self.soClass.sqlmeta.alias, self.tableName, column.name, attr, column)
-
class ViewSQLObject(SQLObject):
"""
A SQLObject class that derives all it's values from other SQLObject classes.
|
Author: phd
Date: 2009-08-21 11:20:17 -0600 (Fri, 21 Aug 2009)
New Revision: 3964
Modified:
SQLObject/trunk/docs/News.txt
SQLObject/trunk/sqlobject/firebird/firebirdconnection.py
SQLObject/trunk/sqlobject/maxdb/maxdbconnection.py
SQLObject/trunk/sqlobject/mssql/mssqlconnection.py
SQLObject/trunk/sqlobject/mysql/mysqlconnection.py
SQLObject/trunk/sqlobject/postgres/pgconnection.py
SQLObject/trunk/sqlobject/sqlite/sqliteconnection.py
SQLObject/trunk/sqlobject/sybase/sybaseconnection.py
SQLObject/trunk/sqlobject/tests/test_datetime.py
SQLObject/trunk/sqlobject/tests/test_select.py
SQLObject/trunk/sqlobject/tests/test_sqlite_factory.py
Log:
Imported DB API drivers are stored as connection instance variables, not in global variables.
Modified: SQLObject/trunk/docs/News.txt
===================================================================
--- SQLObject/trunk/docs/News.txt 2009-08-19 15:57:09 UTC (rev 3963)
+++ SQLObject/trunk/docs/News.txt 2009-08-21 17:20:17 UTC (rev 3964)
@@ -24,6 +24,13 @@
* .selectBy(), .deleteBy() and .by*() methods pass all values through
.from_python(), not only unicode.
+Small Features
+--------------
+
+* Imported DB API drivers are stored as connection instance variables, not
+ in global variables; this allows to use different DB API drivers at the
+ same time; for example, PySQLite2 and sqlite3.
+
SQLObject 0.11
==============
Modified: SQLObject/trunk/sqlobject/firebird/firebirdconnection.py
===================================================================
--- SQLObject/trunk/sqlobject/firebird/firebirdconnection.py 2009-08-19 15:57:09 UTC (rev 3963)
+++ SQLObject/trunk/sqlobject/firebird/firebirdconnection.py 2009-08-21 17:20:17 UTC (rev 3964)
@@ -2,7 +2,6 @@
import os
from sqlobject.dbconnection import DBAPI
from sqlobject import col
-kinterbasdb = None
class FirebirdConnection(DBAPI):
@@ -13,9 +12,7 @@
def __init__(self, host, db, user='sysdba',
password='masterkey', autoCommit=1,
dialect=None, role=None, charset=None, **kw):
- global kinterbasdb
- if kinterbasdb is None:
- import kinterbasdb
+ import kinterbasdb
self.module = kinterbasdb
self.limit_re = re.compile('^\s*(select )(.*)', re.IGNORECASE)
@@ -53,13 +50,13 @@
# @@: Horrible auto-commit implementation. Just horrible!
try:
conn.begin()
- except kinterbasdb.ProgrammingError:
+ except self.module.ProgrammingError:
pass
try:
val = meth(conn, *args)
try:
conn.commit()
- except kinterbasdb.ProgrammingError:
+ except self.module.ProgrammingError:
pass
finally:
self.releaseConnection(conn)
@@ -74,7 +71,7 @@
extra = {}
if self.dialect:
extra['dialect'] = self.dialect
- return kinterbasdb.connect(
+ return self.module.connect(
host=self.host,
database=self.db,
user=self.user,
Modified: SQLObject/trunk/sqlobject/maxdb/maxdbconnection.py
===================================================================
--- SQLObject/trunk/sqlobject/maxdb/maxdbconnection.py 2009-08-19 15:57:09 UTC (rev 3963)
+++ SQLObject/trunk/sqlobject/maxdb/maxdbconnection.py 2009-08-21 17:20:17 UTC (rev 3964)
@@ -15,7 +15,6 @@
"""
from sqlobject.dbconnection import DBAPI
from sqlobject import col
-dbapi = None
@@ -63,9 +62,7 @@
def __init__ (self, user, password, database,
host='', autoCommit=1, sqlmode='internal',
isolation=None, timeout=None, **kw):
- global dbapi
- if dbapi is None:
- from sapdb import dbapi
+ from sapdb import dbapi
self.module = dbapi
self.autoCommit = autoCommit
self.user = user
@@ -114,7 +111,7 @@
return '%s_SEQ'%(table[:SAPDBMAX_ID_LENGTH -4])
def makeConnection(self):
- conn = dbapi.Connection(
+ conn = self.module.Connection(
self.user, self.password, self.database, self.host,
**self._getConfigParams(self.sqlmode,self.autoCommit))
return conn
Modified: SQLObject/trunk/sqlobject/mssql/mssqlconnection.py
===================================================================
--- SQLObject/trunk/sqlobject/mssql/mssqlconnection.py 2009-08-19 15:57:09 UTC (rev 3963)
+++ SQLObject/trunk/sqlobject/mssql/mssqlconnection.py 2009-08-21 17:20:17 UTC (rev 3964)
@@ -2,8 +2,6 @@
from sqlobject import col
import re
-sqlmodule = None
-
class MSSQLConnection(DBAPI):
supportTransactions = True
@@ -12,15 +10,12 @@
def __init__(self, db, user, password='', host='localhost',
autoCommit=0, **kw):
- global sqlmodule
- if not sqlmodule:
- try:
- import adodbapi as sqlmodule
- except ImportError:
- import pymssql as sqlmodule
+ try:
+ import adodbapi as sqlmodule
+ except ImportError:
+ import pymssql as sqlmodule
if sqlmodule.__name__ == 'adodbapi':
- import adodbapi as sqlmodule
self.dbconnection = sqlmodule.connect
# ADO uses unicode only (AFAIK)
self.usingUnicodeStrings = True
Modified: SQLObject/trunk/sqlobject/mysql/mysqlconnection.py
===================================================================
--- SQLObject/trunk/sqlobject/mysql/mysqlconnection.py 2009-08-19 15:57:09 UTC (rev 3963)
+++ SQLObject/trunk/sqlobject/mysql/mysqlconnection.py 2009-08-21 17:20:17 UTC (rev 3964)
@@ -1,7 +1,6 @@
from sqlobject import col
from sqlobject.dbconnection import DBAPI
from sqlobject.dberrors import *
-MySQLdb = None
class ErrorMessage(str):
def __new__(cls, e, append_msg=''):
@@ -18,9 +17,7 @@
schemes = [dbName]
def __init__(self, db, user, password='', host='localhost', port=0, **kw):
- global MySQLdb
- if MySQLdb is None:
- import MySQLdb, MySQLdb.constants.CR, MySQLdb.constants.ER
+ import MySQLdb, MySQLdb.constants.CR, MySQLdb.constants.ER
self.module = MySQLdb
self.host = host
self.port = port
@@ -49,7 +46,7 @@
# MySQLdb < 1.2.1: only ascii
# MySQLdb = 1.2.1: only unicode
# MySQLdb > 1.2.1: both ascii and unicode
- self.need_unicode = (MySQLdb.version_info[:3] >= (1, 2, 1)) and (MySQLdb.version_info[:3] < (1, 2, 2))
+ self.need_unicode = (self.module.version_info[:3] >= (1, 2, 1)) and (self.module.version_info[:3] < (1, 2, 2))
DBAPI.__init__(self, **kw)
@@ -71,7 +68,7 @@
try:
conn = self.module.connect(host=self.host, port=self.port,
db=self.db, user=self.user, passwd=self.password, **self.kw)
- if MySQLdb.version_info[:3] >= (1, 2, 2):
+ if self.module.version_info[:3] >= (1, 2, 2):
conn.ping(True) # Attempt to reconnect. This setting is persistent.
except self.module.OperationalError, e:
conninfo = "; used connection string: host=%(host)s, port=%(port)s, db=%(db)s, user=%(user)s" % self.__dict__
@@ -115,35 +112,35 @@
for count in range(3):
try:
return cursor.execute(query)
- except MySQLdb.OperationalError, e:
- if e.args[0] in (MySQLdb.constants.CR.SERVER_GONE_ERROR, MySQLdb.constants.CR.SERVER_LOST):
+ except self.module.OperationalError, e:
+ if e.args[0] in (self.module.constants.CR.SERVER_GONE_ERROR, self.module.constants.CR.SERVER_LOST):
if count == 2:
raise OperationalError(ErrorMessage(e))
if self.debug:
self.printDebug(conn, str(e), 'ERROR')
else:
raise OperationalError(ErrorMessage(e))
- except MySQLdb.IntegrityError, e:
+ except self.module.IntegrityError, e:
msg = ErrorMessage(e)
- if e.args[0] == MySQLdb.constants.ER.DUP_ENTRY:
+ if e.args[0] == self.module.constants.ER.DUP_ENTRY:
raise DuplicateEntryError(msg)
else:
raise IntegrityError(msg)
- except MySQLdb.InternalError, e:
+ except self.module.InternalError, e:
raise InternalError(ErrorMessage(e))
- except MySQLdb.ProgrammingError, e:
+ except self.module.ProgrammingError, e:
raise ProgrammingError(ErrorMessage(e))
- except MySQLdb.DataError, e:
+ except self.module.DataError, e:
raise DataError(ErrorMessage(e))
- except MySQLdb.NotSupportedError, e:
+ except self.module.NotSupportedError, e:
raise NotSupportedError(ErrorMessage(e))
- except MySQLdb.DatabaseError, e:
+ except self.module.DatabaseError, e:
raise DatabaseError(ErrorMessage(e))
- except MySQLdb.InterfaceError, e:
+ except self.module.InterfaceError, e:
raise InterfaceError(ErrorMessage(e))
- except MySQLdb.Warning, e:
+ except self.module.Warning, e:
raise Warning(ErrorMessage(e))
- except MySQLdb.Error, e:
+ except self.module.Error, e:
raise Error(ErrorMessage(e))
def _queryInsertID(self, conn, soInstance, id, names, values):
Modified: SQLObject/trunk/sqlobject/postgres/pgconnection.py
===================================================================
--- SQLObject/trunk/sqlobject/postgres/pgconnection.py 2009-08-19 15:57:09 UTC (rev 3963)
+++ SQLObject/trunk/sqlobject/postgres/pgconnection.py 2009-08-21 17:20:17 UTC (rev 3964)
@@ -3,8 +3,6 @@
from sqlobject import col
from sqlobject import sqlbuilder
from sqlobject.converters import registerConverter
-psycopg = None
-pgdb = None
class PostgresConnection(DBAPI):
@@ -15,18 +13,15 @@
def __init__(self, dsn=None, host=None, port=None, db=None,
user=None, password=None, usePygresql=False, unicodeCols=False,
**kw):
- global psycopg, pgdb
self.usePygresql = usePygresql
if usePygresql:
- if pgdb is None:
- import pgdb
+ import pgdb
self.module = pgdb
else:
- if psycopg is None:
- try:
- import psycopg2 as psycopg
- except ImportError:
- import psycopg
+ try:
+ import psycopg2 as psycopg
+ except ImportError:
+ import psycopg
self.module = psycopg
# Register a converter for psycopg Binary type.
Modified: SQLObject/trunk/sqlobject/sqlite/sqliteconnection.py
===================================================================
--- SQLObject/trunk/sqlobject/sqlite/sqliteconnection.py 2009-08-19 15:57:09 UTC (rev 3963)
+++ SQLObject/trunk/sqlobject/sqlite/sqliteconnection.py 2009-08-21 17:20:17 UTC (rev 3964)
@@ -5,8 +5,6 @@
from sqlobject import col, sqlbuilder
from sqlobject.dberrors import *
-sqlite = None
-using_sqlite2 = False
sqlite2_Binary = None
class ErrorMessage(str):
@@ -24,32 +22,29 @@
schemes = [dbName]
def __init__(self, filename, autoCommit=1, **kw):
- global sqlite
- global using_sqlite2
- if sqlite is None:
+ try:
+ from pysqlite2 import dbapi2 as sqlite
+ self.using_sqlite2 = True
+ except ImportError:
try:
- from pysqlite2 import dbapi2 as sqlite
- using_sqlite2 = True
+ import sqlite3 as sqlite
+ self.using_sqlite2 = True
except ImportError:
- try:
- import sqlite3 as sqlite
- using_sqlite2 = True
- except ImportError:
- import sqlite
- using_sqlite2 = False
- if using_sqlite2:
- sqlite.encode = base64.encodestring
- sqlite.decode = base64.decodestring
+ import sqlite
+ self.using_sqlite2 = False
+ if self.using_sqlite2:
+ sqlite.encode = base64.encodestring
+ sqlite.decode = base64.decodestring
self.module = sqlite
self.filename = filename # full path to sqlite-db-file
self._memory = filename == ':memory:'
if self._memory:
- if not using_sqlite2:
+ if not self.using_sqlite2:
raise ValueError(
"You must use sqlite2 to use in-memory databases")
# connection options
opts = {}
- if using_sqlite2:
+ if self.using_sqlite2:
if autoCommit:
opts["isolation_level"] = None
if 'encoding' in kw:
@@ -75,7 +70,7 @@
if 'mode' in kw:
opts['mode'] = int(kw.pop('mode'), 0)
if 'timeout' in kw:
- if using_sqlite2:
+ if self.using_sqlite2:
opts['timeout'] = float(kw.pop('timeout'))
else:
opts['timeout'] = int(float(kw.pop('timeout')) * 1000)
@@ -156,7 +151,7 @@
conn.close()
def _setAutoCommit(self, conn, auto):
- if using_sqlite2:
+ if self.using_sqlite2:
if auto:
conn.isolation_level = None
else:
@@ -165,14 +160,14 @@
conn.autocommit = auto
def _setIsolationLevel(self, conn, level):
- if not using_sqlite2:
+ if not self.using_sqlite2:
return
conn.isolation_level = level
def makeConnection(self):
if self._memory:
return self._memoryConn
- return sqlite.connect(self.filename, **self._connOptions)
+ return self.module.connect(self.filename, **self._connOptions)
def _executeRetry(self, conn, cursor, query):
if self.debug:
Modified: SQLObject/trunk/sqlobject/sybase/sybaseconnection.py
===================================================================
--- SQLObject/trunk/sqlobject/sybase/sybaseconnection.py 2009-08-19 15:57:09 UTC (rev 3963)
+++ SQLObject/trunk/sqlobject/sybase/sybaseconnection.py 2009-08-21 17:20:17 UTC (rev 3964)
@@ -1,21 +1,21 @@
from sqlobject.dbconnection import DBAPI
from sqlobject import col
-Sybase = None
class SybaseConnection(DBAPI):
supportTransactions = False
dbName = 'sybase'
schemes = [dbName]
+ NumericType = None
def __init__(self, db, user, password='', host='localhost',
locking=1, **kw):
db = db.strip('/')
- global Sybase
- if Sybase is None:
- import Sybase
- Sybase._ctx.debug = 0
+ import Sybase
+ Sybase._ctx.debug = 0
+ if SybaseConnection.NumericType is None:
from Sybase import NumericType
+ SybaseConnection.NumericType = NumericType
from sqlobject.converters import registerConverter, IntConverter
registerConverter(NumericType, IntConverter)
self.module = Sybase
@@ -48,7 +48,7 @@
return c.fetchone()[0]
def makeConnection(self):
- return Sybase.connect(self.host, self.user, self.password,
+ return self.module.connect(self.host, self.user, self.password,
database=self.db, auto_commit=self.autoCommit,
locking=self.locking)
Modified: SQLObject/trunk/sqlobject/tests/test_datetime.py
===================================================================
--- SQLObject/trunk/sqlobject/tests/test_datetime.py 2009-08-19 15:57:09 UTC (rev 3963)
+++ SQLObject/trunk/sqlobject/tests/test_datetime.py 2009-08-21 17:20:17 UTC (rev 3964)
@@ -43,9 +43,9 @@
from mx.DateTime import now, Time
dateFormat = None # use default
- if getConnection().dbName == "sqlite":
- from sqlobject.sqlite.sqliteconnection import using_sqlite2
- if using_sqlite2:
+ connection = getConnection()
+ if connection.dbName == "sqlite":
+ if connection.using_sqlite2:
# mxDateTime sends and PySQLite2 returns full date/time for dates
dateFormat = "%Y-%m-%d %H:%M:%S"
Modified: SQLObject/trunk/sqlobject/tests/test_select.py
===================================================================
--- SQLObject/trunk/sqlobject/tests/test_select.py 2009-08-19 15:57:09 UTC (rev 3963)
+++ SQLObject/trunk/sqlobject/tests/test_select.py 2009-08-21 17:20:17 UTC (rev 3964)
@@ -152,8 +152,7 @@
setupClass(IterTest)
if IterTest._connection.dbName == "sqlite":
- from sqlobject.sqlite import sqliteconnection
- if not sqliteconnection.using_sqlite2:
+ if not IterTest._connection.using_sqlite2:
return
# Implement regexp() function for SQLite; only works with PySQLite2
Modified: SQLObject/trunk/sqlobject/tests/test_sqlite_factory.py
===================================================================
--- SQLObject/trunk/sqlobject/tests/test_sqlite_factory.py 2009-08-19 15:57:09 UTC (rev 3963)
+++ SQLObject/trunk/sqlobject/tests/test_sqlite_factory.py 2009-08-21 17:20:17 UTC (rev 3964)
@@ -9,8 +9,7 @@
setupClass(SQLiteFactoryTest)
if SQLiteFactoryTest._connection.dbName == "sqlite":
- from sqlobject.sqlite import sqliteconnection
- if not sqliteconnection.using_sqlite2:
+ if not SQLiteFactoryTest._connection.using_sqlite2:
return
factory = [None]
@@ -30,8 +29,7 @@
setupClass(SQLiteFactoryTest)
if SQLiteFactoryTest._connection.dbName == "sqlite":
- from sqlobject.sqlite import sqliteconnection
- if not sqliteconnection.using_sqlite2:
+ if not SQLiteFactoryTest._connection.using_sqlite2:
return
factory = [None]
@@ -40,6 +38,7 @@
pass
factory[0] = MyConnection
return MyConnection
+ from sqlobject.sqlite import sqliteconnection
sqliteconnection.SQLiteConnectionFactory = SQLiteConnectionFactory
setSQLiteConnectionFactory(SQLiteFactoryTest, "SQLiteConnectionFactory")
@@ -53,8 +52,7 @@
setupClass(SQLiteFactoryTest)
if SQLiteFactoryTest._connection.dbName == "sqlite":
- from sqlobject.sqlite import sqliteconnection
- if not sqliteconnection.using_sqlite2:
+ if not SQLiteFactoryTest._connection.using_sqlite2:
return
def SQLiteConnectionFactory(sqlite):
|
|
From: <sub...@co...> - 2009-08-19 15:57:18
|
Author: phd
Date: 2009-08-19 09:57:09 -0600 (Wed, 19 Aug 2009)
New Revision: 3963
Modified:
SQLObject/trunk/docs/News.txt
SQLObject/trunk/sqlobject/dbconnection.py
SQLObject/trunk/sqlobject/main.py
Log:
.selectBy(), .deleteBy() and .by*() methods pass all values through
.from_python(), not only unicode.
Modified: SQLObject/trunk/docs/News.txt
===================================================================
--- SQLObject/trunk/docs/News.txt 2009-08-18 16:47:32 UTC (rev 3962)
+++ SQLObject/trunk/docs/News.txt 2009-08-19 15:57:09 UTC (rev 3963)
@@ -21,6 +21,9 @@
* alternateMethodName defined for all unique fields, not only alternateID;
this makes SQLObject create by*() methods for all unique fields.
+* .selectBy(), .deleteBy() and .by*() methods pass all values through
+ .from_python(), not only unicode.
+
SQLObject 0.11
==============
Modified: SQLObject/trunk/sqlobject/dbconnection.py
===================================================================
--- SQLObject/trunk/sqlobject/dbconnection.py 2009-08-18 16:47:32 UTC (rev 3962)
+++ SQLObject/trunk/sqlobject/dbconnection.py 2009-08-19 15:57:09 UTC (rev 3963)
@@ -574,7 +574,10 @@
data[soClass.sqlmeta.idName] = kw.pop('id')
for key, col in soClass.sqlmeta.columns.items():
if key in kw:
- data[col.dbName] = kw.pop(key)
+ value = kw.pop(key)
+ if col.from_python:
+ value = col.from_python(value, soClass)
+ data[col.dbName] = value
elif col.foreignName in kw:
obj = kw.pop(col.foreignName)
if isinstance(obj, main.SQLObject):
Modified: SQLObject/trunk/sqlobject/main.py
===================================================================
--- SQLObject/trunk/sqlobject/main.py 2009-08-18 16:47:32 UTC (rev 3962)
+++ SQLObject/trunk/sqlobject/main.py 2009-08-19 15:57:09 UTC (rev 3963)
@@ -1306,16 +1306,18 @@
return getID(obj)
def _findAlternateID(cls, name, dbName, value, connection=None):
- if isinstance(value, unicode):
- column = cls.sqlmeta.columns[name]
- if isinstance(column, col.SOUnicodeCol):
- value = value.encode(column.dbEncoding)
if isinstance(name, str):
name = (name,)
value = (value,)
if len(name) != len(value):
raise ValueError, "'column' and 'value' tuples must be of the same size"
- condition = sqlbuilder.AND(*[getattr(cls.q, n)==v for n,v in zip(name, value)])
+ new_value = []
+ for n, v in zip(name, value):
+ from_python = getattr(cls, '_SO_from_python_' + n)
+ if from_python:
+ v = from_python(v, cls)
+ new_value.append(v)
+ condition = sqlbuilder.AND(*[getattr(cls.q, n)==v for n,v in zip(name, new_value)])
return (connection or cls._connection)._SO_selectOneAlt(
cls,
[cls.sqlmeta.idName] +
@@ -1364,11 +1366,6 @@
select = classmethod(select)
def selectBy(cls, connection=None, **kw):
- for key, column in cls.sqlmeta.columns.items():
- if (key in kw) and isinstance(column, col.SOUnicodeCol):
- value = kw[key]
- if isinstance(value, unicode):
- kw[key] = value.encode(column.dbEncoding)
conn = connection or cls._connection
return cls.SelectResultsClass(cls,
conn._SO_columnClause(cls, kw),
|
|
From: <sub...@co...> - 2009-08-18 16:47:44
|
Author: phd Date: 2009-08-18 10:47:32 -0600 (Tue, 18 Aug 2009) New Revision: 3962 Modified: SQLObject/trunk/docs/News.txt Log: alternateMethodName *defined*... Modified: SQLObject/trunk/docs/News.txt =================================================================== --- SQLObject/trunk/docs/News.txt 2009-08-18 16:41:42 UTC (rev 3961) +++ SQLObject/trunk/docs/News.txt 2009-08-18 16:47:32 UTC (rev 3962) @@ -18,8 +18,8 @@ * Removed deprecated attribute and functions. -* alternateMethodName for all unique fields, not only alternateID; this - makes SQLObject create by*() methods for all unique fields. +* alternateMethodName defined for all unique fields, not only alternateID; + this makes SQLObject create by*() methods for all unique fields. SQLObject 0.11 ============== |
|
From: <sub...@co...> - 2009-08-18 16:41:56
|
Author: phd
Date: 2009-08-18 10:41:42 -0600 (Tue, 18 Aug 2009)
New Revision: 3961
Modified:
SQLObject/trunk/docs/News.txt
SQLObject/trunk/sqlobject/col.py
SQLObject/trunk/sqlobject/tests/test_select.py
Log:
alternateMethodName for all unique fields, not only alternateID; this
makes SQLObject create by*() methods for all unique fields.
Modified: SQLObject/trunk/docs/News.txt
===================================================================
--- SQLObject/trunk/docs/News.txt 2009-08-13 16:55:38 UTC (rev 3960)
+++ SQLObject/trunk/docs/News.txt 2009-08-18 16:41:42 UTC (rev 3961)
@@ -18,6 +18,9 @@
* Removed deprecated attribute and functions.
+* alternateMethodName for all unique fields, not only alternateID; this
+ makes SQLObject create by*() methods for all unique fields.
+
SQLObject 0.11
==============
Modified: SQLObject/trunk/sqlobject/col.py
===================================================================
--- SQLObject/trunk/sqlobject/col.py 2009-08-13 16:55:38 UTC (rev 3960)
+++ SQLObject/trunk/sqlobject/col.py 2009-08-18 16:41:42 UTC (rev 3961)
@@ -196,15 +196,15 @@
# alternateID means that this is a unique column that
# can be used to identify rows
self.alternateID = alternateID
- if self.alternateID and alternateMethodName is None:
- self.alternateMethodName = 'by' + self.name[0].capitalize() + self.name[1:]
- else:
- self.alternateMethodName = alternateMethodName
if unique is NoDefault:
self.unique = alternateID
else:
self.unique = unique
+ if self.unique and alternateMethodName is None:
+ self.alternateMethodName = 'by' + self.name[0].capitalize() + self.name[1:]
+ else:
+ self.alternateMethodName = alternateMethodName
_validators = self.createValidators()
if _validators:
Modified: SQLObject/trunk/sqlobject/tests/test_select.py
===================================================================
--- SQLObject/trunk/sqlobject/tests/test_select.py 2009-08-13 16:55:38 UTC (rev 3960)
+++ SQLObject/trunk/sqlobject/tests/test_select.py 2009-08-18 16:41:42 UTC (rev 3961)
@@ -103,6 +103,16 @@
return
assert False, "IterTest(nonexistant='b') should raise TypeError"
+class UniqTest(SQLObject):
+ name = StringCol(dbName='name_col', unique=True)
+
+def test_by_uniq():
+ setupClass(UniqTest)
+ a = UniqTest(name='a')
+ b = UniqTest(name='b')
+ assert UniqTest.byName('a') is a
+ assert UniqTest.byName('b') is b
+
class Counter2(SQLObject):
n1 = IntCol(notNull=True)
|
|
From: <sub...@co...> - 2009-08-13 16:55:50
|
Author: phd Date: 2009-08-13 10:55:38 -0600 (Thu, 13 Aug 2009) New Revision: 3960 Modified: SQLObject/trunk/docs/News.txt Log: SET client_encoding for PostgreSQL to the value of '?charset=' parameter in DB URI. Modified: SQLObject/trunk/docs/News.txt =================================================================== --- SQLObject/trunk/docs/News.txt 2009-08-13 16:54:18 UTC (rev 3959) +++ SQLObject/trunk/docs/News.txt 2009-08-13 16:55:38 UTC (rev 3960) @@ -13,6 +13,9 @@ Features & Interface -------------------- +* SET client_encoding for PostgreSQL to the value of '?charset=' parameter + in DB URI. + * Removed deprecated attribute and functions. SQLObject 0.11 |