[SQL-CVS] r230 - in trunk/SQLObject: docs sqlobject
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
|
From: <sub...@co...> - 2004-09-27 22:15:54
|
Author: ianb
Date: 2004-09-27 14:03:12 -0400 (Mon, 27 Sep 2004)
New Revision: 230
Modified:
trunk/SQLObject/docs/News.txt
trunk/SQLObject/sqlobject/dbconnection.py
Log:
Applied [ 1034254 ] selectBy patch for accepting object values
Modified: trunk/SQLObject/docs/News.txt
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/SQLObject/docs/News.txt 2004-09-27 17:57:02 UTC (rev 229)
+++ trunk/SQLObject/docs/News.txt 2004-09-27 18:03:12 UTC (rev 230)
@@ -15,18 +15,31 @@
=20
* Added a connection parameter to all class methods (patch 974755)
=20
+* Connection objects have a ``.module`` attribute, which points to
+ the DB-API module. This is useful for getting access to the
+ exception objects.
+
+Features
+--------
+
* Added indexing (from Jeremy Fitzhardinge). See `the
documentation`__ for more.
=20
.. __: SQLObject.html#indexes
=20
-* Connection objects have a ``.module`` attribute, which points to
- the DB-API module. This is useful for getting access to the
- exception objects.
+* All connections are explicitly closed, not just garbage collected.
+ Many database drivers don't close database connections properly when
+ the connection object is garbage collected.
=20
* New ``distinct`` option to selects, like ``MyClass.select(...,
distinct=3DTrue)``
=20
+* You can now do
+ ``MyClass.selectBy(joinedTable=3DjoinedTableInstance)``, where before
+ you had to do
+ ``MyClass.selectBy(joinedTableID=3DjoinedTableInstance.id)``. (From
+ Dave Cook)
+
SQLObject 0.6
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
=20
Modified: trunk/SQLObject/sqlobject/dbconnection.py
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/SQLObject/sqlobject/dbconnection.py 2004-09-27 17:57:02 UTC (re=
v 229)
+++ trunk/SQLObject/sqlobject/dbconnection.py 2004-09-27 18:03:12 UTC (re=
v 230)
@@ -442,6 +442,22 @@
self.sqlrepr(value))
for key, value
in kw.items()])
+ terms =3D []
+ for key, value in kw.items():
+ if hasattr(value, '_SO_joinDict'): #handle an object value
+ # find the joinColumn=20
+ for join in value._SO_joinDict.values():
+ if join.otherClass is soClass:
+ dbName =3D join.joinColumn
+ break
+ else: #if nothing found
+ raise TypeError, "Cannot selectBy(%s=3D%r)" % (key, value)
+ value =3D value.id
+ else:
+ dbName =3D soClass._SO_columnDict[key].dbName
+ term =3D '%s =3D %s' % (dbName, self.sqlrepr(value))
+ terms.append(term)
+ return ' AND '.join(terms)
=20
def sqlrepr(self, v):
return sqlrepr(v, self.dbName)
|