sqlobject-cvs Mailing List for SQLObject (Page 117)
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...> - 2006-10-12 13:55:48
|
Author: phd
Date: 2006-10-12 07:55:46 -0600 (Thu, 12 Oct 2006)
New Revision: 2018
Modified:
home/phd/SQLObject/paramstyles/sqlobject/firebird/firebirdconnection.py
home/phd/SQLObject/paramstyles/sqlobject/maxdb/maxdbconnection.py
home/phd/SQLObject/paramstyles/sqlobject/mssql/mssqlconnection.py
home/phd/SQLObject/paramstyles/sqlobject/mysql/mysqlconnection.py
home/phd/SQLObject/paramstyles/sqlobject/sybase/sybaseconnection.py
home/phd/SQLObject/paramstyles/sqlobject/tests/dbtest.py
home/phd/SQLObject/paramstyles/sqlobject/tests/test_auto.py
Log:
Merged patches from the revisions 2015:2017 from the trunk
Modified: home/phd/SQLObject/paramstyles/sqlobject/firebird/firebirdconnection.py
===================================================================
--- home/phd/SQLObject/paramstyles/sqlobject/firebird/firebirdconnection.py 2006-10-12 13:48:23 UTC (rev 2017)
+++ home/phd/SQLObject/paramstyles/sqlobject/firebird/firebirdconnection.py 2006-10-12 13:55:46 UTC (rev 2018)
@@ -196,6 +196,7 @@
continue
colClass, kw = self.guessClass(t, flength, fscale)
kw['name'] = soClass.sqlmeta.style.dbColumnToPythonAttr(field)
+ kw['dbName'] = field
kw['notNone'] = not nullAllowed
kw['default'] = thedefault
results.append(colClass(**kw))
Modified: home/phd/SQLObject/paramstyles/sqlobject/maxdb/maxdbconnection.py
===================================================================
--- home/phd/SQLObject/paramstyles/sqlobject/maxdb/maxdbconnection.py 2006-10-12 13:48:23 UTC (rev 2017)
+++ home/phd/SQLObject/paramstyles/sqlobject/maxdb/maxdbconnection.py 2006-10-12 13:55:46 UTC (rev 2018)
@@ -261,6 +261,7 @@
colClass, kw = self.guessClass(data_type,data_len,data_scale)
kw['name'] = field_name
+ kw['dbName'] = field
if nullAllowed == 'Y' :
nullAllowed=False
Modified: home/phd/SQLObject/paramstyles/sqlobject/mssql/mssqlconnection.py
===================================================================
--- home/phd/SQLObject/paramstyles/sqlobject/mssql/mssqlconnection.py 2006-10-12 13:48:23 UTC (rev 2017)
+++ home/phd/SQLObject/paramstyles/sqlobject/mssql/mssqlconnection.py 2006-10-12 13:55:46 UTC (rev 2018)
@@ -218,6 +218,7 @@
# precision is needed for decimal columns
colClass, kw = self.guessClass(t, size, precision, scale)
kw['name'] = soClass.sqlmeta.style.dbColumnToPythonAttr(field)
+ kw['dbName'] = field
kw['notNone'] = not nullAllowed
if (defaultText):
# Strip ( and )
Modified: home/phd/SQLObject/paramstyles/sqlobject/mysql/mysqlconnection.py
===================================================================
--- home/phd/SQLObject/paramstyles/sqlobject/mysql/mysqlconnection.py 2006-10-12 13:48:23 UTC (rev 2017)
+++ home/phd/SQLObject/paramstyles/sqlobject/mysql/mysqlconnection.py 2006-10-12 13:55:46 UTC (rev 2018)
@@ -194,6 +194,7 @@
colClass = col.UnicodeCol
if self.dbEncoding: kw['dbEncoding'] = self.dbEncoding
kw['name'] = soClass.sqlmeta.style.dbColumnToPythonAttr(field)
+ kw['dbName'] = field
kw['notNone'] = not nullAllowed
if default and t.startswith('int'):
kw['default'] = int(default)
Modified: home/phd/SQLObject/paramstyles/sqlobject/sybase/sybaseconnection.py
===================================================================
--- home/phd/SQLObject/paramstyles/sqlobject/sybase/sybaseconnection.py 2006-10-12 13:48:23 UTC (rev 2017)
+++ home/phd/SQLObject/paramstyles/sqlobject/sybase/sybaseconnection.py 2006-10-12 13:55:46 UTC (rev 2018)
@@ -144,6 +144,7 @@
continue
colClass, kw = self.guessClass(t)
kw['name'] = soClass.sqlmeta.style.dbColumnToPythonAttr(field)
+ kw['dbName'] = field
kw['notNone'] = not nullAllowed
kw['default'] = default
# @@ skip key...
Modified: home/phd/SQLObject/paramstyles/sqlobject/tests/dbtest.py
===================================================================
--- home/phd/SQLObject/paramstyles/sqlobject/tests/dbtest.py 2006-10-12 13:48:23 UTC (rev 2017)
+++ home/phd/SQLObject/paramstyles/sqlobject/tests/dbtest.py 2006-10-12 13:55:46 UTC (rev 2018)
@@ -36,7 +36,7 @@
'+exceptions': 'mysql sqlite',
'-transactions': 'mysql',
'-dropTableCascade': 'sybase mssql',
- '-fromDatabase': 'sqlite sybase firebird',
+ '-fromDatabase': 'sqlite',
'-expressionIndex': 'mysql sqlite firebird mssql',
'-blobData': 'mssql',
'-decimalColumn': 'mssql',
Modified: home/phd/SQLObject/paramstyles/sqlobject/tests/test_auto.py
===================================================================
--- home/phd/SQLObject/paramstyles/sqlobject/tests/test_auto.py 2006-10-12 13:48:23 UTC (rev 2017)
+++ home/phd/SQLObject/paramstyles/sqlobject/tests/test_auto.py 2006-10-12 13:55:46 UTC (rev 2018)
@@ -174,3 +174,7 @@
assert jane.longField == 'x'*1000
del classregistry.registry(
AutoTest.sqlmeta.registry).classes['AutoTest']
+
+ columns = AutoTest.sqlmeta.columns
+ assert columns["lastName"].dbName == "last_name"
+ assert columns["wannahavefun"].dbName == "wannahavefun"
|
|
From: <sub...@co...> - 2006-10-12 13:48:26
|
Author: phd
Date: 2006-10-12 07:48:23 -0600 (Thu, 12 Oct 2006)
New Revision: 2017
Modified:
SQLObject/branches/0.7-bugfix/sqlobject/firebird/firebirdconnection.py
SQLObject/branches/0.7-bugfix/sqlobject/maxdb/maxdbconnection.py
SQLObject/branches/0.7-bugfix/sqlobject/mssql/mssqlconnection.py
SQLObject/branches/0.7-bugfix/sqlobject/mysql/mysqlconnection.py
SQLObject/branches/0.7-bugfix/sqlobject/sybase/sybaseconnection.py
SQLObject/branches/0.7-bugfix/sqlobject/tests/dbtest.py
SQLObject/branches/0.7-bugfix/sqlobject/tests/test_auto.py
Log:
Get column's dbName from the DB.
Modified: SQLObject/branches/0.7-bugfix/sqlobject/firebird/firebirdconnection.py
===================================================================
--- SQLObject/branches/0.7-bugfix/sqlobject/firebird/firebirdconnection.py 2006-10-12 13:47:59 UTC (rev 2016)
+++ SQLObject/branches/0.7-bugfix/sqlobject/firebird/firebirdconnection.py 2006-10-12 13:48:23 UTC (rev 2017)
@@ -191,6 +191,7 @@
continue
colClass, kw = self.guessClass(t, flength, fscale)
kw['name'] = soClass.sqlmeta.style.dbColumnToPythonAttr(field)
+ kw['dbName'] = field
kw['notNone'] = not nullAllowed
kw['default'] = thedefault
results.append(colClass(**kw))
Modified: SQLObject/branches/0.7-bugfix/sqlobject/maxdb/maxdbconnection.py
===================================================================
--- SQLObject/branches/0.7-bugfix/sqlobject/maxdb/maxdbconnection.py 2006-10-12 13:47:59 UTC (rev 2016)
+++ SQLObject/branches/0.7-bugfix/sqlobject/maxdb/maxdbconnection.py 2006-10-12 13:48:23 UTC (rev 2017)
@@ -7,7 +7,7 @@
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
-connection creation sample
+connection creation sample
__connection__ = DBConnection.maxdbConnection(
host=hostname, database=dbname,
user=user_name, password=user_password,autoCommit=1,debug=1)
@@ -25,7 +25,7 @@
def __str__(self):
return repr(self.value)
-
+
class LowerBoundOfSliceIsNotSupported(maxdbException):
def __init__(self, value):
maxdbException.__init__(self, '')
@@ -51,14 +51,14 @@
self,
"No primary key was defined on table %r" % value)
-SAPDBMAX_ID_LENGTH=32
+SAPDBMAX_ID_LENGTH=32
class MaxdbConnection(DBAPI):
-
+
supportTransactions = True
dbName = 'maxdb'
schemes = [dbName]
-
+
def __init__ (self, user, password, database,
host='', autoCommit=1, sqlmode='internal',
isolation=None, timeout=None, **kw):
@@ -101,7 +101,7 @@
conn.__init__(self.user, self.password, self.database,
self.host,
**self._getConfigParams(self.sqlmode,auto))
-
+
def createSequenceName(self,table):
"""
sequence name are builded with the concatenation of the table
@@ -150,16 +150,16 @@
limit = ' ROWNO <= %d ' % (end)
return self.sqlAddLimit(query,limit)
-
+
def createTable(self, soClass):
#we create the table in a transaction because the addition of the
- #table and the sequence must be atomic
+ #table and the sequence must be atomic
- #i tried to use the transaction class but i get a recursion limit error
+ #i tried to use the transaction class but i get a recursion limit error
#t=self.transaction()
# t.query('CREATE TABLE %s (\n%s\n)' % \
# (soClass.sqlmeta.table, self.createColumns(soClass)))
- #
+ #
# t.query("CREATE SEQUENCE %s" % self.createSequenceName(soClass.sqlmeta.table))
# t.commit()
#so use transaction when the problem will be solved
@@ -167,7 +167,7 @@
(soClass.sqlmeta.table, self.createColumns(soClass)))
self.query("CREATE SEQUENCE %s"
% self.createSequenceName(soClass.sqlmeta.table))
-
+
def createColumn(self, soClass, col):
return col.maxdbCreateSQL()
@@ -179,7 +179,7 @@
def dropTable(self, tableName,cascade=False):
#we drop the table in a transaction because the removal of the
- #table and the sequence must be atomic
+ #table and the sequence must be atomic
#i tried to use the transaction class but i get a recursion limit error
# try:
# t=self.transaction()
@@ -219,7 +219,7 @@
GET_PK_AND_FK = """
SELECT constraint_cols.column_name, constraints.constraint_type,
refname,reftablename
- FROM user_cons_columns constraint_cols
+ FROM user_cons_columns constraint_cols
INNER JOIN user_constraints constraints
ON constraint_cols.constraint_name = constraints.constraint_name
LEFT OUTER JOIN show_foreign_key fk
@@ -239,7 +239,7 @@
pkmap[col_name]=False
if cons_type == 'R':
keymap[col_name]=reftable.lower()
-
+
elif cons_type == 'P':
pkmap[col_name]=True
@@ -250,14 +250,15 @@
data_scale) in colData:
# id is defined as primary key --> ok
# We let sqlobject raise error if the 'id' is used for another column
- field_name = field.lower()
+ field_name = field.lower()
if field_name == 'id' and pkmap[field_name]:
continue
-
+
colClass, kw = self.guessClass(data_type,data_len,data_scale)
kw['name'] = field_name
+ kw['dbName'] = field
- if nullAllowed == 'Y' :
+ if nullAllowed == 'Y' :
nullAllowed=False
else:
nullAllowed=True
@@ -270,9 +271,9 @@
kw['foreignKey'] = keymap[field_name]
results.append(colClass(**kw))
-
+
return results
-
+
_numericTypes=['INTEGER', 'INT','SMALLINT']
_dateTypes=['DATE','TIME','TIMESTAMP']
Modified: SQLObject/branches/0.7-bugfix/sqlobject/mssql/mssqlconnection.py
===================================================================
--- SQLObject/branches/0.7-bugfix/sqlobject/mssql/mssqlconnection.py 2006-10-12 13:47:59 UTC (rev 2016)
+++ SQLObject/branches/0.7-bugfix/sqlobject/mssql/mssqlconnection.py 2006-10-12 13:48:23 UTC (rev 2017)
@@ -213,6 +213,7 @@
# precision is needed for decimal columns
colClass, kw = self.guessClass(t, size, precision, scale)
kw['name'] = soClass.sqlmeta.style.dbColumnToPythonAttr(field)
+ kw['dbName'] = field
kw['notNone'] = not nullAllowed
if (defaultText):
# Strip ( and )
Modified: SQLObject/branches/0.7-bugfix/sqlobject/mysql/mysqlconnection.py
===================================================================
--- SQLObject/branches/0.7-bugfix/sqlobject/mysql/mysqlconnection.py 2006-10-12 13:47:59 UTC (rev 2016)
+++ SQLObject/branches/0.7-bugfix/sqlobject/mysql/mysqlconnection.py 2006-10-12 13:48:23 UTC (rev 2017)
@@ -157,6 +157,7 @@
if self.kw.get('use_unicode') and colClass is col.StringCol:
colClass = col.UnicodeCol
kw['name'] = soClass.sqlmeta.style.dbColumnToPythonAttr(field)
+ kw['dbName'] = field
kw['notNone'] = not nullAllowed
if default and t.startswith('int'):
kw['default'] = int(default)
Modified: SQLObject/branches/0.7-bugfix/sqlobject/sybase/sybaseconnection.py
===================================================================
--- SQLObject/branches/0.7-bugfix/sqlobject/sybase/sybaseconnection.py 2006-10-12 13:47:59 UTC (rev 2016)
+++ SQLObject/branches/0.7-bugfix/sqlobject/sybase/sybaseconnection.py 2006-10-12 13:48:23 UTC (rev 2017)
@@ -140,6 +140,7 @@
continue
colClass, kw = self.guessClass(t)
kw['name'] = soClass.sqlmeta.style.dbColumnToPythonAttr(field)
+ kw['dbName'] = field
kw['notNone'] = not nullAllowed
kw['default'] = default
# @@ skip key...
Modified: SQLObject/branches/0.7-bugfix/sqlobject/tests/dbtest.py
===================================================================
--- SQLObject/branches/0.7-bugfix/sqlobject/tests/dbtest.py 2006-10-12 13:47:59 UTC (rev 2016)
+++ SQLObject/branches/0.7-bugfix/sqlobject/tests/dbtest.py 2006-10-12 13:48:23 UTC (rev 2017)
@@ -35,7 +35,7 @@
'+restrictedEnum': 'postgres',
'-transactions': 'mysql',
'-dropTableCascade': 'sybase mssql',
- '-fromDatabase': 'sqlite sybase firebird',
+ '-fromDatabase': 'sqlite',
'-expressionIndex': 'mysql sqlite firebird mssql',
'-blobData': 'mssql',
'-decimalColumn': 'mssql',
Modified: SQLObject/branches/0.7-bugfix/sqlobject/tests/test_auto.py
===================================================================
--- SQLObject/branches/0.7-bugfix/sqlobject/tests/test_auto.py 2006-10-12 13:47:59 UTC (rev 2016)
+++ SQLObject/branches/0.7-bugfix/sqlobject/tests/test_auto.py 2006-10-12 13:48:23 UTC (rev 2017)
@@ -174,3 +174,7 @@
assert jane.longField == 'x'*1000
del classregistry.registry(
AutoTest.sqlmeta.registry).classes['AutoTest']
+
+ columns = AutoTest.sqlmeta.columns
+ assert columns["lastName"].dbName == "last_name"
+ assert columns["wannahavefun"].dbName == "wannahavefun"
|
|
From: <sub...@co...> - 2006-10-12 13:48:03
|
Author: phd
Date: 2006-10-12 07:47:59 -0600 (Thu, 12 Oct 2006)
New Revision: 2016
Modified:
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/sybase/sybaseconnection.py
SQLObject/trunk/sqlobject/tests/dbtest.py
SQLObject/trunk/sqlobject/tests/test_auto.py
Log:
Get column's dbName from the DB.
Modified: SQLObject/trunk/sqlobject/firebird/firebirdconnection.py
===================================================================
--- SQLObject/trunk/sqlobject/firebird/firebirdconnection.py 2006-10-11 20:42:16 UTC (rev 2015)
+++ SQLObject/trunk/sqlobject/firebird/firebirdconnection.py 2006-10-12 13:47:59 UTC (rev 2016)
@@ -196,6 +196,7 @@
continue
colClass, kw = self.guessClass(t, flength, fscale)
kw['name'] = soClass.sqlmeta.style.dbColumnToPythonAttr(field)
+ kw['dbName'] = field
kw['notNone'] = not nullAllowed
kw['default'] = thedefault
results.append(colClass(**kw))
Modified: SQLObject/trunk/sqlobject/maxdb/maxdbconnection.py
===================================================================
--- SQLObject/trunk/sqlobject/maxdb/maxdbconnection.py 2006-10-11 20:42:16 UTC (rev 2015)
+++ SQLObject/trunk/sqlobject/maxdb/maxdbconnection.py 2006-10-12 13:47:59 UTC (rev 2016)
@@ -261,6 +261,7 @@
colClass, kw = self.guessClass(data_type,data_len,data_scale)
kw['name'] = field_name
+ kw['dbName'] = field
if nullAllowed == 'Y' :
nullAllowed=False
Modified: SQLObject/trunk/sqlobject/mssql/mssqlconnection.py
===================================================================
--- SQLObject/trunk/sqlobject/mssql/mssqlconnection.py 2006-10-11 20:42:16 UTC (rev 2015)
+++ SQLObject/trunk/sqlobject/mssql/mssqlconnection.py 2006-10-12 13:47:59 UTC (rev 2016)
@@ -218,6 +218,7 @@
# precision is needed for decimal columns
colClass, kw = self.guessClass(t, size, precision, scale)
kw['name'] = soClass.sqlmeta.style.dbColumnToPythonAttr(field)
+ kw['dbName'] = field
kw['notNone'] = not nullAllowed
if (defaultText):
# Strip ( and )
Modified: SQLObject/trunk/sqlobject/mysql/mysqlconnection.py
===================================================================
--- SQLObject/trunk/sqlobject/mysql/mysqlconnection.py 2006-10-11 20:42:16 UTC (rev 2015)
+++ SQLObject/trunk/sqlobject/mysql/mysqlconnection.py 2006-10-12 13:47:59 UTC (rev 2016)
@@ -194,6 +194,7 @@
colClass = col.UnicodeCol
if self.dbEncoding: kw['dbEncoding'] = self.dbEncoding
kw['name'] = soClass.sqlmeta.style.dbColumnToPythonAttr(field)
+ kw['dbName'] = field
kw['notNone'] = not nullAllowed
if default and t.startswith('int'):
kw['default'] = int(default)
Modified: SQLObject/trunk/sqlobject/sybase/sybaseconnection.py
===================================================================
--- SQLObject/trunk/sqlobject/sybase/sybaseconnection.py 2006-10-11 20:42:16 UTC (rev 2015)
+++ SQLObject/trunk/sqlobject/sybase/sybaseconnection.py 2006-10-12 13:47:59 UTC (rev 2016)
@@ -144,6 +144,7 @@
continue
colClass, kw = self.guessClass(t)
kw['name'] = soClass.sqlmeta.style.dbColumnToPythonAttr(field)
+ kw['dbName'] = field
kw['notNone'] = not nullAllowed
kw['default'] = default
# @@ skip key...
Modified: SQLObject/trunk/sqlobject/tests/dbtest.py
===================================================================
--- SQLObject/trunk/sqlobject/tests/dbtest.py 2006-10-11 20:42:16 UTC (rev 2015)
+++ SQLObject/trunk/sqlobject/tests/dbtest.py 2006-10-12 13:47:59 UTC (rev 2016)
@@ -36,7 +36,7 @@
'+exceptions': 'mysql sqlite',
'-transactions': 'mysql',
'-dropTableCascade': 'sybase mssql',
- '-fromDatabase': 'sqlite sybase firebird',
+ '-fromDatabase': 'sqlite',
'-expressionIndex': 'mysql sqlite firebird mssql',
'-blobData': 'mssql',
'-decimalColumn': 'mssql',
Modified: SQLObject/trunk/sqlobject/tests/test_auto.py
===================================================================
--- SQLObject/trunk/sqlobject/tests/test_auto.py 2006-10-11 20:42:16 UTC (rev 2015)
+++ SQLObject/trunk/sqlobject/tests/test_auto.py 2006-10-12 13:47:59 UTC (rev 2016)
@@ -174,3 +174,7 @@
assert jane.longField == 'x'*1000
del classregistry.registry(
AutoTest.sqlmeta.registry).classes['AutoTest']
+
+ columns = AutoTest.sqlmeta.columns
+ assert columns["lastName"].dbName == "last_name"
+ assert columns["wannahavefun"].dbName == "wannahavefun"
|
|
From: Jolene D. <unq...@am...> - 2006-10-12 01:06:13
|
INV ESTORS WATCH OUT SBNS IS GETTING HIGHER WAT CH SBNS TRADE ON THURS OCT 12! Trade A lert: THUR SDAY, October 12, 2006 Company Name: SHALLBETTER INDS INC (Other OTC:SBNS.PK) Price: $0.95 STOCK: SBNS.PK 5-day Targ et: $10 NEWS * Shallbetter Industries, Inc. Provides Geological Info Relating To Initial Resource Property In Mongolia READ MORE ONLINE NOW! About SBNS: Shallbetter Industries Inc. (SII) is a publicly traded mining company engaging in the acquisition, exploration and potential development of mineral properties in Outer Mongolia. The company trades on the OTC market of the United States under the trading symbol SBNS. WATCH SBNS ON THURS OCT 12! THIS ONE IS SET TO POST HUGE GAINS AND RELEASE BREAKING NEWS! |
|
From: <sub...@co...> - 2006-10-11 20:42:20
|
Author: phd
Date: 2006-10-11 14:42:16 -0600 (Wed, 11 Oct 2006)
New Revision: 2015
Modified:
home/phd/SQLObject/paramstyles/sqlobject/tests/test_datetime.py
Log:
Merged patches from the revisions 2012:2014 from the trunk
Modified: home/phd/SQLObject/paramstyles/sqlobject/tests/test_datetime.py
===================================================================
--- home/phd/SQLObject/paramstyles/sqlobject/tests/test_datetime.py 2006-10-11 20:41:37 UTC (rev 2014)
+++ home/phd/SQLObject/paramstyles/sqlobject/tests/test_datetime.py 2006-10-11 20:42:16 UTC (rev 2015)
@@ -46,7 +46,8 @@
dateFormat = None # use default
if getConnection().dbName == "sqlite":
from sqlobject.sqlite.sqliteconnection import using_sqlite2
- if using_sqlite2: # PySQLite2 returns full date/time for a date
+ if using_sqlite2:
+ # mxDateTime sends and PySQLite2 returns full date/time for dates
dateFormat = "%Y-%m-%d %H:%M:%S"
class DateTime2(SQLObject):
@@ -71,9 +72,14 @@
assert dt2.col2.year == _now.year
assert dt2.col2.month == _now.month
assert dt2.col2.day == _now.day
- assert dt2.col1.hour == _now.hour
- assert dt2.col1.minute == _now.minute
- assert dt2.col1.second == int(_now.second)
+ if getConnection().dbName == "sqlite":
+ assert dt2.col2.hour == _now.hour
+ assert dt2.col2.minute == _now.minute
+ assert dt2.col2.second == int(_now.second)
+ else:
+ assert dt2.col2.hour == 0
+ assert dt2.col2.minute == 0
+ assert dt2.col2.second == 0
assert isinstance(dt2.col3, (col.DateTimeType, col.TimeType))
assert dt2.col3.hour == _now.hour
|
|
From: <sub...@co...> - 2006-10-11 20:41:43
|
Author: phd
Date: 2006-10-11 14:41:37 -0600 (Wed, 11 Oct 2006)
New Revision: 2014
Modified:
SQLObject/branches/0.7-bugfix/sqlobject/tests/test_datetime.py
Log:
Fixed a bug in the test.
Modified: SQLObject/branches/0.7-bugfix/sqlobject/tests/test_datetime.py
===================================================================
--- SQLObject/branches/0.7-bugfix/sqlobject/tests/test_datetime.py 2006-10-11 20:41:22 UTC (rev 2013)
+++ SQLObject/branches/0.7-bugfix/sqlobject/tests/test_datetime.py 2006-10-11 20:41:37 UTC (rev 2014)
@@ -46,7 +46,8 @@
dateFormat = None # use default
if getConnection().dbName == "sqlite":
from sqlobject.sqlite.sqliteconnection import using_sqlite2
- if using_sqlite2: # PySQLite2 returns full date/time for a date
+ if using_sqlite2:
+ # mxDateTime sends and PySQLite2 returns full date/time for dates
dateFormat = "%Y-%m-%d %H:%M:%S"
class DateTime2(SQLObject):
@@ -71,9 +72,14 @@
assert dt2.col2.year == _now.year
assert dt2.col2.month == _now.month
assert dt2.col2.day == _now.day
- assert dt2.col1.hour == _now.hour
- assert dt2.col1.minute == _now.minute
- assert dt2.col1.second == int(_now.second)
+ if getConnection().dbName == "sqlite":
+ assert dt2.col2.hour == _now.hour
+ assert dt2.col2.minute == _now.minute
+ assert dt2.col2.second == int(_now.second)
+ else:
+ assert dt2.col2.hour == 0
+ assert dt2.col2.minute == 0
+ assert dt2.col2.second == 0
assert isinstance(dt2.col3, (col.DateTimeType, col.TimeType))
assert dt2.col3.hour == _now.hour
|
|
From: <sub...@co...> - 2006-10-11 20:41:24
|
Author: phd
Date: 2006-10-11 14:41:22 -0600 (Wed, 11 Oct 2006)
New Revision: 2013
Modified:
SQLObject/trunk/sqlobject/tests/test_datetime.py
Log:
Fixed a bug in the test.
Modified: SQLObject/trunk/sqlobject/tests/test_datetime.py
===================================================================
--- SQLObject/trunk/sqlobject/tests/test_datetime.py 2006-10-11 20:08:50 UTC (rev 2012)
+++ SQLObject/trunk/sqlobject/tests/test_datetime.py 2006-10-11 20:41:22 UTC (rev 2013)
@@ -46,7 +46,8 @@
dateFormat = None # use default
if getConnection().dbName == "sqlite":
from sqlobject.sqlite.sqliteconnection import using_sqlite2
- if using_sqlite2: # PySQLite2 returns full date/time for a date
+ if using_sqlite2:
+ # mxDateTime sends and PySQLite2 returns full date/time for dates
dateFormat = "%Y-%m-%d %H:%M:%S"
class DateTime2(SQLObject):
@@ -71,9 +72,14 @@
assert dt2.col2.year == _now.year
assert dt2.col2.month == _now.month
assert dt2.col2.day == _now.day
- assert dt2.col1.hour == _now.hour
- assert dt2.col1.minute == _now.minute
- assert dt2.col1.second == int(_now.second)
+ if getConnection().dbName == "sqlite":
+ assert dt2.col2.hour == _now.hour
+ assert dt2.col2.minute == _now.minute
+ assert dt2.col2.second == int(_now.second)
+ else:
+ assert dt2.col2.hour == 0
+ assert dt2.col2.minute == 0
+ assert dt2.col2.second == 0
assert isinstance(dt2.col3, (col.DateTimeType, col.TimeType))
assert dt2.col3.hour == _now.hour
|
|
From: <sub...@co...> - 2006-10-11 20:08:52
|
Author: phd
Date: 2006-10-11 14:08:50 -0600 (Wed, 11 Oct 2006)
New Revision: 2012
Modified:
home/phd/SQLObject/paramstyles/sqlobject/sqlite/sqliteconnection.py
Log:
Merged patches from the revisions 2009:2011 from the trunk
Modified: home/phd/SQLObject/paramstyles/sqlobject/sqlite/sqliteconnection.py
===================================================================
--- home/phd/SQLObject/paramstyles/sqlobject/sqlite/sqliteconnection.py 2006-10-11 20:02:23 UTC (rev 2011)
+++ home/phd/SQLObject/paramstyles/sqlobject/sqlite/sqliteconnection.py 2006-10-11 20:08:50 UTC (rev 2012)
@@ -51,9 +51,9 @@
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":
- sqlite.register_converter(col_type, stop_pysqlite2_converting_strings_to_unicode)
- sqlite.register_converter(col_type.upper(), stop_pysqlite2_converting_strings_to_unicode)
+ for col_type in "text", "char", "varchar", "date", "time", "datetime", "timestamp":
+ sqlite.register_converter(col_type, stop_pysqlite2_converting_strings)
+ sqlite.register_converter(col_type.upper(), stop_pysqlite2_converting_strings)
try:
from sqlite import encode, decode
except ImportError:
@@ -263,5 +263,5 @@
def delColumn(self, tableName, column):
pass # Oops! There is no DROP COLUMN in SQLite
-def stop_pysqlite2_converting_strings_to_unicode(s):
+def stop_pysqlite2_converting_strings(s):
return s
|
|
From: <sub...@co...> - 2006-10-11 20:02:30
|
Author: phd
Date: 2006-10-11 14:02:23 -0600 (Wed, 11 Oct 2006)
New Revision: 2011
Modified:
SQLObject/trunk/sqlobject/sqlite/sqliteconnection.py
Log:
Stop PySQLite2 converting date/time columns - the conversion causes troubles,
and our conversion is more flexible.
Modified: SQLObject/trunk/sqlobject/sqlite/sqliteconnection.py
===================================================================
--- SQLObject/trunk/sqlobject/sqlite/sqliteconnection.py 2006-10-11 20:02:00 UTC (rev 2010)
+++ SQLObject/trunk/sqlobject/sqlite/sqliteconnection.py 2006-10-11 20:02:23 UTC (rev 2011)
@@ -51,9 +51,9 @@
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":
- sqlite.register_converter(col_type, stop_pysqlite2_converting_strings_to_unicode)
- sqlite.register_converter(col_type.upper(), stop_pysqlite2_converting_strings_to_unicode)
+ for col_type in "text", "char", "varchar", "date", "time", "datetime", "timestamp":
+ sqlite.register_converter(col_type, stop_pysqlite2_converting_strings)
+ sqlite.register_converter(col_type.upper(), stop_pysqlite2_converting_strings)
try:
from sqlite import encode, decode
except ImportError:
@@ -265,5 +265,5 @@
def delColumn(self, tableName, column):
pass # Oops! There is no DROP COLUMN in SQLite
-def stop_pysqlite2_converting_strings_to_unicode(s):
+def stop_pysqlite2_converting_strings(s):
return s
|
|
From: <sub...@co...> - 2006-10-11 20:02:16
|
Author: phd
Date: 2006-10-11 14:02:00 -0600 (Wed, 11 Oct 2006)
New Revision: 2010
Modified:
SQLObject/branches/0.7-bugfix/sqlobject/sqlite/sqliteconnection.py
Log:
Stop PySQLite2 converting date/time columns - the conversion causes troubles,
and our conversion is more flexible.
Modified: SQLObject/branches/0.7-bugfix/sqlobject/sqlite/sqliteconnection.py
===================================================================
--- SQLObject/branches/0.7-bugfix/sqlobject/sqlite/sqliteconnection.py 2006-10-11 14:45:43 UTC (rev 2009)
+++ SQLObject/branches/0.7-bugfix/sqlobject/sqlite/sqliteconnection.py 2006-10-11 20:02:00 UTC (rev 2010)
@@ -38,9 +38,9 @@
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":
- sqlite.register_converter(col_type, stop_pysqlite2_converting_strings_to_unicode)
- sqlite.register_converter(col_type.upper(), stop_pysqlite2_converting_strings_to_unicode)
+ for col_type in "text", "char", "varchar", "date", "time", "datetime", "timestamp":
+ sqlite.register_converter(col_type, stop_pysqlite2_converting_strings)
+ sqlite.register_converter(col_type.upper(), stop_pysqlite2_converting_strings)
try:
from sqlite import encode, decode
except ImportError:
@@ -213,5 +213,5 @@
def delColumn(self, tableName, column):
pass # Oops! There is no DROP COLUMN in SQLite
-def stop_pysqlite2_converting_strings_to_unicode(s):
+def stop_pysqlite2_converting_strings(s):
return s
|
|
From: SourceForge.net <no...@so...> - 2006-10-11 16:12:44
|
Bugs item #1567337, was opened at 2006-09-29 01:49 Message generated for change (Comment added) made by phd You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540672&aid=1567337&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: SQLObject release (specify) >Status: Closed >Resolution: Fixed Priority: 5 Submitted By: Viktor Ferenczi (complex) Assigned to: Nobody/Anonymous (nobody) Summary: Cannot install on Windows XP and Python 2.5 final Initial Comment: SQLObject 0.7.1, tar.gz version Install Python 2.5 final to D:\Python25 Extract SQLObject-0.7.1.tar.gz Install SQLObject: D:\Viktor\Fejlesztéshez\Python\SQLObject-0.7.1\SQLObject-0.7.1>d:\python25\pytho n setup.py install running install running bdist_egg running egg_info writing requirements to SQLObject.egg-info\requires.txt writing SQLObject.egg-info\PKG-INFO writing top-level names to SQLObject.egg-info\top_level.txt writing dependency_links to SQLObject.egg-info\dependency_links.txt reading manifest file 'SQLObject.egg-info\SOURCES.txt' reading manifest template 'MANIFEST.in' warning: no files found matching 'examples\*.py' warning: no files found matching '*.py' under directory 'tests' writing manifest file 'SQLObject.egg-info\SOURCES.txt' installing library code to build\bdist.win32\egg running install_lib running build_py creating build\bdist.win32\egg creating build\bdist.win32\egg\sqlobject copying build\lib\sqlobject\boundattributes.py -> build\bdist.win32\egg\sqlobjec t copying build\lib\sqlobject\cache.py -> build\bdist.win32\egg\sqlobject copying build\lib\sqlobject\classregistry.py -> build\bdist.win32\egg\sqlobject copying build\lib\sqlobject\col.py -> build\bdist.win32\egg\sqlobject copying build\lib\sqlobject\conftest.py -> build\bdist.win32\egg\sqlobject copying build\lib\sqlobject\constraints.py -> build\bdist.win32\egg\sqlobject copying build\lib\sqlobject\converters.py -> build\bdist.win32\egg\sqlobject copying build\lib\sqlobject\dbconnection.py -> build\bdist.win32\egg\sqlobject copying build\lib\sqlobject\declarative.py -> build\bdist.win32\egg\sqlobject creating build\bdist.win32\egg\sqlobject\firebird copying build\lib\sqlobject\firebird\firebirdconnection.py -> build\bdist.win32\ egg\sqlobject\firebird copying build\lib\sqlobject\firebird\__init__.py -> build\bdist.win32\egg\sqlobj ect\firebird copying build\lib\sqlobject\index.py -> build\bdist.win32\egg\sqlobject creating build\bdist.win32\egg\sqlobject\inheritance copying build\lib\sqlobject\inheritance\iteration.py -> build\bdist.win32\egg\sq lobject\inheritance copying build\lib\sqlobject\inheritance\__init__.py -> build\bdist.win32\egg\sql object\inheritance copying build\lib\sqlobject\joins.py -> build\bdist.win32\egg\sqlobject copying build\lib\sqlobject\main.py -> build\bdist.win32\egg\sqlobject creating build\bdist.win32\egg\sqlobject\manager copying build\lib\sqlobject\manager\command.py -> build\bdist.win32\egg\sqlobjec t\manager copying build\lib\sqlobject\manager\__init__.py -> build\bdist.win32\egg\sqlobje ct\manager creating build\bdist.win32\egg\sqlobject\maxdb copying build\lib\sqlobject\maxdb\maxdbconnection.py -> build\bdist.win32\egg\sq lobject\maxdb copying build\lib\sqlobject\maxdb\__init__.py -> build\bdist.win32\egg\sqlobject \maxdb creating build\bdist.win32\egg\sqlobject\mssql copying build\lib\sqlobject\mssql\mssqlconnection.py -> build\bdist.win32\egg\sq lobject\mssql copying build\lib\sqlobject\mssql\__init__.py -> build\bdist.win32\egg\sqlobject \mssql creating build\bdist.win32\egg\sqlobject\mysql copying build\lib\sqlobject\mysql\mysqlconnection.py -> build\bdist.win32\egg\sq lobject\mysql copying build\lib\sqlobject\mysql\__init__.py -> build\bdist.win32\egg\sqlobject \mysql creating build\bdist.win32\egg\sqlobject\postgres copying build\lib\sqlobject\postgres\pgconnection.py -> build\bdist.win32\egg\sq lobject\postgres copying build\lib\sqlobject\postgres\__init__.py -> build\bdist.win32\egg\sqlobj ect\postgres copying build\lib\sqlobject\sqlbuilder.py -> build\bdist.win32\egg\sqlobject creating build\bdist.win32\egg\sqlobject\sqlite copying build\lib\sqlobject\sqlite\sqliteconnection.py -> build\bdist.win32\egg\ sqlobject\sqlite copying build\lib\sqlobject\sqlite\__init__.py -> build\bdist.win32\egg\sqlobjec t\sqlite copying build\lib\sqlobject\sresults.py -> build\bdist.win32\egg\sqlobject copying build\lib\sqlobject\styles.py -> build\bdist.win32\egg\sqlobject creating build\bdist.win32\egg\sqlobject\sybase copying build\lib\sqlobject\sybase\sybaseconnection.py -> build\bdist.win32\egg\ sqlobject\sybase copying build\lib\sqlobject\sybase\__init__.py -> build\bdist.win32\egg\sqlobjec t\sybase creating build\bdist.win32\egg\sqlobject\util copying build\lib\sqlobject\util\backports.py -> build\bdist.win32\egg\sqlobject \util copying build\lib\sqlobject\util\moduleloader.py -> build\bdist.win32\egg\sqlobj ect\util copying build\lib\sqlobject\util\threadinglocal.py -> build\bdist.win32\egg\sqlo bject\util copying build\lib\sqlobject\util\__init__.py -> build\bdist.win32\egg\sqlobject\ util copying build\lib\sqlobject\__init__.py -> build\bdist.win32\egg\sqlobject byte-compiling build\bdist.win32\egg\sqlobject\boundattributes.py to boundattrib utes.pyc byte-compiling build\bdist.win32\egg\sqlobject\cache.py to cache.pyc byte-compiling build\bdist.win32\egg\sqlobject\classregistry.py to classregistry .pyc byte-compiling build\bdist.win32\egg\sqlobject\col.py to col.pyc byte-compiling build\bdist.win32\egg\sqlobject\conftest.py to conftest.pyc byte-compiling build\bdist.win32\egg\sqlobject\constraints.py to constraints.pyc byte-compiling build\bdist.win32\egg\sqlobject\converters.py to converters.pyc byte-compiling build\bdist.win32\egg\sqlobject\dbconnection.py to dbconnection.p yc byte-compiling build\bdist.win32\egg\sqlobject\declarative.py to declarative.pyc byte-compiling build\bdist.win32\egg\sqlobject\firebird\firebirdconnection.py to firebirdconnection.pyc byte-compiling build\bdist.win32\egg\sqlobject\firebird\__init__.py to __init__. pyc byte-compiling build\bdist.win32\egg\sqlobject\index.py to index.pyc byte-compiling build\bdist.win32\egg\sqlobject\inheritance\iteration.py to itera tion.pyc byte-compiling build\bdist.win32\egg\sqlobject\inheritance\__init__.py to __init __.pyc byte-compiling build\bdist.win32\egg\sqlobject\joins.py to joins.pyc byte-compiling build\bdist.win32\egg\sqlobject\main.py to main.pyc byte-compiling build\bdist.win32\egg\sqlobject\manager\command.py to command.pyc byte-compiling build\bdist.win32\egg\sqlobject\manager\__init__.py to __init__.p yc byte-compiling build\bdist.win32\egg\sqlobject\maxdb\maxdbconnection.py to maxdb connection.pyc byte-compiling build\bdist.win32\egg\sqlobject\maxdb\__init__.py to __init__.pyc byte-compiling build\bdist.win32\egg\sqlobject\mssql\mssqlconnection.py to mssql connection.pyc byte-compiling build\bdist.win32\egg\sqlobject\mssql\__init__.py to __init__.pyc byte-compiling build\bdist.win32\egg\sqlobject\mysql\mysqlconnection.py to mysql connection.pyc byte-compiling build\bdist.win32\egg\sqlobject\mysql\__init__.py to __init__.pyc byte-compiling build\bdist.win32\egg\sqlobject\postgres\pgconnection.py to pgcon nection.pyc byte-compiling build\bdist.win32\egg\sqlobject\postgres\__init__.py to __init__. pyc byte-compiling build\bdist.win32\egg\sqlobject\sqlbuilder.py to sqlbuilder.pyc byte-compiling build\bdist.win32\egg\sqlobject\sqlite\sqliteconnection.py to sql iteconnection.pyc byte-compiling build\bdist.win32\egg\sqlobject\sqlite\__init__.py to __init__.py c byte-compiling build\bdist.win32\egg\sqlobject\sresults.py to sresults.pyc byte-compiling build\bdist.win32\egg\sqlobject\styles.py to styles.pyc byte-compiling build\bdist.win32\egg\sqlobject\sybase\sybaseconnection.py to syb aseconnection.pyc byte-compiling build\bdist.win32\egg\sqlobject\sybase\__init__.py to __init__.py c byte-compiling build\bdist.win32\egg\sqlobject\util\backports.py to backports.py c byte-compiling build\bdist.win32\egg\sqlobject\util\moduleloader.py to moduleloa der.pyc byte-compiling build\bdist.win32\egg\sqlobject\util\threadinglocal.py to threadi nglocal.pyc byte-compiling build\bdist.win32\egg\sqlobject\util\__init__.py to __init__.pyc byte-compiling build\bdist.win32\egg\sqlobject\__init__.py to __init__.pyc creating build\bdist.win32\egg\EGG-INFO installing scripts to build\bdist.win32\egg\EGG-INFO\scripts running install_scripts running build_scripts creating build\bdist.win32\egg\EGG-INFO\scripts copying build\scripts-2.5\sqlobject-admin -> build\bdist.win32\egg\EGG-INFO\scri pts copying SQLObject.egg-info\PKG-INFO -> build\bdist.win32\egg\EGG-INFO copying SQLObject.egg-info\SOURCES.txt -> build\bdist.win32\egg\EGG-INFO copying SQLObject.egg-info\dependency_links.txt -> build\bdist.win32\egg\EGG-INF O copying SQLObject.egg-info\requires.txt -> build\bdist.win32\egg\EGG-INFO copying SQLObject.egg-info\top_level.txt -> build\bdist.win32\egg\EGG-INFO zip_safe flag not set; analyzing archive contents... sqlobject.classregistry: module references __file__ sqlobject.manager.command: module references __file__ creating 'dist\SQLObject-0.7.1-py2.5.egg' and adding 'build\bdist.win32\egg' to it removing 'build\bdist.win32\egg' (and everything under it) Processing SQLObject-0.7.1-py2.5.egg removing 'd:\python25\lib\site-packages\SQLObject-0.7.1-py2.5.egg' (and everythi ng under it) creating d:\python25\lib\site-packages\SQLObject-0.7.1-py2.5.egg Extracting SQLObject-0.7.1-py2.5.egg to d:\python25\lib\site-packages SQLObject 0.7.1 is already the active version in easy-install.pth Installing sqlobject-admin script to d:\python25\Scripts Installed d:\python25\lib\site-packages\sqlobject-0.7.1-py2.5.egg Processing dependencies for SQLObject==0.7.1 Searching for FormEncode>=0.2.2 Reading http://www.python.org/pypi/FormEncode/ Reading http://formencode.org Reading http://www.python.org/pypi/FormEncode/0.5.1 Best match: FormEncode 0.5.1 Downloading http://cheeseshop.python.org/packages/source/F/FormEncode/FormEncode -0.5.1.tar.gz#md5=f240217726f1962762bcf889a16f4450 Processing FormEncode-0.5.1.tar.gz Running FormEncode-0.5.1\setup.py -q bdist_egg --dist-dir c:\docume~1\fviktor\lo cals~1\temp\easy_install-cxtg_z\FormEncode-0.5.1\egg-dist-tmp-bj0-wp warning: no files found matching '*.py' under directory '.' Traceback (most recent call last): File "setup.py", line 67, in <module> 'sapdb': ['sapdb'], File "D:\Python25\Lib\distutils\core.py", line 151, in setup dist.run_commands() File "D:\Python25\Lib\distutils\dist.py", line 974, in run_commands self.run_command(cmd) File "D:\Python25\Lib\distutils\dist.py", line 994, in run_command cmd_obj.run() File "d:\python25\lib\site-packages\setuptools-0.6c3-py2.5.egg\setuptools\comm and\install.py", line 76, in run File "d:\python25\lib\site-packages\setuptools-0.6c3-py2.5.egg\setuptools\comm and\install.py", line 100, in do_egg_install File "d:\python25\lib\site-packages\setuptools-0.6c3-py2.5.egg\setuptools\comm and\easy_install.py", line 211, in run File "d:\python25\lib\site-packages\setuptools-0.6c3-py2.5.egg\setuptools\comm and\easy_install.py", line 427, in easy_install File "d:\python25\lib\site-packages\setuptools-0.6c3-py2.5.egg\setuptools\comm and\easy_install.py", line 473, in install_item File "d:\python25\lib\site-packages\setuptools-0.6c3-py2.5.egg\setuptools\comm and\easy_install.py", line 519, in process_distribution File "d:\python25\lib\site-packages\setuptools-0.6c3-py2.5.egg\pkg_resources.p y", line 481, in resolve File "d:\python25\lib\site-packages\setuptools-0.6c3-py2.5.egg\pkg_resources.p y", line 717, in best_match File "d:\python25\lib\site-packages\setuptools-0.6c3-py2.5.egg\pkg_resources.p y", line 729, in obtain File "d:\python25\lib\site-packages\setuptools-0.6c3-py2.5.egg\setuptools\comm and\easy_install.py", line 446, in easy_install File "d:\python25\lib\site-packages\setuptools-0.6c3-py2.5.egg\setuptools\comm and\easy_install.py", line 471, in install_item File "d:\python25\lib\site-packages\setuptools-0.6c3-py2.5.egg\setuptools\comm and\easy_install.py", line 655, in install_eggs File "d:\python25\lib\site-packages\setuptools-0.6c3-py2.5.egg\setuptools\comm and\easy_install.py", line 930, in build_and_install File "d:\python25\lib\site-packages\setuptools-0.6c3-py2.5.egg\setuptools\comm and\easy_install.py", line 919, in run_setup File "d:\python25\lib\site-packages\setuptools-0.6c3-py2.5.egg\setuptools\sand box.py", line 27, in run_setup File "d:\python25\lib\site-packages\setuptools-0.6c3-py2.5.egg\setuptools\sand box.py", line 63, in run File "d:\python25\lib\site-packages\setuptools-0.6c3-py2.5.egg\setuptools\sand box.py", line 29, in <lambda> File "setup.py", line 27, in <module> instances, and columns as attributes. File "D:\Python25\Lib\distutils\core.py", line 151, in setup dist.run_commands() File "D:\Python25\Lib\distutils\dist.py", line 974, in run_commands self.run_command(cmd) File "D:\Python25\Lib\distutils\dist.py", line 994, in run_command cmd_obj.run() File "d:\python25\lib\site-packages\setuptools-0.6c3-py2.5.egg\setuptools\comm and\bdist_egg.py", line 167, in run File "D:\Python25\Lib\distutils\cmd.py", line 333, in run_command self.distribution.run_command(command) File "D:\Python25\Lib\distutils\dist.py", line 994, in run_command cmd_obj.run() File "d:\python25\lib\site-packages\setuptools-0.6c3-py2.5.egg\setuptools\comm and\egg_info.py", line 171, in run File "d:\python25\lib\site-packages\setuptools-0.6c3-py2.5.egg\setuptools\comm and\egg_info.py", line 252, in find_sources File "d:\python25\lib\site-packages\setuptools-0.6c3-py2.5.egg\setuptools\comm and\egg_info.py", line 308, in run File "d:\python25\lib\site-packages\setuptools-0.6c3-py2.5.egg\setuptools\comm and\sdist.py", line 157, in read_template File "D:\Python25\Lib\distutils\command\sdist.py", line 335, in read_template self.filelist.process_template_line(line) File "D:\Python25\Lib\distutils\filelist.py", line 130, in process_template_li ne (action, patterns, dir, dir_pattern) = self._parse_template_line(line) File "D:\Python25\Lib\distutils\filelist.py", line 105, in _parse_template_lin e dir = convert_path(words[1]) File "D:\Python25\Lib\distutils\util.py", line 140, in convert_path raise ValueError, "path '%s' cannot end with '/'" % pathname ValueError: path 'docs/' cannot end with '/' ---------------------------------------------------------------------- >Comment By: Oleg Broytmann (phd) Date: 2006-10-11 20:12 Message: Logged In: YES user_id=4799 The problem has been fixed in FormEncode 0.6. Please investigate why setup.py is trying to download FormEncode 0.5.1. ---------------------------------------------------------------------- Comment By: Nobody/Anonymous (nobody) Date: 2006-09-29 21:01 Message: Logged In: NO This is a Windows/2.5/FormEncode/MANIFEST.in problem. If you can do "easy_install FormEncode==dev" that should fix it. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540672&aid=1567337&group_id=74338 |
|
From: <sub...@co...> - 2006-10-11 14:45:48
|
Author: phd
Date: 2006-10-11 08:45:43 -0600 (Wed, 11 Oct 2006)
New Revision: 2009
Modified:
home/phd/SQLObject/paramstyles/sqlobject/col.py
home/phd/SQLObject/paramstyles/sqlobject/tests/test_enum.py
Log:
Merged patches from the revisions 2005:2008 from the trunk
Modified: home/phd/SQLObject/paramstyles/sqlobject/col.py
===================================================================
--- home/phd/SQLObject/paramstyles/sqlobject/col.py 2006-10-11 14:43:45 UTC (rev 2008)
+++ home/phd/SQLObject/paramstyles/sqlobject/col.py 2006-10-11 14:45:43 UTC (rev 2009)
@@ -882,7 +882,12 @@
super(SOEnumCol, self).createValidators()
def _mysqlType(self):
- return "ENUM(%s)" % ', '.join([sqlbuilder.sqlrepr(v, 'mysql') for v in self.enumValues])
+ # We need to map None in the enum expression to an appropriate
+ # condition on NULL
+ if None in self.enumValues:
+ return "ENUM(%s)" % ', '.join([sqlbuilder.sqlrepr(v, 'mysql') for v in self.enumValues if v is not None])
+ else:
+ return "ENUM(%s) NOT NULL" % ', '.join([sqlbuilder.sqlrepr(v, 'mysql') for v in self.enumValues])
def _postgresType(self):
length = max(map(self._getlength, self.enumValues))
Modified: home/phd/SQLObject/paramstyles/sqlobject/tests/test_enum.py
===================================================================
--- home/phd/SQLObject/paramstyles/sqlobject/tests/test_enum.py 2006-10-11 14:43:45 UTC (rev 2008)
+++ home/phd/SQLObject/paramstyles/sqlobject/tests/test_enum.py 2006-10-11 14:45:43 UTC (rev 2009)
@@ -27,5 +27,25 @@
def testNone():
setupClass(EnumWithNone)
for l in [None, 'a', 'bcd', 'a', 'e', None]:
- EnumWithNone(l=l)
-
+ e = EnumWithNone(l=l)
+ assert e.l == l
+
+class EnumWithDefaultNone(SQLObject):
+
+ l = EnumCol(enumValues=['a', 'bcd', 'e', None], default=None)
+
+def testDefaultNone():
+ setupClass(EnumWithDefaultNone)
+
+ e = EnumWithDefaultNone()
+ assert e.l == None
+
+class EnumWithDefaultOther(SQLObject):
+
+ l = EnumCol(enumValues=['a', 'bcd', 'e', None], default='a')
+
+def testDefaultOther():
+ setupClass(EnumWithDefaultOther)
+
+ e = EnumWithDefaultOther()
+ assert e.l == 'a'
|
|
From: SourceForge.net <no...@so...> - 2006-10-11 14:44:19
|
Bugs item #1496014, was opened at 2006-05-27 18:42 Message generated for change (Comment added) made by phd You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540672&aid=1496014&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: SQLObject release (specify) >Status: Closed >Resolution: Accepted Priority: 5 Submitted By: Neil Muller (nitwit) >Assigned to: Oleg Broytmann (phd) Summary: None in enumValues fails Initial Comment: SQLObject-0.7.1b1 MySQL does not allow NULL inside the ENUM statemnt, so the construction EnumCol(enumValues=['a','b',None],default=None) will fail. Since this construction works fine with sqlite and postgresql, this is an issue. The attached patch fixes the problem here. ---------------------------------------------------------------------- >Comment By: Oleg Broytmann (phd) Date: 2006-10-11 18:44 Message: Logged In: YES user_id=4799 There are many minor problems with the patch - wrong indent, forgotten ':' after 'else', etc. I fixed all of them, applied and committed in the revisions 2006-2008. Thank you! ---------------------------------------------------------------------- Comment By: Neil Muller (nitwit) Date: 2006-09-07 20:44 Message: Logged In: YES user_id=698097 I've already conceded that the earlier proposed patch was incorrect, so that currently won't happen. With the mysql_enum patch I'm currently proposing, the result for databases other than MySQL shouldn't change from what currently happens. The mysql_enum patch aims to map the the present of None in the EnumCol to a NULL constraint on the column as this seems, based on the MySQL documentation, the only way of specifying wether NULL's are accepted or not for ENUM's. The obvious alternative is to disallow None's in EnumCol's when using MySQL entirely, but that seems to be the sort of database specific behaviour SQLObject should be hiding from the user. The proposed enum_doc_patch tries to describe the potential pitfall of using the EnumCols('a','b',None) construction with postgresql, but doesn't change the behaviour at all. I'd be happy to add a warning to the code as well if that would be preffered. I've left the other databases alone since I can't readily test them. ---------------------------------------------------------------------- Comment By: Oleg Broytmann (phd) Date: 2006-09-07 19:49 Message: Logged In: YES user_id=4799 But what if a user wrtes EnumCol(enumValues=['a','b',None],default=None) and got create table t (c1 varchar(2) check (c1 in ('a','b'))); ??? Wouldn't it surpize him/her? Wouldn't it be better to raise an error instead of silently hiding it? ---------------------------------------------------------------------- Comment By: Neil Muller (nitwit) Date: 2006-09-06 01:33 Message: Logged In: YES user_id=698097 The second issue only applies if a postgresql database is being accessed without using sqlobject as well. he check constraint approach used doesn't work as expected for postgresql. EnumCol(enumValues=['a','b',None],default=None) produces something like: create table t (c1 varchar(2) check (c1 in ('a','b',NULL))); However: insert into t values ('1'); will succeed, because of how postgresql interprets conditions involving NULL, as discussed in the message I linked to. Similiar issues may arise with other databases. However, since the call succeeds, a documentation note is probably adequate. I've attached a possible patch to SQLObject.txt as enum_doc_patch, although this probably needs furtehr work. ---------------------------------------------------------------------- Comment By: Neil Muller (nitwit) Date: 2006-09-06 01:16 Message: Logged In: YES user_id=698097 I've unfortunately combined two issues here, and I'll agree that the second patch is incorrect. There is an actual bug here. The current sqlobject logic breaks on mysql: The construction: EnumCol(enumValues=['a','b',None],default=None) maps to CREATE TABLE t (c1 ENUM ('a','b',NULL)); which is not valid for MySQL, which wants NULL's for ENUM columns handled as NULL constraints. This makes using None in the EnumCol impossible for MySQL. The mysql_enum patch attached aims to create a suitable constraint if None is present EnumCol. ---------------------------------------------------------------------- Comment By: Oleg Broytmann (phd) Date: 2006-09-05 17:57 Message: Logged In: YES user_id=4799 This contradicts to Python philoshy "We all are grown-ups people". If you know None (NULL) in enums is such a bad idea - just dont use it. But forcibly remove it when the user clearly states "I want my Nones here" is too much. Instead of such removing write a documentation patch and clearly explain the caveats. ---------------------------------------------------------------------- Comment By: Neil Muller (nitwit) Date: 2006-05-30 00:39 Message: Logged In: YES user_id=698097 I was pointed at http://archives.postgresql.org/pgsql-sql/2004-12/msg00065.php, which illustrates that NULL in the check constraint approach used to implement EnumCol for postges and other databases behave in an unexpected way due to the three state logic SQL uses. Thus a believe this second patch, which excludes Nones from all the database backends should be prefferred. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540672&aid=1496014&group_id=74338 |
|
From: <sub...@co...> - 2006-10-11 14:43:49
|
Author: phd
Date: 2006-10-11 08:43:45 -0600 (Wed, 11 Oct 2006)
New Revision: 2008
Modified:
SQLObject/docs/SQLObject.txt
Log:
Documentation patche from the bug 1496014: None in enumValues fails.
Modified: SQLObject/docs/SQLObject.txt
===================================================================
--- SQLObject/docs/SQLObject.txt 2006-10-11 14:43:12 UTC (rev 2007)
+++ SQLObject/docs/SQLObject.txt 2006-10-11 14:43:45 UTC (rev 2008)
@@ -1099,6 +1099,13 @@
``ENUM`` type, but will work with other databases too (storage
just won't be as efficient).
+ For PostgreSQL, EnumCol's are implemented using check constraints.
+ Due to the way PostgreSQL handles check constraints involving NULL,
+ specifying None as a member of an EnumCol will effectively mean that,
+ at the SQL level, the check constraint will be ignored (see
+ http://archives.postgresql.org/pgsql-sql/2004-12/msg00065.php for
+ more details).
+
`FloatCol`:
Floats.
|
|
From: <sub...@co...> - 2006-10-11 14:43:14
|
Author: phd
Date: 2006-10-11 08:43:12 -0600 (Wed, 11 Oct 2006)
New Revision: 2007
Modified:
SQLObject/trunk/sqlobject/col.py
SQLObject/trunk/sqlobject/tests/test_enum.py
Log:
Applied patches for the bug 1496014: None in enumValues fails.
Additional tests by Nathan Edwards <ned...@um...>.
Modified: SQLObject/trunk/sqlobject/col.py
===================================================================
--- SQLObject/trunk/sqlobject/col.py 2006-10-11 14:42:35 UTC (rev 2006)
+++ SQLObject/trunk/sqlobject/col.py 2006-10-11 14:43:12 UTC (rev 2007)
@@ -882,7 +882,12 @@
super(SOEnumCol, self).createValidators()
def _mysqlType(self):
- return "ENUM(%s)" % ', '.join([sqlbuilder.sqlrepr(v, 'mysql') for v in self.enumValues])
+ # We need to map None in the enum expression to an appropriate
+ # condition on NULL
+ if None in self.enumValues:
+ return "ENUM(%s)" % ', '.join([sqlbuilder.sqlrepr(v, 'mysql') for v in self.enumValues if v is not None])
+ else:
+ return "ENUM(%s) NOT NULL" % ', '.join([sqlbuilder.sqlrepr(v, 'mysql') for v in self.enumValues])
def _postgresType(self):
length = max(map(self._getlength, self.enumValues))
Modified: SQLObject/trunk/sqlobject/tests/test_enum.py
===================================================================
--- SQLObject/trunk/sqlobject/tests/test_enum.py 2006-10-11 14:42:35 UTC (rev 2006)
+++ SQLObject/trunk/sqlobject/tests/test_enum.py 2006-10-11 14:43:12 UTC (rev 2007)
@@ -27,5 +27,25 @@
def testNone():
setupClass(EnumWithNone)
for l in [None, 'a', 'bcd', 'a', 'e', None]:
- EnumWithNone(l=l)
-
+ e = EnumWithNone(l=l)
+ assert e.l == l
+
+class EnumWithDefaultNone(SQLObject):
+
+ l = EnumCol(enumValues=['a', 'bcd', 'e', None], default=None)
+
+def testDefaultNone():
+ setupClass(EnumWithDefaultNone)
+
+ e = EnumWithDefaultNone()
+ assert e.l == None
+
+class EnumWithDefaultOther(SQLObject):
+
+ l = EnumCol(enumValues=['a', 'bcd', 'e', None], default='a')
+
+def testDefaultOther():
+ setupClass(EnumWithDefaultOther)
+
+ e = EnumWithDefaultOther()
+ assert e.l == 'a'
|
|
From: <sub...@co...> - 2006-10-11 14:42:42
|
Author: phd
Date: 2006-10-11 08:42:35 -0600 (Wed, 11 Oct 2006)
New Revision: 2006
Modified:
SQLObject/branches/0.7-bugfix/docs/SQLObject.txt
SQLObject/branches/0.7-bugfix/sqlobject/col.py
SQLObject/branches/0.7-bugfix/sqlobject/tests/test_enum.py
Log:
Applied patches for the bug 1496014: None in enumValues fails.
Additional tests by Nathan Edwards <ned...@um...>.
Modified: SQLObject/branches/0.7-bugfix/docs/SQLObject.txt
===================================================================
--- SQLObject/branches/0.7-bugfix/docs/SQLObject.txt 2006-10-10 20:21:19 UTC (rev 2005)
+++ SQLObject/branches/0.7-bugfix/docs/SQLObject.txt 2006-10-11 14:42:35 UTC (rev 2006)
@@ -1098,6 +1098,13 @@
``ENUM`` type, but will work with other databases too (storage
just won't be as efficient).
+ For PostgreSQL, EnumCol's are implemented using check constraints.
+ Due to the way PostgreSQL handles check constraints involving NULL,
+ specifying None as a member of an EnumCol will effectively mean that,
+ at the SQL level, the check constraint will be ignored (see
+ http://archives.postgresql.org/pgsql-sql/2004-12/msg00065.php for
+ more details).
+
`FloatCol`:
Floats.
Modified: SQLObject/branches/0.7-bugfix/sqlobject/col.py
===================================================================
--- SQLObject/branches/0.7-bugfix/sqlobject/col.py 2006-10-10 20:21:19 UTC (rev 2005)
+++ SQLObject/branches/0.7-bugfix/sqlobject/col.py 2006-10-11 14:42:35 UTC (rev 2006)
@@ -869,7 +869,12 @@
super(SOEnumCol, self).createValidators()
def _mysqlType(self):
- return "ENUM(%s)" % ', '.join([sqlbuilder.sqlrepr(v, 'mysql') for v in self.enumValues])
+ # We need to map None in the enum expression to an appropriate
+ # condition on NULL
+ if None in self.enumValues:
+ return "ENUM(%s)" % ', '.join([sqlbuilder.sqlrepr(v, 'mysql') for v in self.enumValues if v is not None])
+ else:
+ return "ENUM(%s) NOT NULL" % ', '.join([sqlbuilder.sqlrepr(v, 'mysql') for v in self.enumValues])
def _postgresType(self):
length = max(map(self._getlength, self.enumValues))
Modified: SQLObject/branches/0.7-bugfix/sqlobject/tests/test_enum.py
===================================================================
--- SQLObject/branches/0.7-bugfix/sqlobject/tests/test_enum.py 2006-10-10 20:21:19 UTC (rev 2005)
+++ SQLObject/branches/0.7-bugfix/sqlobject/tests/test_enum.py 2006-10-11 14:42:35 UTC (rev 2006)
@@ -27,5 +27,25 @@
def testNone():
setupClass(EnumWithNone)
for l in [None, 'a', 'bcd', 'a', 'e', None]:
- EnumWithNone(l=l)
-
+ e = EnumWithNone(l=l)
+ assert e.l == l
+
+class EnumWithDefaultNone(SQLObject):
+
+ l = EnumCol(enumValues=['a', 'bcd', 'e', None], default=None)
+
+def testDefaultNone():
+ setupClass(EnumWithDefaultNone)
+
+ e = EnumWithDefaultNone()
+ assert e.l == None
+
+class EnumWithDefaultOther(SQLObject):
+
+ l = EnumCol(enumValues=['a', 'bcd', 'e', None], default='a')
+
+def testDefaultOther():
+ setupClass(EnumWithDefaultOther)
+
+ e = EnumWithDefaultOther()
+ assert e.l == 'a'
|
|
From: <sub...@co...> - 2006-10-10 16:26:56
|
Author: phd
Date: 2006-10-10 10:26:54 -0600 (Tue, 10 Oct 2006)
New Revision: 1999
Modified:
home/phd/SQLObject/paramstyles/sqlobject/mysql/mysqlconnection.py
Log:
Merged patches from the revisions 1996:1998 from the trunk: fixed the bug 1567633: KeyError when creating table from MySQL database.
Modified: home/phd/SQLObject/paramstyles/sqlobject/mysql/mysqlconnection.py
===================================================================
--- home/phd/SQLObject/paramstyles/sqlobject/mysql/mysqlconnection.py 2006-10-10 16:23:53 UTC (rev 1998)
+++ home/phd/SQLObject/paramstyles/sqlobject/mysql/mysqlconnection.py 2006-10-10 16:26:54 UTC (rev 1999)
@@ -190,7 +190,7 @@
if field == 'id':
continue
colClass, kw = self.guessClass(t)
- if self.kw['use_unicode'] and colClass is col.StringCol:
+ if self.kw.get('use_unicode') and colClass is col.StringCol:
colClass = col.UnicodeCol
if self.dbEncoding: kw['dbEncoding'] = self.dbEncoding
kw['name'] = soClass.sqlmeta.style.dbColumnToPythonAttr(field)
|
|
From: SourceForge.net <no...@so...> - 2006-10-10 16:25:26
|
Bugs item #1567633, was opened at 2006-09-29 14:59 Message generated for change (Comment added) made by phd You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540672&aid=1567633&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: SQLObject release (specify) >Status: Closed >Resolution: Fixed Priority: 5 Submitted By: Viktor Ferenczi (complex) >Assigned to: Oleg Broytmann (phd) Summary: KeyError when creating table from MySQL database Initial Comment: Use Python 2.4.3 (MSI installer) and SQLObject 0.7.1 installed with python setup.py install from tar.gz on WinXP. Connect to MySQL 4.1.11 server on another machine and create the table in a database (read on below): -- phpMyAdmin SQL Dump -- version 2.6.2-Debian-3sarge1 -- http://www.phpmyadmin.net -- Hoszt: localhost -- Létrehozás ideje: 2006. Szept 29. 12:53 -- Szerver verzió: 4.1.11 -- PHP Verzió: 4.3.10-16 CREATE TABLE `termek` ( `sorszam` int(11) NOT NULL auto_increment, `rogzitette` int(11) NOT NULL default '0', `felvitel` datetime NOT NULL default '0000-00-00 00:00:00', `kategoria` int(11) NOT NULL default '0', `nev` varchar(200) NOT NULL default '', `prnev` varchar(200) NOT NULL default '', `prnevetikett` varchar(200) default NULL, `kod` int(11) default NULL, `szjszam` varchar(20) default NULL, `vamszam` varchar(16) default NULL, `gyarto` int(11) default NULL, `tomeg` float NOT NULL default '0', `nettobeszerzesiar` decimal(14,2) default NULL, `nettoegysegar` decimal(14,2) default NULL, `afakulcs` decimal(5,2) NOT NULL default '20.00', `ajandek` enum('Y','N') NOT NULL default 'N', `alaptermek` int(11) default NULL, `allapot` enum('aktiv','inaktiv','torolt') NOT NULL default 'aktiv', PRIMARY KEY (`sorszam`), KEY `rogzitette` (`rogzitette`), KEY `nev` (`nev`), KEY `ajandek` (`ajandek`), KEY `kod` (`kod`), KEY `gyarto` (`gyarto`), KEY `kategoria` (`kategoria`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; Create a class from the database: __connection__='mysql://user:pass@sql_server_host/dbname' import sqlobject as SO class Termek(SO.SQLObject): class sqlmeta: fromDatabase=True idName='sorszam' You should get the following exception: Traceback (most recent call last): File "rendeles-import.py", line 25, in ? class Termek(SO.SQLObject): File "c:\python24\lib\site-packages\SQLObject-0.7.1-py2.4.egg\sqlobject\declarative.py", line 109, in __new__ cls.__classinit__(cls, new_attrs) File "c:\python24\lib\site-packages\SQLObject-0.7.1-py2.4.egg\sqlobject\main.py", line 777, in __classinit__ cls.sqlmeta.addColumnsFromDatabase() File "c:\python24\lib\site-packages\SQLObject-0.7.1-py2.4.egg\sqlobject\main.py", line 422, in addColumnsFromDatabase for columnDef in conn.columnsFromSchema(sqlmeta.table, soClass): File "c:\python24\lib\site-packages\SQLObject-0.7.1-py2.4.egg\sqlobject\mysql\mysqlconnection.py", line 153, in columnsFromSchema if self.kw['use_unicode'] and colClass is col.StringCol: KeyError: 'use_unicode' ---------------------------------------------------------------------- >Comment By: Oleg Broytmann (phd) Date: 2006-10-10 20:25 Message: Logged In: YES user_id=4799 Fixed in the SVN in the revision 1997 in hte trunk, r1998 in the 0.7 branch. Meanwhile replace the offending line with: if self.kw.get('use_unicode') and colClass is col.StringCol: ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540672&aid=1567633&group_id=74338 |
|
From: <sub...@co...> - 2006-10-10 16:23:55
|
Author: phd
Date: 2006-10-10 10:23:53 -0600 (Tue, 10 Oct 2006)
New Revision: 1998
Modified:
SQLObject/branches/0.7-bugfix/sqlobject/mysql/mysqlconnection.py
Log:
Fixed the bug 1567633: KeyError when creating table from MySQL database.
Modified: SQLObject/branches/0.7-bugfix/sqlobject/mysql/mysqlconnection.py
===================================================================
--- SQLObject/branches/0.7-bugfix/sqlobject/mysql/mysqlconnection.py 2006-10-10 16:23:31 UTC (rev 1997)
+++ SQLObject/branches/0.7-bugfix/sqlobject/mysql/mysqlconnection.py 2006-10-10 16:23:53 UTC (rev 1998)
@@ -154,7 +154,7 @@
if field == 'id':
continue
colClass, kw = self.guessClass(t)
- if self.kw['use_unicode'] and colClass is col.StringCol:
+ if self.kw.get('use_unicode') and colClass is col.StringCol:
colClass = col.UnicodeCol
kw['name'] = soClass.sqlmeta.style.dbColumnToPythonAttr(field)
kw['notNone'] = not nullAllowed
|
|
From: <sub...@co...> - 2006-10-10 16:23:39
|
Author: phd
Date: 2006-10-10 10:23:31 -0600 (Tue, 10 Oct 2006)
New Revision: 1997
Modified:
SQLObject/trunk/sqlobject/mysql/mysqlconnection.py
Log:
Fixed the bug 1567633: KeyError when creating table from MySQL database.
Modified: SQLObject/trunk/sqlobject/mysql/mysqlconnection.py
===================================================================
--- SQLObject/trunk/sqlobject/mysql/mysqlconnection.py 2006-10-10 14:59:56 UTC (rev 1996)
+++ SQLObject/trunk/sqlobject/mysql/mysqlconnection.py 2006-10-10 16:23:31 UTC (rev 1997)
@@ -190,7 +190,7 @@
if field == 'id':
continue
colClass, kw = self.guessClass(t)
- if self.kw['use_unicode'] and colClass is col.StringCol:
+ if self.kw.get('use_unicode') and colClass is col.StringCol:
colClass = col.UnicodeCol
if self.dbEncoding: kw['dbEncoding'] = self.dbEncoding
kw['name'] = soClass.sqlmeta.style.dbColumnToPythonAttr(field)
|
|
From: <sub...@co...> - 2006-10-10 15:00:00
|
Author: phd
Date: 2006-10-10 08:59:56 -0600 (Tue, 10 Oct 2006)
New Revision: 1996
Modified:
home/phd/SQLObject/paramstyles/sqlobject/tests/dbtest.py
home/phd/SQLObject/paramstyles/sqlobject/tests/test_select.py
home/phd/SQLObject/paramstyles/sqlobject/tests/test_sqlite_factory.py
Log:
Merged patches from the revisions 1994:1995 from the trunk
Modified: home/phd/SQLObject/paramstyles/sqlobject/tests/dbtest.py
===================================================================
--- home/phd/SQLObject/paramstyles/sqlobject/tests/dbtest.py 2006-10-10 14:56:35 UTC (rev 1995)
+++ home/phd/SQLObject/paramstyles/sqlobject/tests/dbtest.py 2006-10-10 14:59:56 UTC (rev 1996)
@@ -104,8 +104,8 @@
# At least this module should be importable...
print >> sys.stderr, (
"Could not open database: %s" % e)
-
+
class InstalledTestDatabase(sqlobject.SQLObject):
"""
This table is set up in SQLite (always, regardless of --Database) and
@@ -216,7 +216,7 @@
def __init__(self, **kw):
for name, value in kw.items():
setattr(self, name, value)
-
+
def d(**kw):
"""
Because ``dict(**kw)`` doesn't work in Python 2.2, this is a
@@ -274,10 +274,22 @@
# To avoid name clashes:
_inserts = inserts
+def setSQLiteConnectionFactory(TableClass, factory):
+ from sqlobject.sqlite.sqliteconnection import SQLiteConnection
+ conn = TableClass._connection
+ TableClass._connection = SQLiteConnection(
+ filename=conn.filename,
+ name=conn.name, debug=conn.debug, debugOutput=conn.debugOutput,
+ cache=conn.cache, style=conn.style, autoCommit=conn.autoCommit,
+ debugThreading=conn.debugThreading, registry=conn.registry,
+ factory=factory
+ )
+ installOrClear([TableClass])
+
def deprecated_module():
sqlobject.main.warnings_level = None
sqlobject.main.exception_level = None
-
+
def setup_module(mod):
# modules with '_old' test backward compatible methods, so they
# don't get warnings or errors.
Modified: home/phd/SQLObject/paramstyles/sqlobject/tests/test_select.py
===================================================================
--- home/phd/SQLObject/paramstyles/sqlobject/tests/test_select.py 2006-10-10 14:56:35 UTC (rev 1995)
+++ home/phd/SQLObject/paramstyles/sqlobject/tests/test_select.py 2006-10-10 14:59:56 UTC (rev 1996)
@@ -2,7 +2,7 @@
from sqlobject import *
from sqlobject.main import SQLObjectIntegrityError
from sqlobject.tests.dbtest import *
-from sqlobject.tests.dbtest import installOrClear
+from sqlobject.tests.dbtest import setSQLiteConnectionFactory
from py.test import raises
try:
@@ -163,15 +163,7 @@
self.create_function("regexp", 2, regexp)
return MyConnection
- conn = IterTest._connection
- IterTest._connection = sqliteconnection.SQLiteConnection(
- filename=conn.filename,
- name=conn.name, debug=conn.debug, debugOutput=conn.debugOutput,
- cache=conn.cache, style=conn.style, autoCommit=conn.autoCommit,
- debugThreading=conn.debugThreading, registry=conn.registry,
- factory=SQLiteConnectionFactory
- )
- installOrClear([IterTest])
+ setSQLiteConnectionFactory(IterTest, SQLiteConnectionFactory)
IterTest(name='sqlobject')
IterTest(name='sqlbuilder')
Modified: home/phd/SQLObject/paramstyles/sqlobject/tests/test_sqlite_factory.py
===================================================================
--- home/phd/SQLObject/paramstyles/sqlobject/tests/test_sqlite_factory.py 2006-10-10 14:56:35 UTC (rev 1995)
+++ home/phd/SQLObject/paramstyles/sqlobject/tests/test_sqlite_factory.py 2006-10-10 14:59:56 UTC (rev 1996)
@@ -1,6 +1,6 @@
from sqlobject import *
from sqlobject.tests.dbtest import *
-from sqlobject.tests.dbtest import installOrClear
+from sqlobject.tests.dbtest import setSQLiteConnectionFactory
class SQLiteFactoryTest(SQLObject):
name = StringCol()
@@ -20,14 +20,8 @@
factory[0] = MyConnection
return MyConnection
- conn = SQLiteFactoryTest._connection
- SQLiteFactoryTest._connection = sqliteconnection.SQLiteConnection(
- filename=conn.filename,
- name=conn.name, debug=conn.debug, debugOutput=conn.debugOutput,
- cache=conn.cache, style=conn.style, autoCommit=conn.autoCommit,
- debugThreading=conn.debugThreading, registry=conn.registry,
- factory=SQLiteConnectionFactory
- )
+ setSQLiteConnectionFactory(SQLiteFactoryTest, SQLiteConnectionFactory)
+
conn = SQLiteFactoryTest._connection.makeConnection()
assert factory[0]
assert isinstance(conn, factory[0])
@@ -48,14 +42,8 @@
return MyConnection
sqliteconnection.SQLiteConnectionFactory = SQLiteConnectionFactory
- conn = SQLiteFactoryTest._connection
- SQLiteFactoryTest._connection = sqliteconnection.SQLiteConnection(
- filename=conn.filename,
- name=conn.name, debug=conn.debug, debugOutput=conn.debugOutput,
- cache=conn.cache, style=conn.style, autoCommit=conn.autoCommit,
- debugThreading=conn.debugThreading, registry=conn.registry,
- factory="SQLiteConnectionFactory"
- )
+ setSQLiteConnectionFactory(SQLiteFactoryTest, "SQLiteConnectionFactory")
+
conn = SQLiteFactoryTest._connection.makeConnection()
assert factory[0]
assert isinstance(conn, factory[0])
@@ -89,15 +77,7 @@
return MyConnection
- conn = SQLiteFactoryTest._connection
- SQLiteFactoryTest._connection = sqliteconnection.SQLiteConnection(
- filename=conn.filename,
- name=conn.name, debug=conn.debug, debugOutput=conn.debugOutput,
- cache=conn.cache, style=conn.style, autoCommit=conn.autoCommit,
- debugThreading=conn.debugThreading, registry=conn.registry,
- factory=SQLiteConnectionFactory
- )
- installOrClear([SQLiteFactoryTest])
+ setSQLiteConnectionFactory(SQLiteFactoryTest, SQLiteConnectionFactory)
SQLiteFactoryTest(name='sqlobject')
SQLiteFactoryTest(name='sqlbuilder')
|
|
From: <sub...@co...> - 2006-10-10 14:56:43
|
Author: phd
Date: 2006-10-10 08:56:35 -0600 (Tue, 10 Oct 2006)
New Revision: 1995
Modified:
SQLObject/trunk/sqlobject/tests/dbtest.py
SQLObject/trunk/sqlobject/tests/test_select.py
SQLObject/trunk/sqlobject/tests/test_sqlite_factory.py
Log:
Moved boilerplate code to set the factory for SQLiteConnection to setSQLiteConnectionFactory().
Modified: SQLObject/trunk/sqlobject/tests/dbtest.py
===================================================================
--- SQLObject/trunk/sqlobject/tests/dbtest.py 2006-10-10 12:06:31 UTC (rev 1994)
+++ SQLObject/trunk/sqlobject/tests/dbtest.py 2006-10-10 14:56:35 UTC (rev 1995)
@@ -104,8 +104,8 @@
# At least this module should be importable...
print >> sys.stderr, (
"Could not open database: %s" % e)
-
+
class InstalledTestDatabase(sqlobject.SQLObject):
"""
This table is set up in SQLite (always, regardless of --Database) and
@@ -216,7 +216,7 @@
def __init__(self, **kw):
for name, value in kw.items():
setattr(self, name, value)
-
+
def d(**kw):
"""
Because ``dict(**kw)`` doesn't work in Python 2.2, this is a
@@ -274,10 +274,22 @@
# To avoid name clashes:
_inserts = inserts
+def setSQLiteConnectionFactory(TableClass, factory):
+ from sqlobject.sqlite.sqliteconnection import SQLiteConnection
+ conn = TableClass._connection
+ TableClass._connection = SQLiteConnection(
+ filename=conn.filename,
+ name=conn.name, debug=conn.debug, debugOutput=conn.debugOutput,
+ cache=conn.cache, style=conn.style, autoCommit=conn.autoCommit,
+ debugThreading=conn.debugThreading, registry=conn.registry,
+ factory=factory
+ )
+ installOrClear([TableClass])
+
def deprecated_module():
sqlobject.main.warnings_level = None
sqlobject.main.exception_level = None
-
+
def setup_module(mod):
# modules with '_old' test backward compatible methods, so they
# don't get warnings or errors.
Modified: SQLObject/trunk/sqlobject/tests/test_select.py
===================================================================
--- SQLObject/trunk/sqlobject/tests/test_select.py 2006-10-10 12:06:31 UTC (rev 1994)
+++ SQLObject/trunk/sqlobject/tests/test_select.py 2006-10-10 14:56:35 UTC (rev 1995)
@@ -2,7 +2,7 @@
from sqlobject import *
from sqlobject.main import SQLObjectIntegrityError
from sqlobject.tests.dbtest import *
-from sqlobject.tests.dbtest import installOrClear
+from sqlobject.tests.dbtest import setSQLiteConnectionFactory
from py.test import raises
try:
@@ -163,15 +163,7 @@
self.create_function("regexp", 2, regexp)
return MyConnection
- conn = IterTest._connection
- IterTest._connection = sqliteconnection.SQLiteConnection(
- filename=conn.filename,
- name=conn.name, debug=conn.debug, debugOutput=conn.debugOutput,
- cache=conn.cache, style=conn.style, autoCommit=conn.autoCommit,
- debugThreading=conn.debugThreading, registry=conn.registry,
- factory=SQLiteConnectionFactory
- )
- installOrClear([IterTest])
+ setSQLiteConnectionFactory(IterTest, SQLiteConnectionFactory)
IterTest(name='sqlobject')
IterTest(name='sqlbuilder')
Modified: SQLObject/trunk/sqlobject/tests/test_sqlite_factory.py
===================================================================
--- SQLObject/trunk/sqlobject/tests/test_sqlite_factory.py 2006-10-10 12:06:31 UTC (rev 1994)
+++ SQLObject/trunk/sqlobject/tests/test_sqlite_factory.py 2006-10-10 14:56:35 UTC (rev 1995)
@@ -1,6 +1,6 @@
from sqlobject import *
from sqlobject.tests.dbtest import *
-from sqlobject.tests.dbtest import installOrClear
+from sqlobject.tests.dbtest import setSQLiteConnectionFactory
class SQLiteFactoryTest(SQLObject):
name = StringCol()
@@ -20,14 +20,8 @@
factory[0] = MyConnection
return MyConnection
- conn = SQLiteFactoryTest._connection
- SQLiteFactoryTest._connection = sqliteconnection.SQLiteConnection(
- filename=conn.filename,
- name=conn.name, debug=conn.debug, debugOutput=conn.debugOutput,
- cache=conn.cache, style=conn.style, autoCommit=conn.autoCommit,
- debugThreading=conn.debugThreading, registry=conn.registry,
- factory=SQLiteConnectionFactory
- )
+ setSQLiteConnectionFactory(SQLiteFactoryTest, SQLiteConnectionFactory)
+
conn = SQLiteFactoryTest._connection.makeConnection()
assert factory[0]
assert isinstance(conn, factory[0])
@@ -48,14 +42,8 @@
return MyConnection
sqliteconnection.SQLiteConnectionFactory = SQLiteConnectionFactory
- conn = SQLiteFactoryTest._connection
- SQLiteFactoryTest._connection = sqliteconnection.SQLiteConnection(
- filename=conn.filename,
- name=conn.name, debug=conn.debug, debugOutput=conn.debugOutput,
- cache=conn.cache, style=conn.style, autoCommit=conn.autoCommit,
- debugThreading=conn.debugThreading, registry=conn.registry,
- factory="SQLiteConnectionFactory"
- )
+ setSQLiteConnectionFactory(SQLiteFactoryTest, "SQLiteConnectionFactory")
+
conn = SQLiteFactoryTest._connection.makeConnection()
assert factory[0]
assert isinstance(conn, factory[0])
@@ -89,15 +77,7 @@
return MyConnection
- conn = SQLiteFactoryTest._connection
- SQLiteFactoryTest._connection = sqliteconnection.SQLiteConnection(
- filename=conn.filename,
- name=conn.name, debug=conn.debug, debugOutput=conn.debugOutput,
- cache=conn.cache, style=conn.style, autoCommit=conn.autoCommit,
- debugThreading=conn.debugThreading, registry=conn.registry,
- factory=SQLiteConnectionFactory
- )
- installOrClear([SQLiteFactoryTest])
+ setSQLiteConnectionFactory(SQLiteFactoryTest, SQLiteConnectionFactory)
SQLiteFactoryTest(name='sqlobject')
SQLiteFactoryTest(name='sqlbuilder')
|
|
From: <sub...@co...> - 2006-10-10 12:06:35
|
Author: phd
Date: 2006-10-10 06:06:31 -0600 (Tue, 10 Oct 2006)
New Revision: 1994
Added:
home/phd/SQLObject/paramstyles/sqlobject/tests/test_sqlite_factory.py
Modified:
home/phd/SQLObject/paramstyles/sqlobject/sqlite/sqliteconnection.py
home/phd/SQLObject/paramstyles/sqlobject/tests/test_select.py
Log:
Merged patches from the revisions 1991:1993 from the trunk
Modified: home/phd/SQLObject/paramstyles/sqlobject/sqlite/sqliteconnection.py
===================================================================
--- home/phd/SQLObject/paramstyles/sqlobject/sqlite/sqliteconnection.py 2006-10-10 12:03:27 UTC (rev 1993)
+++ home/phd/SQLObject/paramstyles/sqlobject/sqlite/sqliteconnection.py 2006-10-10 12:06:31 UTC (rev 1994)
@@ -67,6 +67,11 @@
if sqlite2_Binary is None:
sqlite2_Binary = sqlite.Binary
sqlite.Binary = lambda s: sqlite2_Binary(sqlite.encode(s))
+ if 'factory' in kw:
+ factory = popKey(kw, 'factory')
+ if isinstance(factory, str):
+ factory = globals()[factory]
+ opts['factory'] = factory(sqlite)
else:
opts['autocommit'] = bool(autoCommit)
if 'encoding' in kw:
Modified: home/phd/SQLObject/paramstyles/sqlobject/tests/test_select.py
===================================================================
--- home/phd/SQLObject/paramstyles/sqlobject/tests/test_select.py 2006-10-10 12:03:27 UTC (rev 1993)
+++ home/phd/SQLObject/paramstyles/sqlobject/tests/test_select.py 2006-10-10 12:06:31 UTC (rev 1994)
@@ -2,6 +2,7 @@
from sqlobject import *
from sqlobject.main import SQLObjectIntegrityError
from sqlobject.tests.dbtest import *
+from sqlobject.tests.dbtest import installOrClear
from py.test import raises
try:
@@ -133,7 +134,7 @@
def test_2(self):
self.accumulateEqual(len,Counter2.select('all'), 100)
-def test_sqlbuilder_LIKE():
+def test_select_LIKE():
setupClass(IterTest)
IterTest(name='sqlobject')
IterTest(name='sqlbuilder')
@@ -142,12 +143,12 @@
assert IterTest.select(LIKE(IterTest.q.name, "sqlb%")).count() == 1
assert IterTest.select(LIKE(IterTest.q.name, "sqlx%")).count() == 0
-def test_sqlbuilder_RLIKE():
+def test_select_RLIKE():
setupClass(IterTest)
if IterTest._connection.dbName == "sqlite":
- from sqlobject.sqlite.sqliteconnection import using_sqlite2
- if not using_sqlite2:
+ from sqlobject.sqlite import sqliteconnection
+ if not sqliteconnection.using_sqlite2:
return
# Implement regexp() function for SQLite; only works with PySQLite2
@@ -155,13 +156,23 @@
def regexp(regexp, test):
return bool(re.search(regexp, test))
- _get_connection = IterTest._connection.getConnection
- def new_get_connection(*args, **kw):
- _connection = _get_connection(*args, **kw)
- _connection.create_function("regexp", 2, regexp)
- return _connection
- IterTest._connection.getConnection = new_get_connection
+ def SQLiteConnectionFactory(sqlite):
+ class MyConnection(sqlite.Connection):
+ def __init__(self, *args, **kwargs):
+ super(MyConnection, self).__init__(*args, **kwargs)
+ self.create_function("regexp", 2, regexp)
+ return MyConnection
+ conn = IterTest._connection
+ IterTest._connection = sqliteconnection.SQLiteConnection(
+ filename=conn.filename,
+ name=conn.name, debug=conn.debug, debugOutput=conn.debugOutput,
+ cache=conn.cache, style=conn.style, autoCommit=conn.autoCommit,
+ debugThreading=conn.debugThreading, registry=conn.registry,
+ factory=SQLiteConnectionFactory
+ )
+ installOrClear([IterTest])
+
IterTest(name='sqlobject')
IterTest(name='sqlbuilder')
assert IterTest.select(RLIKE(IterTest.q.name, "^sql.*$")).count() == 2
Copied: home/phd/SQLObject/paramstyles/sqlobject/tests/test_sqlite_factory.py (from rev 1993, SQLObject/trunk/sqlobject/tests/test_sqlite_factory.py)
===================================================================
--- home/phd/SQLObject/paramstyles/sqlobject/tests/test_sqlite_factory.py (rev 0)
+++ home/phd/SQLObject/paramstyles/sqlobject/tests/test_sqlite_factory.py 2006-10-10 12:06:31 UTC (rev 1994)
@@ -0,0 +1,105 @@
+from sqlobject import *
+from sqlobject.tests.dbtest import *
+from sqlobject.tests.dbtest import installOrClear
+
+class SQLiteFactoryTest(SQLObject):
+ name = StringCol()
+
+def test_sqlite_factory():
+ setupClass(SQLiteFactoryTest)
+
+ if SQLiteFactoryTest._connection.dbName == "sqlite":
+ from sqlobject.sqlite import sqliteconnection
+ if not sqliteconnection.using_sqlite2:
+ return
+
+ factory = [None]
+ def SQLiteConnectionFactory(sqlite):
+ class MyConnection(sqlite.Connection):
+ pass
+ factory[0] = MyConnection
+ return MyConnection
+
+ conn = SQLiteFactoryTest._connection
+ SQLiteFactoryTest._connection = sqliteconnection.SQLiteConnection(
+ filename=conn.filename,
+ name=conn.name, debug=conn.debug, debugOutput=conn.debugOutput,
+ cache=conn.cache, style=conn.style, autoCommit=conn.autoCommit,
+ debugThreading=conn.debugThreading, registry=conn.registry,
+ factory=SQLiteConnectionFactory
+ )
+ conn = SQLiteFactoryTest._connection.makeConnection()
+ assert factory[0]
+ assert isinstance(conn, factory[0])
+
+def test_sqlite_factory_str():
+ setupClass(SQLiteFactoryTest)
+
+ if SQLiteFactoryTest._connection.dbName == "sqlite":
+ from sqlobject.sqlite import sqliteconnection
+ if not sqliteconnection.using_sqlite2:
+ return
+
+ factory = [None]
+ def SQLiteConnectionFactory(sqlite):
+ class MyConnection(sqlite.Connection):
+ pass
+ factory[0] = MyConnection
+ return MyConnection
+ sqliteconnection.SQLiteConnectionFactory = SQLiteConnectionFactory
+
+ conn = SQLiteFactoryTest._connection
+ SQLiteFactoryTest._connection = sqliteconnection.SQLiteConnection(
+ filename=conn.filename,
+ name=conn.name, debug=conn.debug, debugOutput=conn.debugOutput,
+ cache=conn.cache, style=conn.style, autoCommit=conn.autoCommit,
+ debugThreading=conn.debugThreading, registry=conn.registry,
+ factory="SQLiteConnectionFactory"
+ )
+ conn = SQLiteFactoryTest._connection.makeConnection()
+ assert factory[0]
+ assert isinstance(conn, factory[0])
+ del sqliteconnection.SQLiteConnectionFactory
+
+def test_sqlite_aggregate():
+ setupClass(SQLiteFactoryTest)
+
+ if SQLiteFactoryTest._connection.dbName == "sqlite":
+ from sqlobject.sqlite import sqliteconnection
+ if not sqliteconnection.using_sqlite2:
+ return
+
+ def SQLiteConnectionFactory(sqlite):
+ class MyConnection(sqlite.Connection):
+ def __init__(self, *args, **kwargs):
+ super(MyConnection, self).__init__(*args, **kwargs)
+ self.create_aggregate("group_concat", 1, self.group_concat)
+
+ class group_concat:
+ def __init__(self):
+ self.acc = []
+ def step(self, value):
+ if isinstance(value, basestring):
+ self.acc.append(value)
+ else:
+ self.acc.append(str(value))
+ def finalize(self):
+ self.acc.sort()
+ return ", ".join(self.acc)
+
+ return MyConnection
+
+ conn = SQLiteFactoryTest._connection
+ SQLiteFactoryTest._connection = sqliteconnection.SQLiteConnection(
+ filename=conn.filename,
+ name=conn.name, debug=conn.debug, debugOutput=conn.debugOutput,
+ cache=conn.cache, style=conn.style, autoCommit=conn.autoCommit,
+ debugThreading=conn.debugThreading, registry=conn.registry,
+ factory=SQLiteConnectionFactory
+ )
+ installOrClear([SQLiteFactoryTest])
+
+ SQLiteFactoryTest(name='sqlobject')
+ SQLiteFactoryTest(name='sqlbuilder')
+ assert SQLiteFactoryTest.select(orderBy="name").accumulateOne("group_concat", "name") == \
+ "sqlbuilder, sqlobject"
|
|
From: <sub...@co...> - 2006-10-10 12:03:31
|
Author: phd Date: 2006-10-10 06:03:27 -0600 (Tue, 10 Oct 2006) New Revision: 1993 Modified: SQLObject/docs/News.txt Log: SQLiteConnection got a new keyword "factory". Modified: SQLObject/docs/News.txt =================================================================== --- SQLObject/docs/News.txt 2006-10-10 12:03:10 UTC (rev 1992) +++ SQLObject/docs/News.txt 2006-10-10 12:03:27 UTC (rev 1993) @@ -52,6 +52,11 @@ * New module dberrors.py - a hierarchy of exceptions. Translation of DB API module's exceptions to the new hierarchy is performed for SQLIte and MySQL. +* SQLiteConnection got a new keyword "factory" - a name or a reference to + a factory function that returns a connection class; useful for + implementing functions or aggregates. See test_select.py and + test_sqlite_factory.py for examples. + Small Features -------------- |
|
From: <sub...@co...> - 2006-10-10 12:03:16
|
Author: phd
Date: 2006-10-10 06:03:10 -0600 (Tue, 10 Oct 2006)
New Revision: 1992
Added:
SQLObject/trunk/sqlobject/tests/test_sqlite_factory.py
Modified:
SQLObject/trunk/sqlobject/sqlite/sqliteconnection.py
SQLObject/trunk/sqlobject/tests/test_select.py
Log:
SQLiteConnection got a new keyword "factory". The patch inspired by jt <jt...@ud...>.
Modified: SQLObject/trunk/sqlobject/sqlite/sqliteconnection.py
===================================================================
--- SQLObject/trunk/sqlobject/sqlite/sqliteconnection.py 2006-10-10 04:19:44 UTC (rev 1991)
+++ SQLObject/trunk/sqlobject/sqlite/sqliteconnection.py 2006-10-10 12:03:10 UTC (rev 1992)
@@ -67,6 +67,11 @@
if sqlite2_Binary is None:
sqlite2_Binary = sqlite.Binary
sqlite.Binary = lambda s: sqlite2_Binary(sqlite.encode(s))
+ if 'factory' in kw:
+ factory = popKey(kw, 'factory')
+ if isinstance(factory, str):
+ factory = globals()[factory]
+ opts['factory'] = factory(sqlite)
else:
opts['autocommit'] = bool(autoCommit)
if 'encoding' in kw:
Modified: SQLObject/trunk/sqlobject/tests/test_select.py
===================================================================
--- SQLObject/trunk/sqlobject/tests/test_select.py 2006-10-10 04:19:44 UTC (rev 1991)
+++ SQLObject/trunk/sqlobject/tests/test_select.py 2006-10-10 12:03:10 UTC (rev 1992)
@@ -2,6 +2,7 @@
from sqlobject import *
from sqlobject.main import SQLObjectIntegrityError
from sqlobject.tests.dbtest import *
+from sqlobject.tests.dbtest import installOrClear
from py.test import raises
try:
@@ -133,7 +134,7 @@
def test_2(self):
self.accumulateEqual(len,Counter2.select('all'), 100)
-def test_sqlbuilder_LIKE():
+def test_select_LIKE():
setupClass(IterTest)
IterTest(name='sqlobject')
IterTest(name='sqlbuilder')
@@ -142,12 +143,12 @@
assert IterTest.select(LIKE(IterTest.q.name, "sqlb%")).count() == 1
assert IterTest.select(LIKE(IterTest.q.name, "sqlx%")).count() == 0
-def test_sqlbuilder_RLIKE():
+def test_select_RLIKE():
setupClass(IterTest)
if IterTest._connection.dbName == "sqlite":
- from sqlobject.sqlite.sqliteconnection import using_sqlite2
- if not using_sqlite2:
+ from sqlobject.sqlite import sqliteconnection
+ if not sqliteconnection.using_sqlite2:
return
# Implement regexp() function for SQLite; only works with PySQLite2
@@ -155,13 +156,23 @@
def regexp(regexp, test):
return bool(re.search(regexp, test))
- _get_connection = IterTest._connection.getConnection
- def new_get_connection(*args, **kw):
- _connection = _get_connection(*args, **kw)
- _connection.create_function("regexp", 2, regexp)
- return _connection
- IterTest._connection.getConnection = new_get_connection
+ def SQLiteConnectionFactory(sqlite):
+ class MyConnection(sqlite.Connection):
+ def __init__(self, *args, **kwargs):
+ super(MyConnection, self).__init__(*args, **kwargs)
+ self.create_function("regexp", 2, regexp)
+ return MyConnection
+ conn = IterTest._connection
+ IterTest._connection = sqliteconnection.SQLiteConnection(
+ filename=conn.filename,
+ name=conn.name, debug=conn.debug, debugOutput=conn.debugOutput,
+ cache=conn.cache, style=conn.style, autoCommit=conn.autoCommit,
+ debugThreading=conn.debugThreading, registry=conn.registry,
+ factory=SQLiteConnectionFactory
+ )
+ installOrClear([IterTest])
+
IterTest(name='sqlobject')
IterTest(name='sqlbuilder')
assert IterTest.select(RLIKE(IterTest.q.name, "^sql.*$")).count() == 2
Added: SQLObject/trunk/sqlobject/tests/test_sqlite_factory.py
===================================================================
--- SQLObject/trunk/sqlobject/tests/test_sqlite_factory.py (rev 0)
+++ SQLObject/trunk/sqlobject/tests/test_sqlite_factory.py 2006-10-10 12:03:10 UTC (rev 1992)
@@ -0,0 +1,105 @@
+from sqlobject import *
+from sqlobject.tests.dbtest import *
+from sqlobject.tests.dbtest import installOrClear
+
+class SQLiteFactoryTest(SQLObject):
+ name = StringCol()
+
+def test_sqlite_factory():
+ setupClass(SQLiteFactoryTest)
+
+ if SQLiteFactoryTest._connection.dbName == "sqlite":
+ from sqlobject.sqlite import sqliteconnection
+ if not sqliteconnection.using_sqlite2:
+ return
+
+ factory = [None]
+ def SQLiteConnectionFactory(sqlite):
+ class MyConnection(sqlite.Connection):
+ pass
+ factory[0] = MyConnection
+ return MyConnection
+
+ conn = SQLiteFactoryTest._connection
+ SQLiteFactoryTest._connection = sqliteconnection.SQLiteConnection(
+ filename=conn.filename,
+ name=conn.name, debug=conn.debug, debugOutput=conn.debugOutput,
+ cache=conn.cache, style=conn.style, autoCommit=conn.autoCommit,
+ debugThreading=conn.debugThreading, registry=conn.registry,
+ factory=SQLiteConnectionFactory
+ )
+ conn = SQLiteFactoryTest._connection.makeConnection()
+ assert factory[0]
+ assert isinstance(conn, factory[0])
+
+def test_sqlite_factory_str():
+ setupClass(SQLiteFactoryTest)
+
+ if SQLiteFactoryTest._connection.dbName == "sqlite":
+ from sqlobject.sqlite import sqliteconnection
+ if not sqliteconnection.using_sqlite2:
+ return
+
+ factory = [None]
+ def SQLiteConnectionFactory(sqlite):
+ class MyConnection(sqlite.Connection):
+ pass
+ factory[0] = MyConnection
+ return MyConnection
+ sqliteconnection.SQLiteConnectionFactory = SQLiteConnectionFactory
+
+ conn = SQLiteFactoryTest._connection
+ SQLiteFactoryTest._connection = sqliteconnection.SQLiteConnection(
+ filename=conn.filename,
+ name=conn.name, debug=conn.debug, debugOutput=conn.debugOutput,
+ cache=conn.cache, style=conn.style, autoCommit=conn.autoCommit,
+ debugThreading=conn.debugThreading, registry=conn.registry,
+ factory="SQLiteConnectionFactory"
+ )
+ conn = SQLiteFactoryTest._connection.makeConnection()
+ assert factory[0]
+ assert isinstance(conn, factory[0])
+ del sqliteconnection.SQLiteConnectionFactory
+
+def test_sqlite_aggregate():
+ setupClass(SQLiteFactoryTest)
+
+ if SQLiteFactoryTest._connection.dbName == "sqlite":
+ from sqlobject.sqlite import sqliteconnection
+ if not sqliteconnection.using_sqlite2:
+ return
+
+ def SQLiteConnectionFactory(sqlite):
+ class MyConnection(sqlite.Connection):
+ def __init__(self, *args, **kwargs):
+ super(MyConnection, self).__init__(*args, **kwargs)
+ self.create_aggregate("group_concat", 1, self.group_concat)
+
+ class group_concat:
+ def __init__(self):
+ self.acc = []
+ def step(self, value):
+ if isinstance(value, basestring):
+ self.acc.append(value)
+ else:
+ self.acc.append(str(value))
+ def finalize(self):
+ self.acc.sort()
+ return ", ".join(self.acc)
+
+ return MyConnection
+
+ conn = SQLiteFactoryTest._connection
+ SQLiteFactoryTest._connection = sqliteconnection.SQLiteConnection(
+ filename=conn.filename,
+ name=conn.name, debug=conn.debug, debugOutput=conn.debugOutput,
+ cache=conn.cache, style=conn.style, autoCommit=conn.autoCommit,
+ debugThreading=conn.debugThreading, registry=conn.registry,
+ factory=SQLiteConnectionFactory
+ )
+ installOrClear([SQLiteFactoryTest])
+
+ SQLiteFactoryTest(name='sqlobject')
+ SQLiteFactoryTest(name='sqlbuilder')
+ assert SQLiteFactoryTest.select(orderBy="name").accumulateOne("group_concat", "name") == \
+ "sqlbuilder, sqlobject"
|