Update of /cvsroot/sqlobject/SQLObject/SQLObject
In directory sc8-pr-cvs1:/tmp/cvs-serv11176/SQLObject
Modified Files:
Col.py DBConnection.py
Log Message:
Firebird fixes
Index: Col.py
===================================================================
RCS file: /cvsroot/sqlobject/SQLObject/SQLObject/Col.py,v
retrieving revision 1.28
retrieving revision 1.29
diff -C2 -d -r1.28 -r1.29
*** Col.py 26 Sep 2003 07:12:59 -0000 1.28
--- Col.py 27 Sep 2003 22:56:41 -0000 1.29
***************
*** 70,77 ****
self.customSQLType = sqlType
# if they don't give us a specific database name for
# the column, we separate the mixedCase into mixed_case
! # and assume that. @@: should be able to define
! # different policies for naming.
if dbName is None:
self.dbName = soClass._style.pythonAttrToDBColumn(self.name)
--- 70,87 ----
self.customSQLType = sqlType
+ self.foreignKey = foreignKey
+ if self.foreignKey:
+ #assert self.name.upper().endswith('ID'), "All foreign key columns must end with 'ID' (%s)" % repr(self.name)
+ if not self.name.upper().endswith('ID'):
+ self.foreignName = self.name
+ self.name = self.name + "ID"
+ else:
+ self.foreignName = self.name[:-2]
+ else:
+ self.foreignName = None
+
# if they don't give us a specific database name for
# the column, we separate the mixedCase into mixed_case
! # and assume that.
if dbName is None:
self.dbName = soClass._style.pythonAttrToDBColumn(self.name)
***************
*** 92,106 ****
self.unique = unique
- self.foreignKey = foreignKey
- if self.foreignKey:
- #assert self.name.upper().endswith('ID'), "All foreign key columns must end with 'ID' (%s)" % repr(self.name)
- if not self.name.upper().endswith('ID'):
- self.foreignName = self.name
- self.name = self.name + "ID"
- else:
- self.foreignName = self.name[:-2]
- else:
- self.foreignName = None
-
self.validator = validator
--- 102,105 ----
***************
*** 245,248 ****
--- 244,253 ----
return 'CHAR(%i)' % self.length
+ def _firebirdType(self):
+ if not self.length:
+ return 'BLOB SUB_TYPE TEXT'
+ else:
+ return self._sqlType()
+
class StringCol(Col):
baseClass = SOStringCol
***************
*** 361,364 ****
--- 366,372 ----
def _sqliteType(self):
+ return self._postgresType()
+
+ def _firebirdType(self):
return self._postgresType()
Index: DBConnection.py
===================================================================
RCS file: /cvsroot/sqlobject/SQLObject/SQLObject/DBConnection.py,v
retrieving revision 1.50
retrieving revision 1.51
diff -C2 -d -r1.50 -r1.51
*** DBConnection.py 26 Sep 2003 20:05:14 -0000 1.50
--- DBConnection.py 27 Sep 2003 22:56:41 -0000 1.51
***************
*** 760,763 ****
--- 760,778 ----
DBAPI.__init__(self, **kw)
+ def _runWithConnection(self, meth, *args):
+ conn = self.getConnection()
+ # @@: Horrible auto-commit implementation. Just horrible!
+ try:
+ conn.begin()
+ except kinterbasdb.ProgrammingError:
+ pass
+ val = meth(conn, *args)
+ try:
+ conn.commit()
+ except kinterbasdb.ProgrammingError:
+ pass
+ self.releaseConnection(conn)
+ return val
+
def makeConnection(self):
return kinterbasdb.connect(
***************
*** 777,784 ****
names = [idName] + names
values = [id] + values
! qry = self._insertSQL(table, names, values)
if self.debug:
self.printDebug(conn, q, 'QueryIns')
! self.query(qry)
if self.debugOutput:
self.printDebug(conn, id, 'QueryIns', 'result')
--- 792,799 ----
names = [idName] + names
values = [id] + values
! q = self._insertSQL(table, names, values)
if self.debug:
self.printDebug(conn, q, 'QueryIns')
! self.query(q)
if self.debugOutput:
self.printDebug(conn, id, 'QueryIns', 'result')
***************
*** 797,801 ****
match = self.limit_re.match(query)
if match and len(match.groups()) == 2:
! return ' '.join([limit_str, match.group(1)])
else:
return query
--- 812,816 ----
match = self.limit_re.match(query)
if match and len(match.groups()) == 2:
! return ' '.join([limit_str, match.group(2)])
else:
return query
|