sqlobject-cvs Mailing List for SQLObject (Page 173)
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...> - 2005-01-05 13:15:45
|
Author: phd Date: 2005-01-05 13:15:21 +0000 (Wed, 05 Jan 2005) New Revision: 513 Modified: trunk/SQLObject/sqlobject/col.py Log: Allowed sqlbuilder.SQLExpression and descendants in IntValidator. Modified: trunk/SQLObject/sqlobject/col.py =================================================================== --- trunk/SQLObject/sqlobject/col.py 2005-01-05 12:24:45 UTC (rev 512) +++ trunk/SQLObject/sqlobject/col.py 2005-01-05 13:15:21 UTC (rev 513) @@ -378,7 +378,7 @@ def fromPython(self, value, state): if value is None: return None - if not isinstance(value, (int, long)): + if not isinstance(value, (int, long, sqlbuilder.SQLExpression)): raise TypeError, "expected an int in the IntCol '%s', got %s instead" % \ (self.name, type(value)) return value @@ -386,7 +386,7 @@ def toPython(self, value, state): if value is None: return None - if not isinstance(value, (int, long)): + if not isinstance(value, (int, long, sqlbuilder.SQLExpression)): raise TypeError, "expected an int in the IntCol '%s', got %s instead" % \ (self.name, type(value)) return value |
From: <sub...@co...> - 2005-01-05 12:24:52
|
Author: phd Date: 2005-01-05 12:24:45 +0000 (Wed, 05 Jan 2005) New Revision: 512 Modified: trunk/SQLObject/sqlobject/col.py Log: Added IntValidator that tests if an IntCol got only int or long; raises TypeError if not. Modified: trunk/SQLObject/sqlobject/col.py =================================================================== --- trunk/SQLObject/sqlobject/col.py 2005-01-05 12:13:34 UTC (rev 511) +++ trunk/SQLObject/sqlobject/col.py 2005-01-05 12:24:45 UTC (rev 512) @@ -363,8 +363,7 @@ def __init__(self, **kw): self.dbEncoding = popKey(kw, 'dbEncoding', 'UTF-8') SOStringCol.__init__(self, **kw) - self.validator = validators.All.join( - self.createValidator(), self.validator) + self.validator = validators.All.join(self.createValidator(), self.validator) def createValidator(self): """Create a validator for the column. Can be overriden in descendants.""" @@ -373,13 +372,41 @@ class UnicodeCol(Col): baseClass = SOUnicodeCol + +class IntValidator(validators.Validator): + + def fromPython(self, value, state): + if value is None: + return None + if not isinstance(value, (int, long)): + raise TypeError, "expected an int in the IntCol '%s', got %s instead" % \ + (self.name, type(value)) + return value + + def toPython(self, value, state): + if value is None: + return None + if not isinstance(value, (int, long)): + raise TypeError, "expected an int in the IntCol '%s', got %s instead" % \ + (self.name, type(value)) + return value + class SOIntCol(SOCol): + validatorClass = IntValidator # can be overriden in descendants # 3-03 @@: support precision, maybe max and min directly + def __init__(self, **kw): + SOCol.__init__(self, **kw) + self.validator = validators.All.join(self.createValidator(), self.validator) + def autoConstraints(self): return [consts.isInt] + def createValidator(self): + """Create a validator for the column. Can be overriden in descendants.""" + return self.validatorClass(name=self.name) + def _sqlType(self): return 'INT' |
From: <sub...@co...> - 2005-01-05 12:13:40
|
Author: phd Date: 2005-01-05 12:13:34 +0000 (Wed, 05 Jan 2005) New Revision: 511 Modified: trunk/SQLObject/sqlobject/col.py Log: Do not convert str in UnicodeStringValidator.fromPython(); do not convert unicode in UnicodeStringValidator.toPython(). Modified: trunk/SQLObject/sqlobject/col.py =================================================================== --- trunk/SQLObject/sqlobject/col.py 2005-01-05 12:08:42 UTC (rev 510) +++ trunk/SQLObject/sqlobject/col.py 2005-01-05 12:13:34 UTC (rev 511) @@ -346,11 +346,15 @@ def fromPython(self, value, state): if value is None: return None + if isinstance(value, str): + return value return value.encode(self.db_encoding) def toPython(self, value, state): if value is None: return None + if isinstance(value, unicode): + return value return unicode(value, self.db_encoding) class SOUnicodeCol(SOStringCol): |
From: <sub...@co...> - 2005-01-05 12:08:48
|
Author: phd Date: 2005-01-05 12:08:42 +0000 (Wed, 05 Jan 2005) New Revision: 510 Modified: trunk/SQLObject/sqlobject/col.py Log: Applied the law of Demeter: a class should not name (instantiate) another class directly - the other class must be a parameter. Now UnicodeCol and BoolClo instantiate their validators using self.validatorClass; to allow even better flexibility the validator is created in the createValidator() method. Modified: trunk/SQLObject/sqlobject/col.py =================================================================== --- trunk/SQLObject/sqlobject/col.py 2005-01-05 11:43:06 UTC (rev 509) +++ trunk/SQLObject/sqlobject/col.py 2005-01-05 12:08:42 UTC (rev 510) @@ -354,13 +354,18 @@ return unicode(value, self.db_encoding) class SOUnicodeCol(SOStringCol): + validatorClass = UnicodeStringValidator # can be overriden in descendants def __init__(self, **kw): self.dbEncoding = popKey(kw, 'dbEncoding', 'UTF-8') SOStringCol.__init__(self, **kw) self.validator = validators.All.join( - UnicodeStringValidator(self.dbEncoding), self.validator) + self.createValidator(), self.validator) + def createValidator(self): + """Create a validator for the column. Can be overriden in descendants.""" + return self.validatorClass(self.dbEncoding) + class UnicodeCol(Col): baseClass = SOUnicodeCol @@ -392,14 +397,19 @@ return sqlbuilder.TRUE class SOBoolCol(SOCol): + validatorClass = BoolValidator # can be overriden in descendants def __init__(self, **kw): SOCol.__init__(self, **kw) - self.validator = validators.All.join(BoolValidator(), self.validator) + self.validator = validators.All.join(self.createValidator(), self.validator) def autoConstraints(self): return [consts.isBool] + def createValidator(self): + """Create a validator for the column. Can be overriden in descendants.""" + return self.validatorClass() + def _postgresType(self): return 'BOOL' |
From: <sub...@co...> - 2005-01-05 11:43:13
|
Author: phd Date: 2005-01-05 11:43:06 +0000 (Wed, 05 Jan 2005) New Revision: 509 Modified: home/phd/SQLObject/inheritance/docs/SQLObject.txt home/phd/SQLObject/inheritance/docs/build home/phd/SQLObject/inheritance/examples/personaddress.py Log: Merged patches from revisions 502:508 Modified: home/phd/SQLObject/inheritance/docs/SQLObject.txt =================================================================== --- home/phd/SQLObject/inheritance/docs/SQLObject.txt 2005-01-03 19:29:15 UTC (rev 508) +++ home/phd/SQLObject/inheritance/docs/SQLObject.txt 2005-01-05 11:43:06 UTC (rev 509) @@ -275,7 +275,20 @@ with non-database properties (there's no benefit, but it helps hide the difference between database and non-database attributes). +Lazy Updates +------------ +By default SQLObject sends an ``UPDATE`` to the database for every +attribute you set, or everytime you call ``.set()``. If you want to +avoid this many updates, add ``_lazyUpdate = True`` to your class +definition. Then updates will only be written to the database when +you call ``inst.syncUpdate()`` or ``obj.sync()``: ``.sync()`` also +refetches the data from the database, which ``.syncUpdate()`` does not +do. + +When enabled instances will have a property ``dirty``, which indicates +if there are pending updates. Inserts are still done immediately. + One-to-Many Relationships ------------------------- @@ -455,6 +468,18 @@ .. _`SQLBuilder documentation`: SQLBuilder.html +Select-By Method +~~~~~~~~~~~~~~~~ + +An alternative to ``.select`` is ``.selectBy``. It works like: + +.. raw:: html + :file: ../examples/snippets/person-select-by.html + +Each keyword argument is a column, and all the keyword arguments +are ANDed together. The return value is a `SelectResult`, so you +can slice it, count it, order it, etc. + Customizing the Objects ----------------------- @@ -1083,7 +1108,7 @@ column -- strings can go in integer columns, dates in integers, etc. SQLiteConnection doesn't support `automatic class generation`_ and -SQLite does not support `runtime column changes`_ or transactions_. +SQLite does not support `runtime column changes`_. SQLite may have concurrency issues, depending on your usage in a multi-threaded environment. Modified: home/phd/SQLObject/inheritance/docs/build =================================================================== --- home/phd/SQLObject/inheritance/docs/build 2005-01-03 19:29:15 UTC (rev 508) +++ home/phd/SQLObject/inheritance/docs/build 2005-01-05 11:43:06 UTC (rev 509) @@ -1,7 +1,7 @@ #!/bin/sh -pushd ../examples > /dev/null +cd ../examples ./examplestripper.py -popd > /dev/null +cd ../docs buildhtml.py --report=2 --prune=.svn --prune=europython --silent --no-toc-backlinks Modified: home/phd/SQLObject/inheritance/examples/personaddress.py =================================================================== --- home/phd/SQLObject/inheritance/examples/personaddress.py 2005-01-03 19:29:15 UTC (rev 508) +++ home/phd/SQLObject/inheritance/examples/personaddress.py 2005-01-05 11:43:06 UTC (rev 509) @@ -56,6 +56,11 @@ # SELECT person.id FROM person WHERE person.first_name = 'John'; ## end snippet +## Snippet "person-select-by" +peeps = Person.selectBy(firstName="John", lastName="Doe") +## end snippet +list(peeps) + ## Snippet "person-select2" peeps = Person.select( AND(Address.q.personID == Person.q.id, |
From: <sub...@co...> - 2004-12-30 17:05:30
|
Author: ianb Date: 2004-12-30 17:05:26 +0000 (Thu, 30 Dec 2004) New Revision: 506 Modified: trunk/SQLObject/docs/SQLObject.txt Log: Removed note that SQLite doesn't support transactions Modified: trunk/SQLObject/docs/SQLObject.txt =================================================================== --- trunk/SQLObject/docs/SQLObject.txt 2004-12-29 17:19:31 UTC (rev 505) +++ trunk/SQLObject/docs/SQLObject.txt 2004-12-30 17:05:26 UTC (rev 506) @@ -1108,7 +1108,7 @@ column -- strings can go in integer columns, dates in integers, etc. SQLiteConnection doesn't support `automatic class generation`_ and -SQLite does not support `runtime column changes`_ or transactions_. +SQLite does not support `runtime column changes`_. SQLite may have concurrency issues, depending on your usage in a multi-threaded environment. |
From: <sub...@co...> - 2004-12-29 17:19:33
|
Author: ianb Date: 2004-12-29 17:19:31 +0000 (Wed, 29 Dec 2004) New Revision: 505 Modified: trunk/SQLObject/docs/SQLObject.txt trunk/SQLObject/docs/build Log: * Fixed snippet reference * Made build use cd instead of pushd/popd Modified: trunk/SQLObject/docs/SQLObject.txt =================================================================== --- trunk/SQLObject/docs/SQLObject.txt 2004-12-29 17:02:51 UTC (rev 504) +++ trunk/SQLObject/docs/SQLObject.txt 2004-12-29 17:19:31 UTC (rev 505) @@ -474,7 +474,7 @@ An alternative to ``.select`` is ``.selectBy``. It works like: .. raw:: html - :file: ../examples/snippets/select-by.html + :file: ../examples/snippets/person-select-by.html Each keyword argument is a column, and all the keyword arguments are ANDed together. The return value is a `SelectResult`, so you Modified: trunk/SQLObject/docs/build =================================================================== --- trunk/SQLObject/docs/build 2004-12-29 17:02:51 UTC (rev 504) +++ trunk/SQLObject/docs/build 2004-12-29 17:19:31 UTC (rev 505) @@ -1,7 +1,7 @@ #!/bin/sh -pushd ../examples > /dev/null +cd ../examples ./examplestripper.py -popd > /dev/null +cd ../docs buildhtml.py --report=2 --prune=.svn --prune=europython --silent --no-toc-backlinks |
From: <sub...@co...> - 2004-12-29 17:03:27
|
Author: ianb Date: 2004-12-29 17:02:51 +0000 (Wed, 29 Dec 2004) New Revision: 504 Modified: trunk/SQLObject/docs/SQLObject.txt Log: Noted _lazyUpdate Modified: trunk/SQLObject/docs/SQLObject.txt =================================================================== --- trunk/SQLObject/docs/SQLObject.txt 2004-12-29 16:51:52 UTC (rev 503) +++ trunk/SQLObject/docs/SQLObject.txt 2004-12-29 17:02:51 UTC (rev 504) @@ -275,7 +275,20 @@ with non-database properties (there's no benefit, but it helps hide the difference between database and non-database attributes). +Lazy Updates +------------ +By default SQLObject sends an ``UPDATE`` to the database for every +attribute you set, or everytime you call ``.set()``. If you want to +avoid this many updates, add ``_lazyUpdate = True`` to your class +definition. Then updates will only be written to the database when +you call ``inst.syncUpdate()`` or ``obj.sync()``: ``.sync()`` also +refetches the data from the database, which ``.syncUpdate()`` does not +do. + +When enabled instances will have a property ``dirty``, which indicates +if there are pending updates. Inserts are still done immediately. + One-to-Many Relationships ------------------------- |
From: <sub...@co...> - 2004-12-29 16:51:59
|
Author: ianb Date: 2004-12-29 16:51:52 +0000 (Wed, 29 Dec 2004) New Revision: 503 Modified: trunk/SQLObject/docs/SQLObject.txt trunk/SQLObject/examples/personaddress.py Log: Added a note about .selectBy Modified: trunk/SQLObject/docs/SQLObject.txt =================================================================== --- trunk/SQLObject/docs/SQLObject.txt 2004-12-28 12:12:57 UTC (rev 502) +++ trunk/SQLObject/docs/SQLObject.txt 2004-12-29 16:51:52 UTC (rev 503) @@ -455,6 +455,18 @@ .. _`SQLBuilder documentation`: SQLBuilder.html +Select-By Method +~~~~~~~~~~~~~~~~ + +An alternative to ``.select`` is ``.selectBy``. It works like: + +.. raw:: html + :file: ../examples/snippets/select-by.html + +Each keyword argument is a column, and all the keyword arguments +are ANDed together. The return value is a `SelectResult`, so you +can slice it, count it, order it, etc. + Customizing the Objects ----------------------- Modified: trunk/SQLObject/examples/personaddress.py =================================================================== --- trunk/SQLObject/examples/personaddress.py 2004-12-28 12:12:57 UTC (rev 502) +++ trunk/SQLObject/examples/personaddress.py 2004-12-29 16:51:52 UTC (rev 503) @@ -56,6 +56,11 @@ # SELECT person.id FROM person WHERE person.first_name = 'John'; ## end snippet +## Snippet "person-select-by" +peeps = Person.selectBy(firstName="John", lastName="Doe") +## end snippet +list(peeps) + ## Snippet "person-select2" peeps = Person.select( AND(Address.q.personID == Person.q.id, |
From: <sub...@co...> - 2004-12-28 12:13:00
|
Author: phd Date: 2004-12-28 12:12:57 +0000 (Tue, 28 Dec 2004) New Revision: 502 Modified: home/phd/SQLObject/inheritance/sqlobject/main.py Log: Fixed a bug: put all needed classes into the tableRegistry before searching for parents. Modified: home/phd/SQLObject/inheritance/sqlobject/main.py =================================================================== --- home/phd/SQLObject/inheritance/sqlobject/main.py 2004-12-28 12:03:13 UTC (rev 501) +++ home/phd/SQLObject/inheritance/sqlobject/main.py 2004-12-28 12:12:57 UTC (rev 502) @@ -1351,10 +1351,13 @@ #DSM: and will do himself the relationship between classes. if type(self.clause) is not str: tableRegistry = {} - for registryClass in classregistry.registry(sourceClass._registry).allClasses(): + allClasses = classregistry.registry(sourceClass._registry).allClasses() + for registryClass in allClasses: if registryClass._table in tablesDict: - #DSM: By default, no parent are needed for the clauses + #DSM: By default, no parents are needed for the clauses tableRegistry[registryClass] = registryClass + for registryClass in allClasses: + if registryClass._table in tablesDict: currentClass = registryClass while currentClass._parentClass: currentClass = currentClass._parentClass |
From: <sub...@co...> - 2004-12-28 12:03:20
|
Author: phd Date: 2004-12-28 12:03:13 +0000 (Tue, 28 Dec 2004) New Revision: 501 Modified: home/phd/SQLObject/inheritance/tests/test_cache.py home/phd/SQLObject/inheritance/tests/test_converters.py Log: Merged the patch from revision 500: updated the cache and converters tests for SQLObject 0.6. Modified: home/phd/SQLObject/inheritance/tests/test_cache.py =================================================================== --- home/phd/SQLObject/inheritance/tests/test_cache.py 2004-12-28 12:01:53 UTC (rev 500) +++ home/phd/SQLObject/inheritance/tests/test_cache.py 2004-12-28 12:03:13 UTC (rev 501) @@ -1,5 +1,5 @@ import unittest -from SQLObject.Cache import CacheSet +from sqlobject.cache import CacheSet class Something(object): pass @@ -15,7 +15,7 @@ x.finishPut(y.__class__) j = x.get(1, y.__class__) self.assertEqual(j, y) - x.purge(1, y.__class__) + x.expire(1, y.__class__) j = x.get(1, y.__class__) self.assertEqual(j, None) x.finishPut(y.__class__) Modified: home/phd/SQLObject/inheritance/tests/test_converters.py =================================================================== --- home/phd/SQLObject/inheritance/tests/test_converters.py 2004-12-28 12:01:53 UTC (rev 500) +++ home/phd/SQLObject/inheritance/tests/test_converters.py 2004-12-28 12:03:13 UTC (rev 501) @@ -1,16 +1,16 @@ import unittest -from SQLObject.SQLBuilder import sqlrepr, TRUE, FALSE -from SQLObject.SQLBuilder import SQLExpression, SQLObjectField, \ +from sqlobject.sqlbuilder import sqlrepr, TRUE, FALSE +from sqlobject.sqlbuilder import SQLExpression, SQLObjectField, \ Select, Insert, Update, Delete, Replace, \ SQLTrueClauseClass, SQLConstant, SQLPrefix, SQLCall, SQLOp -from SQLObject.Converters import registerConverter +from sqlobject.converters import registerConverter class TestClass: def __repr__(self): return '<TestClass>' -def TestClassConverter(value): +def TestClassConverter(value, db): return repr(value) registerConverter(TestClass, TestClassConverter) @@ -22,15 +22,15 @@ def __repr__(self): return '<NewTestClass>' -def NewTestClassConverter(value): +def NewTestClassConverter(value, db): return repr(value) registerConverter(NewTestClass, NewTestClassConverter) -def _sqlrepr(self): +def _sqlrepr(self, db): return '<%s>' % self.__class__.__name__ -SQLExpression.sqlrepr = _sqlrepr +SQLExpression.__sqlrepr__ = _sqlrepr class ConvertersTest(unittest.TestCase): @@ -42,20 +42,20 @@ self.assertEqual(sqlrepr('A String\nAnother', 'sqlite'), "'A String\nAnother'") def test_string_tab(self): - self.assertEqual(sqlRepr('A String\tAnother', 'postgres'), "'A String\\tAnother'") + self.assertEqual(sqlrepr('A String\tAnother', 'postgres'), "'A String\\tAnother'") def test_string_r(self): - self.assertEqual(sqlRepr('A String\rAnother', 'postgres'), "'A String\\rAnother'") + self.assertEqual(sqlrepr('A String\rAnother', 'postgres'), "'A String\\rAnother'") def test_string_b(self): - self.assertEqual(sqlRepr('A String\bAnother', 'postgres'), "'A String\\bAnother'") + self.assertEqual(sqlrepr('A String\bAnother', 'postgres'), "'A String\\bAnother'") def test_string_000(self): - self.assertEqual(sqlRepr('A String\000Another', 'postgres'), "'A String\\0Another'") + self.assertEqual(sqlrepr('A String\000Another', 'postgres'), "'A String\\0Another'") def test_string_(self): - self.assertEqual(sqlRepr('A String\'Another', 'postgres'), "'A String\\\'Another'") - self.assertEqual(sqlRepr('A String\'Another', 'firebird'), "'A String''Another'") + self.assertEqual(sqlrepr('A String\'Another', 'postgres'), "'A String''Another'") + self.assertEqual(sqlrepr('A String\'Another', 'firebird'), "'A String''Another'") def test_simple_unicode(self): self.assertEqual(sqlrepr(u'A String', 'postgres'), "'A String'") @@ -76,10 +76,10 @@ self.assertEqual(sqlrepr(('one','two','three'), 'postgres'), "('one', 'two', 'three')") def test_bool(self): - self.assertEqual(sqlRepr(TRUE, 'postgres'), "'t'") - self.assertEqual(sqlRepr(FALSE, 'postgres'), "'f'") - self.assertEqual(sqlRepr(TRUE, 'mysql'), "1") - self.assertEqual(sqlRepr(FALSE, 'mysql'), "0") + self.assertEqual(sqlrepr(TRUE, 'postgres'), "'t'") + self.assertEqual(sqlrepr(FALSE, 'postgres'), "'f'") + self.assertEqual(sqlrepr(TRUE, 'mysql'), "1") + self.assertEqual(sqlrepr(FALSE, 'mysql'), "0") def test_instance(self): instance = TestClass() |
From: <sub...@co...> - 2004-12-28 12:02:00
|
Author: phd Date: 2004-12-28 12:01:53 +0000 (Tue, 28 Dec 2004) New Revision: 500 Modified: trunk/SQLObject/tests/test_cache.py trunk/SQLObject/tests/test_converters.py Log: Updated the cache and converters tests for SQLObject 0.6. Modified: trunk/SQLObject/tests/test_cache.py =================================================================== --- trunk/SQLObject/tests/test_cache.py 2004-12-28 08:59:18 UTC (rev 499) +++ trunk/SQLObject/tests/test_cache.py 2004-12-28 12:01:53 UTC (rev 500) @@ -1,5 +1,5 @@ import unittest -from SQLObject.Cache import CacheSet +from sqlobject.cache import CacheSet class Something(object): pass @@ -15,7 +15,7 @@ x.finishPut(y.__class__) j = x.get(1, y.__class__) self.assertEqual(j, y) - x.purge(1, y.__class__) + x.expire(1, y.__class__) j = x.get(1, y.__class__) self.assertEqual(j, None) x.finishPut(y.__class__) Modified: trunk/SQLObject/tests/test_converters.py =================================================================== --- trunk/SQLObject/tests/test_converters.py 2004-12-28 08:59:18 UTC (rev 499) +++ trunk/SQLObject/tests/test_converters.py 2004-12-28 12:01:53 UTC (rev 500) @@ -1,16 +1,16 @@ import unittest -from SQLObject.SQLBuilder import sqlrepr, TRUE, FALSE -from SQLObject.SQLBuilder import SQLExpression, SQLObjectField, \ +from sqlobject.sqlbuilder import sqlrepr, TRUE, FALSE +from sqlobject.sqlbuilder import SQLExpression, SQLObjectField, \ Select, Insert, Update, Delete, Replace, \ SQLTrueClauseClass, SQLConstant, SQLPrefix, SQLCall, SQLOp -from SQLObject.Converters import registerConverter +from sqlobject.converters import registerConverter class TestClass: def __repr__(self): return '<TestClass>' -def TestClassConverter(value): +def TestClassConverter(value, db): return repr(value) registerConverter(TestClass, TestClassConverter) @@ -22,15 +22,15 @@ def __repr__(self): return '<NewTestClass>' -def NewTestClassConverter(value): +def NewTestClassConverter(value, db): return repr(value) registerConverter(NewTestClass, NewTestClassConverter) -def _sqlrepr(self): +def _sqlrepr(self, db): return '<%s>' % self.__class__.__name__ -SQLExpression.sqlrepr = _sqlrepr +SQLExpression.__sqlrepr__ = _sqlrepr class ConvertersTest(unittest.TestCase): @@ -42,20 +42,20 @@ self.assertEqual(sqlrepr('A String\nAnother', 'sqlite'), "'A String\nAnother'") def test_string_tab(self): - self.assertEqual(sqlRepr('A String\tAnother', 'postgres'), "'A String\\tAnother'") + self.assertEqual(sqlrepr('A String\tAnother', 'postgres'), "'A String\\tAnother'") def test_string_r(self): - self.assertEqual(sqlRepr('A String\rAnother', 'postgres'), "'A String\\rAnother'") + self.assertEqual(sqlrepr('A String\rAnother', 'postgres'), "'A String\\rAnother'") def test_string_b(self): - self.assertEqual(sqlRepr('A String\bAnother', 'postgres'), "'A String\\bAnother'") + self.assertEqual(sqlrepr('A String\bAnother', 'postgres'), "'A String\\bAnother'") def test_string_000(self): - self.assertEqual(sqlRepr('A String\000Another', 'postgres'), "'A String\\0Another'") + self.assertEqual(sqlrepr('A String\000Another', 'postgres'), "'A String\\0Another'") def test_string_(self): - self.assertEqual(sqlRepr('A String\'Another', 'postgres'), "'A String\\\'Another'") - self.assertEqual(sqlRepr('A String\'Another', 'firebird'), "'A String''Another'") + self.assertEqual(sqlrepr('A String\'Another', 'postgres'), "'A String''Another'") + self.assertEqual(sqlrepr('A String\'Another', 'firebird'), "'A String''Another'") def test_simple_unicode(self): self.assertEqual(sqlrepr(u'A String', 'postgres'), "'A String'") @@ -76,10 +76,10 @@ self.assertEqual(sqlrepr(('one','two','three'), 'postgres'), "('one', 'two', 'three')") def test_bool(self): - self.assertEqual(sqlRepr(TRUE, 'postgres'), "'t'") - self.assertEqual(sqlRepr(FALSE, 'postgres'), "'f'") - self.assertEqual(sqlRepr(TRUE, 'mysql'), "1") - self.assertEqual(sqlRepr(FALSE, 'mysql'), "0") + self.assertEqual(sqlrepr(TRUE, 'postgres'), "'t'") + self.assertEqual(sqlrepr(FALSE, 'postgres'), "'f'") + self.assertEqual(sqlrepr(TRUE, 'mysql'), "1") + self.assertEqual(sqlrepr(FALSE, 'mysql'), "0") def test_instance(self): instance = TestClass() |
From: <sub...@co...> - 2004-12-28 08:59:22
|
Author: phd Date: 2004-12-28 08:59:18 +0000 (Tue, 28 Dec 2004) New Revision: 499 Modified: home/phd/SQLObject/inheritance/sqlobject/main.py Log: Added missed connection to addColumn. Modified: home/phd/SQLObject/inheritance/sqlobject/main.py =================================================================== --- home/phd/SQLObject/inheritance/sqlobject/main.py 2004-12-28 08:38:23 UTC (rev 498) +++ home/phd/SQLObject/inheritance/sqlobject/main.py 2004-12-28 08:59:18 UTC (rev 499) @@ -451,7 +451,7 @@ cls._SO_indexList.append(index) addIndex = classmethod(addIndex) - def addColumn(cls, columnDef, changeSchema=False, childUpdate=False): + def addColumn(cls, columnDef, changeSchema=False, connection=None, childUpdate=False): #DSM: Try to add parent properties to the current class #DSM: Only do this once if possible at object creation and once for #DSM: each new dynamic column to refresh the current class |
From: <sub...@co...> - 2004-12-28 08:38:28
|
Author: phd Date: 2004-12-28 08:38:23 +0000 (Tue, 28 Dec 2004) New Revision: 498 Modified: home/phd/SQLObject/inheritance/sqlobject/dbconnection.py Log: Merged a patch from revision 497: fixed a bug with tables that do not have columns (only MultipleJoins, e.g.) Modified: home/phd/SQLObject/inheritance/sqlobject/dbconnection.py =================================================================== --- home/phd/SQLObject/inheritance/sqlobject/dbconnection.py 2004-12-28 08:37:02 UTC (rev 497) +++ home/phd/SQLObject/inheritance/sqlobject/dbconnection.py 2004-12-28 08:38:23 UTC (rev 498) @@ -268,11 +268,16 @@ (cls._table, cls._idName, ", ".join(select.tables)) else: - q += "%s.%s, %s FROM %s WHERE " % \ - (cls._table, cls._idName, - ", ".join(["%s.%s" % (cls._table, col.dbName) - for col in cls._SO_columns]), - ", ".join(select.tables)) + columns = ", ".join(["%s.%s" % (cls._table, col.dbName) + for col in cls._SO_columns]) + if columns: + q += "%s.%s, %s FROM %s WHERE " % \ + (cls._table, cls._idName, columns, + ", ".join(select.tables)) + else: + q += "%s.%s FROM %s WHERE " % \ + (cls._table, cls._idName, + ", ".join(select.tables)) return self._addWhereClause(select, q) |
From: <sub...@co...> - 2004-12-28 08:37:05
|
Author: phd Date: 2004-12-28 08:37:02 +0000 (Tue, 28 Dec 2004) New Revision: 497 Modified: trunk/SQLObject/sqlobject/dbconnection.py Log: Fixed a bug with tables that do not have columns (only MultipleJoins, e.g.) Modified: trunk/SQLObject/sqlobject/dbconnection.py =================================================================== --- trunk/SQLObject/sqlobject/dbconnection.py 2004-12-28 08:25:11 UTC (rev 496) +++ trunk/SQLObject/sqlobject/dbconnection.py 2004-12-28 08:37:02 UTC (rev 497) @@ -268,11 +268,16 @@ (cls._table, cls._idName, ", ".join(select.tables)) else: - q += "%s.%s, %s FROM %s WHERE " % \ - (cls._table, cls._idName, - ", ".join(["%s.%s" % (cls._table, col.dbName) - for col in cls._SO_columns]), - ", ".join(select.tables)) + columns = ", ".join(["%s.%s" % (cls._table, col.dbName) + for col in cls._SO_columns]) + if columns: + q += "%s.%s, %s FROM %s WHERE " % \ + (cls._table, cls._idName, columns, + ", ".join(select.tables)) + else: + q += "%s.%s FROM %s WHERE " % \ + (cls._table, cls._idName, + ", ".join(select.tables)) return self._addWhereClause(select, q) |
From: <sub...@co...> - 2004-12-28 08:25:16
|
Author: phd Date: 2004-12-28 08:25:11 +0000 (Tue, 28 Dec 2004) New Revision: 496 Modified: home/phd/SQLObject/inheritance/sqlobject/dbconnection.py Log: Merged difference from revisions 493:495 Modified: home/phd/SQLObject/inheritance/sqlobject/dbconnection.py =================================================================== --- home/phd/SQLObject/inheritance/sqlobject/dbconnection.py 2004-12-27 17:24:24 UTC (rev 495) +++ home/phd/SQLObject/inheritance/sqlobject/dbconnection.py 2004-12-28 08:25:11 UTC (rev 496) @@ -442,22 +442,22 @@ self.sqlrepr(value)) for key, value in kw.items()]) - terms = [] - for key, value in kw.items(): - if hasattr(value, '_SO_joinDict'): #handle an object value - # find the joinColumn - for join in value._SO_joinDict.values(): - if join.otherClass is soClass: - dbName = join.joinColumn - break - else: #if nothing found - raise TypeError, "Cannot selectBy(%s=%r)" % (key, value) - value = value.id - else: - dbName = soClass._SO_columnDict[key].dbName - term = '%s = %s' % (dbName, self.sqlrepr(value)) - terms.append(term) - return ' AND '.join(terms) + terms = [] + for key, value in kw.items(): + if hasattr(value, '_SO_joinDict'): #handle an object value + # find the joinColumn + for join in value._SO_joinDict.values(): + if join.otherClass is soClass: + dbName = join.joinColumn + break + else: #if nothing found + raise TypeError, "Cannot selectBy(%s=%r)" % (key, value) + value = value.id + else: + dbName = soClass._SO_columnDict[key].dbName + term = '%s = %s' % (dbName, self.sqlrepr(value)) + terms.append(term) + return ' AND '.join(terms) def sqlrepr(self, v): return sqlrepr(v, self.dbName) |
From: <sub...@co...> - 2004-12-27 17:24:27
|
Author: ianb Date: 2004-12-27 17:24:24 +0000 (Mon, 27 Dec 2004) New Revision: 495 Modified: trunk/SQLObject/sqlobject/dbconnection.py Log: Got rid of tabs. Bad tabs! Modified: trunk/SQLObject/sqlobject/dbconnection.py =================================================================== --- trunk/SQLObject/sqlobject/dbconnection.py 2004-12-24 09:28:53 UTC (rev 494) +++ trunk/SQLObject/sqlobject/dbconnection.py 2004-12-27 17:24:24 UTC (rev 495) @@ -442,22 +442,22 @@ self.sqlrepr(value)) for key, value in kw.items()]) - terms = [] - for key, value in kw.items(): - if hasattr(value, '_SO_joinDict'): #handle an object value - # find the joinColumn - for join in value._SO_joinDict.values(): - if join.otherClass is soClass: - dbName = join.joinColumn - break - else: #if nothing found - raise TypeError, "Cannot selectBy(%s=%r)" % (key, value) - value = value.id - else: - dbName = soClass._SO_columnDict[key].dbName - term = '%s = %s' % (dbName, self.sqlrepr(value)) - terms.append(term) - return ' AND '.join(terms) + terms = [] + for key, value in kw.items(): + if hasattr(value, '_SO_joinDict'): #handle an object value + # find the joinColumn + for join in value._SO_joinDict.values(): + if join.otherClass is soClass: + dbName = join.joinColumn + break + else: #if nothing found + raise TypeError, "Cannot selectBy(%s=%r)" % (key, value) + value = value.id + else: + dbName = soClass._SO_columnDict[key].dbName + term = '%s = %s' % (dbName, self.sqlrepr(value)) + terms.append(term) + return ' AND '.join(terms) def sqlrepr(self, v): return sqlrepr(v, self.dbName) |
From: <sub...@co...> - 2004-12-24 09:28:58
|
Author: phd Date: 2004-12-24 09:28:53 +0000 (Fri, 24 Dec 2004) New Revision: 494 Modified: home/phd/SQLObject/inheritance/sqlobject/main.py Log: Extract tablesDict from orderBy in addition to clause. Modified: home/phd/SQLObject/inheritance/sqlobject/main.py =================================================================== --- home/phd/SQLObject/inheritance/sqlobject/main.py 2004-12-22 15:54:23 UTC (rev 493) +++ home/phd/SQLObject/inheritance/sqlobject/main.py 2004-12-24 09:28:53 UTC (rev 494) @@ -1340,6 +1340,9 @@ self.clause = clause tablesDict = sqlbuilder.tablesUsedDict(self.clause) tablesDict[sourceClass._table] = 1 + orderBy = ops.get('orderBy') + if orderBy and not isinstance(orderBy, basestring): + tablesDict.update(sqlbuilder.tablesUsedDict(orderBy)) #DSM: if this class has a parent, we need to link it #DSM: and be sure the parent is in the table list. #DSM: The following code is before clauseTables |
From: <sub...@co...> - 2004-12-16 14:23:51
|
Author: phd Date: 2004-12-16 14:23:48 +0000 (Thu, 16 Dec 2004) New Revision: 492 Modified: home/phd/SQLObject/inheritance/docs/Inheritance.txt Log: Minor fix for SQLObject 0.6 API. Modified: home/phd/SQLObject/inheritance/docs/Inheritance.txt =================================================================== --- home/phd/SQLObject/inheritance/docs/Inheritance.txt 2004-12-16 14:23:02 UTC (rev 491) +++ home/phd/SQLObject/inheritance/docs/Inheritance.txt 2004-12-16 14:23:48 UTC (rev 492) @@ -55,7 +55,7 @@ p = Person(firstName='John', lastName='Doe') e = Employee(firstName='Jane', lastName='Doe', position='Chief') - p2 = Person(1) + p2 = Person.get(1) Will create the following data in the database:: @@ -97,8 +97,8 @@ The SQLObject q magic also work. Using this select are valid:: - Employee.select(Employee.q.firstName == 'Jane' & Employee.q.position == 'Chief') will return Jane Doe - Employee.select(Person.q.firstName == 'Jane' & Employee.q.position == 'Chief') will return Jane Doe + Employee.select(AND(Employee.q.firstName == 'Jane' Employee.q.position == 'Chief')) will return Jane Doe + Employee.select(AND(Person.q.firstName == 'Jane', Employee.q.position == 'Chief')) will return Jane Doe Employee.select(Employee.q.lastName == 'Doe') will only return Jane Doe (as Joe isn't an employee) Person.select(Person.q.lastName == 'Doe') will return both entries. |
From: <sub...@co...> - 2004-12-16 14:23:09
|
Author: phd Date: 2004-12-16 14:23:02 +0000 (Thu, 16 Dec 2004) New Revision: 491 Modified: home/phd/SQLObject/inheritance/sqlobject/col.py Log: Merged patches from trunk revisions 484:490. Modified: home/phd/SQLObject/inheritance/sqlobject/col.py =================================================================== --- home/phd/SQLObject/inheritance/sqlobject/col.py 2004-12-15 23:30:17 UTC (rev 490) +++ home/phd/SQLObject/inheritance/sqlobject/col.py 2004-12-16 14:23:02 UTC (rev 491) @@ -386,7 +386,7 @@ return sqlbuilder.FALSE def toPython(self, value, state): - if not value or not int(value): + if not value: return sqlbuilder.FALSE else: return sqlbuilder.TRUE |
From: <sub...@co...> - 2004-12-15 16:39:56
|
Author: ianb Date: 2004-12-15 16:39:41 +0000 (Wed, 15 Dec 2004) New Revision: 488 Modified: trunk/SQLObject/sqlobject/col.py Log: Shouldn't try to convert values to integers when testing them for truth -- they may not be coerceable at all, and it's debatable whether '0' should be false. Modified: trunk/SQLObject/sqlobject/col.py =================================================================== --- trunk/SQLObject/sqlobject/col.py 2004-12-15 09:03:57 UTC (rev 487) +++ trunk/SQLObject/sqlobject/col.py 2004-12-15 16:39:41 UTC (rev 488) @@ -386,7 +386,7 @@ return sqlbuilder.FALSE def toPython(self, value, state): - if not value or not int(value): + if not value: return sqlbuilder.FALSE else: return sqlbuilder.TRUE |
From: <sub...@co...> - 2004-12-14 20:47:38
|
Author: phd Date: 2004-12-14 20:47:30 +0000 (Tue, 14 Dec 2004) New Revision: 484 Modified: home/phd/SQLObject/inheritance/docs/Inheritance.txt Log: Fixed a minor bug in SELECT. Modified: home/phd/SQLObject/inheritance/docs/Inheritance.txt =================================================================== --- home/phd/SQLObject/inheritance/docs/Inheritance.txt 2004-12-14 15:29:52 UTC (rev 483) +++ home/phd/SQLObject/inheritance/docs/Inheritance.txt 2004-12-14 20:47:30 UTC (rev 484) @@ -106,7 +106,7 @@ 'inherited' classes. These clauses are the link between the id and the parent id. This will look like the following request:: - SELECT employee.id, employee.first_name, employee.last_name + SELECT employee.id, person.first_name, person.last_name FROM person, employee WHERE person.first_name = 'Jane' AND employee.position = 'Chief' AND person.id = employee.id |
From: <sub...@co...> - 2004-12-14 15:29:59
|
Author: phd Date: 2004-12-14 15:29:52 +0000 (Tue, 14 Dec 2004) New Revision: 483 Modified: home/phd/SQLObject/inheritance/docs/News.txt Log: Merged patch for docs/News.txt from revisions 477:482 Modified: home/phd/SQLObject/inheritance/docs/News.txt =================================================================== --- home/phd/SQLObject/inheritance/docs/News.txt 2004-12-13 23:12:52 UTC (rev 482) +++ home/phd/SQLObject/inheritance/docs/News.txt 2004-12-14 15:29:52 UTC (rev 483) @@ -7,28 +7,14 @@ .. _start: -SQLObject 0.6.2 -=============== +SVN trunk +========= Interface Changes ----------------- * The long broken and unused ``DBMConnection`` has been removed. -* Removed DBMConnection. - -Features --------- - -* New ``UnicodeCol()`` that converts to and from Unicode - in the database. - -SQLObject 0.6.1 -=============== - -Interface Changes ------------------ - * Added a connection parameter to all class methods (patch 974755) * Connection objects have a ``.module`` attribute, which points to @@ -38,6 +24,11 @@ Features -------- +* New ``UnicodeCol()`` that converts to and from Unicode + in the database. See docs_. + +.. _docs: SQLObject.html#subclasses-of-col + * Added indexing (from Jeremy Fitzhardinge). See `the documentation`__ for more. |
From: <sub...@co...> - 2004-12-10 16:54:46
|
Author: ianb Date: 2004-12-10 16:54:44 +0000 (Fri, 10 Dec 2004) New Revision: 479 Modified: trunk/SQLObject/docs/News.txt Log: Combined 0.6.2 and 0.6.1; renamed 0.6.1 to News.txt Modified: trunk/SQLObject/docs/News.txt =================================================================== --- trunk/SQLObject/docs/News.txt 2004-12-10 16:52:05 UTC (rev 478) +++ trunk/SQLObject/docs/News.txt 2004-12-10 16:54:44 UTC (rev 479) @@ -7,28 +7,14 @@ .. _start: -SQLObject 0.6.2 -=============== +SVN trunk +========= Interface Changes ----------------- * The long broken and unused ``DBMConnection`` has been removed. -* Removed DBMConnection. - -Features --------- - -* New ``UnicodeCol()`` that converts to and from Unicode - in the database. - -SQLObject 0.6.1 -=============== - -Interface Changes ------------------ - * Added a connection parameter to all class methods (patch 974755) * Connection objects have a ``.module`` attribute, which points to @@ -38,6 +24,11 @@ Features -------- +* New ``UnicodeCol()`` that converts to and from Unicode + in the database. See docs_. + +.. _docs: SQLObject.html#subclasses-of-col + * Added indexing (from Jeremy Fitzhardinge). See `the documentation`__ for more. |
From: <sub...@co...> - 2004-12-10 14:01:04
|
Author: phd Date: 2004-12-10 14:01:00 +0000 (Fri, 10 Dec 2004) New Revision: 477 Modified: home/phd/SQLObject/inheritance/sqlobject/col.py Log: Merged patch from revision 475:476: fixed a bug in UnicodeStringValidator: test if the value is None. Modified: home/phd/SQLObject/inheritance/sqlobject/col.py =================================================================== --- home/phd/SQLObject/inheritance/sqlobject/col.py 2004-12-10 13:59:05 UTC (rev 476) +++ home/phd/SQLObject/inheritance/sqlobject/col.py 2004-12-10 14:01:00 UTC (rev 477) @@ -11,8 +11,8 @@ NoDefault = sqlbuilder.NoDefault True, False = 1==1, 0==1 - + ######################################## ## Columns ######################################## @@ -208,7 +208,7 @@ def _firebirdType(self): return self._sqlType() - + def _maxdbType(self): return self._sqlType() @@ -328,7 +328,7 @@ return 'BLOB SUB_TYPE TEXT' else: return self._sqlType() - + def _maxdbType(self): if not self.length: return 'LONG ASCII' @@ -344,9 +344,13 @@ self.db_encoding = db_encoding def fromPython(self, value, state): + if value is None: + return None return value.encode(self.db_encoding) def toPython(self, value, state): + if value is None: + return None return unicode(value, self.db_encoding) class SOUnicodeCol(SOStringCol): @@ -407,7 +411,7 @@ def _firebirdType(self): return 'INT' - + def _maxdbType(self): return "BOOLEAN" @@ -452,7 +456,7 @@ def _firebirdType(self): return 'INT' - + def _maxdbType(self): return 'INT' @@ -510,7 +514,7 @@ 'idName':idName}) sql = ' '.join([sql, reference]) return sql - + def maxdbCreateSQL(self): from main import findClass other = findClass(self.foreignKey) @@ -562,7 +566,7 @@ checkConstraint = "CHECK (%s in (%s))" % (self.dbName, enumValues) #NB. Return a tuple, not a string here return "VARCHAR(%i)" % (length), checkConstraint - + def _maxdbType(self): raise "Enum type is not supported" @@ -588,7 +592,7 @@ def _firebirdType(self): return 'TIMESTAMP' - + def _maxdbType(self): return 'TIMESTAMP' @@ -611,7 +615,7 @@ def _firebirdType(self): return 'DATE' - + def _maxdbType(self): return 'DATE' |