[SQL-CVS] SQLObject/SQLObject DBConnection.py,1.53,1.54 SQLBuilder.py,1.12,1.13 SQLObject.py,1.60,1.
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
From: <dre...@us...> - 2003-10-24 19:22:32
|
Update of /cvsroot/sqlobject/SQLObject/SQLObject In directory sc8-pr-cvs1:/tmp/cvs-serv16384 Modified Files: DBConnection.py SQLBuilder.py SQLObject.py Log Message: Added sqlrepr() classmethod to SQLObject (so you dont have to pass in 'db' if you have a class with a connection at hand). Fixed a bug in SQLExprConverter (missing argument). Fixed conversion to string on _addWhereClause (__str__ of SQLExpression calls __sqlrelr__ with db=None, so we use DBConnection.sqlrepr) Index: DBConnection.py =================================================================== RCS file: /cvsroot/sqlobject/SQLObject/SQLObject/DBConnection.py,v retrieving revision 1.53 retrieving revision 1.54 diff -C2 -d -r1.53 -r1.54 *** DBConnection.py 11 Oct 2003 07:39:43 -0000 1.53 --- DBConnection.py 24 Oct 2003 19:18:52 -0000 1.54 *************** *** 209,213 **** def _addWhereClause(self, select, startSelect, limit=1, order=1): ! q = str(select.clause) ops = select.ops --- 209,215 ---- def _addWhereClause(self, select, startSelect, limit=1, order=1): ! q = select.clause ! if type(q) not in [type(''), type(u'')]: ! q = self.sqlrepr(q) ops = select.ops *************** *** 791,795 **** # need to worry about that. pass ! def makeConnection(self): return kinterbasdb.connect( --- 793,797 ---- # need to worry about that. pass ! def makeConnection(self): return kinterbasdb.connect( *************** *** 868,872 **** (tableName, column.dbName)) ! def columnsFromSchema(self, tableName, soClass): """ --- 870,874 ---- (tableName, column.dbName)) ! def columnsFromSchema(self, tableName, soClass): """ *************** *** 884,890 **** RDB$FIELDS.RDB$FIELD_SUB_TYPE as blobtype FROM RDB$RELATION_FIELDS ! INNER JOIN RDB$FIELDS ON (RDB$RELATION_FIELDS.RDB$FIELD_SOURCE = RDB$FIELDS.RDB$FIELD_NAME) ! INNER JOIN RDB$TYPES ON (RDB$FIELDS.RDB$FIELD_TYPE = RDB$TYPES.RDB$TYPE) WHERE --- 886,892 ---- RDB$FIELDS.RDB$FIELD_SUB_TYPE as blobtype FROM RDB$RELATION_FIELDS ! INNER JOIN RDB$FIELDS ON (RDB$RELATION_FIELDS.RDB$FIELD_SOURCE = RDB$FIELDS.RDB$FIELD_NAME) ! INNER JOIN RDB$TYPES ON (RDB$FIELDS.RDB$FIELD_TYPE = RDB$TYPES.RDB$TYPE) WHERE *************** *** 906,910 **** _intTypes=['INT64', 'SHORT','LONG'] _dateTypes=['DATE','TIME','TIMESTAMP'] ! def guessClass(self, t, flength, fscale=None): """ --- 908,912 ---- _intTypes=['INT64', 'SHORT','LONG'] _dateTypes=['DATE','TIME','TIMESTAMP'] ! def guessClass(self, t, flength, fscale=None): """ *************** *** 913,917 **** available -- both very database-specific. """ ! if t in self._intTypes: return Col.IntCol, {} --- 915,919 ---- available -- both very database-specific. """ ! if t in self._intTypes: return Col.IntCol, {} Index: SQLBuilder.py =================================================================== RCS file: /cvsroot/sqlobject/SQLObject/SQLObject/SQLBuilder.py,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** SQLBuilder.py 11 Oct 2003 07:39:43 -0000 1.12 --- SQLBuilder.py 24 Oct 2003 19:18:52 -0000 1.13 *************** *** 188,192 **** ####################################### ! def SQLExprConverter(value): return value.__sqlrepr__() --- 188,192 ---- ####################################### ! def SQLExprConverter(value, db): return value.__sqlrepr__() Index: SQLObject.py =================================================================== RCS file: /cvsroot/sqlobject/SQLObject/SQLObject/SQLObject.py,v retrieving revision 1.60 retrieving revision 1.61 diff -C2 -d -r1.60 -r1.61 *** SQLObject.py 26 Sep 2003 20:05:14 -0000 1.60 --- SQLObject.py 24 Oct 2003 19:18:52 -0000 1.61 *************** *** 1026,1029 **** --- 1026,1034 ---- ' '.join(['%s=%s' % (name, repr(value)) for name, value in self._reprItems()])) + def sqlrepr(self, value): + return self._connection.sqlrepr(value) + + sqlrepr = classmethod(sqlrepr) + def _reprItems(self): items = [] |