sqlobject-cvs Mailing List for SQLObject (Page 121)
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-09-05 14:07:49
|
Author: phd
Date: 2006-09-05 08:07:44 -0600 (Tue, 05 Sep 2006)
New Revision: 1903
Added:
home/phd/SQLObject/paramstyles/sqlobject/inheritance/tests/testDestroyCascade.py
Modified:
home/phd/SQLObject/paramstyles/sqlobject/main.py
Log:
Merged patches from the revisions 1900:1902 from the trunk
Copied: home/phd/SQLObject/paramstyles/sqlobject/inheritance/tests/testDestroyCascade.py (from rev 1902, SQLObject/trunk/sqlobject/inheritance/tests/testDestroyCascade.py)
===================================================================
--- home/phd/SQLObject/paramstyles/sqlobject/inheritance/tests/testDestroyCascade.py (rev 0)
+++ home/phd/SQLObject/paramstyles/sqlobject/inheritance/tests/testDestroyCascade.py 2006-09-05 14:07:44 UTC (rev 1903)
@@ -0,0 +1,20 @@
+from sqlobject import *
+from sqlobject.inheritance import *
+from sqlobject.tests.dbtest import *
+
+class TestCascade1(InheritableSQLObject):
+ dummy = IntCol()
+
+class TestCascade2(TestCascade1):
+ c = ForeignKey('TestCascade3', cascade='null')
+
+class TestCascade3(SQLObject):
+ dummy = IntCol()
+
+
+def test_destroySelf():
+ setupClass([TestCascade1, TestCascade3, TestCascade2])
+
+ c = TestCascade3(dummy=1)
+ b = TestCascade2(cID=c.id, dummy=1)
+ c.destroySelf()
Modified: home/phd/SQLObject/paramstyles/sqlobject/main.py
===================================================================
--- home/phd/SQLObject/paramstyles/sqlobject/main.py 2006-09-05 13:49:58 UTC (rev 1902)
+++ home/phd/SQLObject/paramstyles/sqlobject/main.py 2006-09-05 14:07:44 UTC (rev 1903)
@@ -1498,7 +1498,7 @@
if col.cascade == False:
# Found a restriction
restrict = True
- query.append("%s = (%s)" % (col.dbName, self.id))
+ query.append(getattr(k.q, col.name) == self.id)
if col.cascade == 'null':
setnull = col.name
elif col.cascade:
@@ -1507,7 +1507,7 @@
"Class %s depends on %s accoriding to "
"findDependantColumns, but this seems inaccurate"
% (k, klass))
- query = ' OR '.join(query)
+ query = sqlbuilder.OR(*query)
results = k.select(query, connection=self._connection)
if restrict:
if results.count():
|
|
From: SourceForge.net <no...@so...> - 2006-09-05 13:57:38
|
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: Open Resolution: None Priority: 5 Submitted By: Neil Muller (nitwit) Assigned to: Nobody/Anonymous (nobody) 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-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: SourceForge.net <no...@so...> - 2006-09-05 13:53:42
|
Bugs item #1507767, was opened at 2006-06-17 17:41 Message generated for change (Comment added) made by phd You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540672&aid=1507767&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: Wont Fix Priority: 5 Submitted By: Nobody/Anonymous (nobody) >Assigned to: Oleg Broytmann (phd) Summary: StringCol(char_binary=True) breaks if DBMS!=MySQL Initial Comment: StringCol(char_binary=True) is required by MySQL to allow case-sensitive comparisons for that column. However, for instance for SQLite this is not required. In the latter case "char_binary=True" should be ignored, but instead an exception is trown: ValueError: SQLite does not support binary character columns ---------------------------------------------------------------------- >Comment By: Oleg Broytmann (phd) Date: 2006-09-05 17:53 Message: Logged In: YES user_id=4799 "char_binary" was a somwhat experimental feature that I now very much recommend againts. "char_binary" in MySQL doesn't mean "case sensitive", it means "non-locale aware", which is very much different thing. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540672&aid=1507767&group_id=74338 |
|
From: SourceForge.net <no...@so...> - 2006-09-05 13:51:25
|
Bugs item #1546294, was opened at 2006-08-25 02:11 Message generated for change (Comment added) made by phd You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540672&aid=1546294&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: Accepted Priority: 5 Submitted By: Rick Copeland (rick446) >Assigned to: Oleg Broytmann (phd) Summary: inheritance and cascade='null' do not work together Initial Comment: (Based on development version 0.8dev_r1883) Start with the following schema: class A(InheritableSQLObject): dummy=IntCol() class B(A): c=ForeignKey('C', cascade='null') class C(SQLObject): dummy=IntCol() C.createTable() A.createTable() B.createTable() c=C(dummy=1) b=B(cID=c.id, dummy=1) c.destroySelf() ***exception*** This can be fixed by updating SQLObject.destroySelf to use SQLBuilder by the following changes: in sqlobject/main.py: (insert at top) from sqlbuilder import OR (replacing line starting with "query.append("%s = (%... query.append(getattr(k.q, col.name)==self.id) (replacing line "' OR '.join(query)") query=OR(*query) ---------------------------------------------------------------------- >Comment By: Oleg Broytmann (phd) Date: 2006-09-05 17:51 Message: Logged In: YES user_id=4799 Fixed with the patch 1546314. ---------------------------------------------------------------------- Comment By: Rick Copeland (rick446) Date: 2006-08-25 02:46 Message: Logged In: YES user_id=1583356 I have created patch #1546314 to address this bug. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540672&aid=1546294&group_id=74338 |
|
From: SourceForge.net <no...@so...> - 2006-09-05 13:50:18
|
Patches item #1546314, was opened at 2006-08-25 02:44 Message generated for change (Comment added) made by phd You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540674&aid=1546314&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: None Group: None >Status: Closed >Resolution: Accepted Priority: 5 Submitted By: Rick Copeland (rick446) Assigned to: Oleg Broytmann (phd) Summary: Fix bug 1546294 Initial Comment: Here is the patch that fixes bug 1546294. ---------------------------------------------------------------------- >Comment By: Oleg Broytmann (phd) Date: 2006-09-05 17:50 Message: Logged In: YES user_id=4799 Now point you fingers and laugh at me! You test is ok - that is, without your patch it failed with exactly that error message. The problem was that I tested your patch with 0.7-branch where it worked. With SQLObject from the trunk it failed, and your patch helps. Sorry for the confusion! The patch with the test is applied and committed in the revision 1901 to the trunk, rev. 1902 to the 0.7-branch. Thank you very much! ---------------------------------------------------------------------- Comment By: Rick Copeland (rick446) Date: 2006-09-04 20:17 Message: Logged In: YES user_id=1583356 I'll give more detail when I get back to work tomorrow, but the "boolean" thing is simple to explain. The WHERE clause generated actually included the *quoted string* "c_id = (1)", as in SELECT blah FROM blah WHERE "c_id = (1)" The use of sqlbuilder in the patch prevents this weird quoting, and seems to be a better way of generating queries, anyway (by the DRY principle). Like I said, I can give you all the details of my installation tomorrow, but my recollection is that I'm using psycopg2, Python 2.4, Postgres 7.4 server, and (I believe) a Postgres 8.0 client. ---------------------------------------------------------------------- Comment By: Oleg Broytmann (phd) Date: 2006-09-04 20:10 Message: Logged In: YES user_id=4799 I'dlike to wait until a clear test. You have reported that the test failed with psycopg2.ProgrammingError: invalid input syntax for type boolean: "c_id = (1)" But I don't see any boolean there. Are you sure you've submitted the same test that produced the error message? Your test works for me with python 2.3 and 2.4, with SQLite and Postgres 7.4, with PySQLite1 and PySQLite2, psycopg1 and psycopg2. ---------------------------------------------------------------------- Comment By: Rick Copeland (rick446) Date: 2006-09-04 19:40 Message: Logged In: YES user_id=1583356 Given that the test which I attached fails, what is the next step to resolve this issue? ---------------------------------------------------------------------- Comment By: Oleg Broytmann (phd) Date: 2006-09-04 18:29 Message: Logged In: YES user_id=4799 I rewrote the test to the SQLObject test suite: from sqlobject import * from sqlobject.inheritance import * from sqlobject.tests.dbtest import * class TestCascade1(InheritableSQLObject): dummy=IntCol() class TestCascade2(TestCascade1): c=ForeignKey('TestCascade3', cascade='null') class TestCascade3(SQLObject): dummy=IntCol() def test_destroySelf(): setupClass([TestCascade1, TestCascade3, TestCascade2]) c = TestCascade3(dummy=1) b = TestCascade2(cID=c.id, dummy=1) c.destroySelf() print b and it works even without your patch. So the test is invalid. This is the debugging output: ============================= test process starts ============================= testing-mode: inprocess executable: /usr/local/bin/python (2.4.3-final-0) using py lib: /usr/local/src/Python/py-dist/py <rev unknown> testDestroyCascade.py[1] inserting into sys.path: /usr/local/src/Python/py-dist 1/QueryOne: SELECT COUNT(relname) FROM pg_class WHERE relname = 'test_cascade2' 1/QueryR : SELECT COUNT(relname) FROM pg_class WHERE relname = 'test_cascade2' 1/COMMIT : auto 1/QueryOne: SELECT COUNT(relname) FROM pg_class WHERE relname = 'test_cascade3' 1/QueryR : SELECT COUNT(relname) FROM pg_class WHERE relname = 'test_cascade3' 1/COMMIT : auto 1/QueryOne: SELECT COUNT(relname) FROM pg_class WHERE relname = 'test_cascade1' 1/QueryR : SELECT COUNT(relname) FROM pg_class WHERE relname = 'test_cascade1' 1/COMMIT : auto 1/QueryOne: SELECT COUNT(relname) FROM pg_class WHERE relname = 'test_cascade2' 1/QueryR : SELECT COUNT(relname) FROM pg_class WHERE relname = 'test_cascade2' 1/COMMIT : auto 1/QueryOne: SELECT COUNT(relname) FROM pg_class WHERE relname = 'test_cascade3' 1/QueryR : SELECT COUNT(relname) FROM pg_class WHERE relname = 'test_cascade3' 1/COMMIT : auto 1/QueryOne: SELECT COUNT(relname) FROM pg_class WHERE relname = 'test_cascade1' 1/QueryR : SELECT COUNT(relname) FROM pg_class WHERE relname = 'test_cascade1' 1/COMMIT : auto 1/QueryOne: SELECT COUNT(relname) FROM pg_class WHERE relname = 'test_cascade1' 1/QueryR : SELECT COUNT(relname) FROM pg_class WHERE relname = 'test_cascade1' 1/COMMIT : auto 1/Query : CREATE TABLE test_cascade1 ( id SERIAL PRIMARY KEY, child_name VARCHAR(255), dummy INT ) 1/QueryR : CREATE TABLE test_cascade1 ( id SERIAL PRIMARY KEY, child_name VARCHAR(255), dummy INT ) 1/COMMIT : auto 1/QueryOne: SELECT COUNT(relname) FROM pg_class WHERE relname = 'test_cascade3' 1/QueryR : SELECT COUNT(relname) FROM pg_class WHERE relname = 'test_cascade3' 1/COMMIT : auto 1/Query : CREATE TABLE test_cascade3 ( id SERIAL PRIMARY KEY, dummy INT ) 1/QueryR : CREATE TABLE test_cascade3 ( id SERIAL PRIMARY KEY, dummy INT ) 1/COMMIT : auto 1/QueryOne: SELECT COUNT(relname) FROM pg_class WHERE relname = 'test_cascade2' 1/QueryR : SELECT COUNT(relname) FROM pg_class WHERE relname = 'test_cascade2' 1/COMMIT : auto 1/Query : CREATE TABLE test_cascade2 ( id SERIAL PRIMARY KEY, child_name VARCHAR(255), c_id INT, CONSTRAINT c_id_exists FOREIGN KEY (c_id) REFERENCES test_cascade3 (id) ON DELETE SET NULL ) 1/QueryR : CREATE TABLE test_cascade2 ( id SERIAL PRIMARY KEY, child_name VARCHAR(255), c_id INT, CONSTRAINT c_id_exists FOREIGN KEY (c_id) REFERENCES test_cascade3 (id) ON DELETE SET NULL ) 1/COMMIT : auto 1/QueryIns: INSERT INTO test_cascade3 (id, dummy) VALUES (1, 1) 1/COMMIT : auto 1/QueryOne: SELECT dummy FROM test_cascade3 WHERE id = (1) 1/QueryR : SELECT dummy FROM test_cascade3 WHERE id = (1) 1/COMMIT : auto 1/QueryIns: INSERT INTO test_cascade1 (id, dummy, child_name) VALUES (1, 1, NULL) 1/COMMIT : auto 1/QueryOne: SELECT child_name, dummy FROM test_cascade1 WHERE id = (1) 1/QueryR : SELECT child_name, dummy FROM test_cascade1 WHERE id = (1) 1/COMMIT : auto 1/Query : UPDATE test_cascade1 SET child_name = ('TestCascade2') WHERE id = (1) 1/QueryR : UPDATE test_cascade1 SET child_name = ('TestCascade2') WHERE id = (1) 1/COMMIT : auto 1/QueryIns: INSERT INTO test_cascade2 (id, child_name, c_id) VALUES (1, NULL, 1) 1/COMMIT : auto 1/QueryOne: SELECT child_name, c_id FROM test_cascade2. ================== tests finished: 1 passed in 0.28 seconds =================== WHERE id = (1) 1/QueryR : SELECT child_name, c_id FROM test_cascade2 WHERE id = (1) 1/COMMIT : auto 1/Select : SELECT test_cascade2.id, test_cascade2.child_name, test_cascade2.c_id FROM test_cascade2 WHERE c_id = (1) 1/QueryR : SELECT test_cascade2.id, test_cascade2.child_name, test_cascade2.c_id FROM test_cascade2 WHERE c_id = (1) 1/COMMIT : auto 1/Query : UPDATE test_cascade2 SET c_id = (NULL) WHERE id = (1) 1/QueryR : UPDATE test_cascade2 SET c_id = (NULL) WHERE id = (1) 1/COMMIT : auto 1/Query : DELETE FROM test_cascade3 WHERE id = (1) 1/QueryR : DELETE FROM test_cascade3 WHERE id = (1) 1/COMMIT : auto <TestCascade2 1L cID=None dummy=1> ---------------------------------------------------------------------- Comment By: Rick Copeland (rick446) Date: 2006-09-02 01:02 Message: Logged In: YES user_id=1583356 OK, here's a test that fails with the exception psycopg2.ProgrammingError: invalid input syntax for type boolean: "c_id = (1)" It appears to work OK on sqlite (my other test platform) ---------------------------------------------------------------------- Comment By: Oleg Broytmann (phd) Date: 2006-09-01 19:26 Message: Logged In: YES user_id=4799 Please add a test or at least short test script that fails without the patch. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540674&aid=1546314&group_id=74338 |
|
From: <sub...@co...> - 2006-09-05 13:49:58
|
Author: phd
Date: 2006-09-05 07:49:58 -0600 (Tue, 05 Sep 2006)
New Revision: 1902
Added:
SQLObject/branches/0.7-bugfix/sqlobject/inheritance/tests/testDestroyCascade.py
Modified:
SQLObject/branches/0.7-bugfix/sqlobject/main.py
Log:
Applied the patch 1546314: Fix bug 1546294.
Added: SQLObject/branches/0.7-bugfix/sqlobject/inheritance/tests/testDestroyCascade.py
===================================================================
--- SQLObject/branches/0.7-bugfix/sqlobject/inheritance/tests/testDestroyCascade.py (rev 0)
+++ SQLObject/branches/0.7-bugfix/sqlobject/inheritance/tests/testDestroyCascade.py 2006-09-05 13:49:58 UTC (rev 1902)
@@ -0,0 +1,20 @@
+from sqlobject import *
+from sqlobject.inheritance import *
+from sqlobject.tests.dbtest import *
+
+class TestCascade1(InheritableSQLObject):
+ dummy = IntCol()
+
+class TestCascade2(TestCascade1):
+ c = ForeignKey('TestCascade3', cascade='null')
+
+class TestCascade3(SQLObject):
+ dummy = IntCol()
+
+
+def test_destroySelf():
+ setupClass([TestCascade1, TestCascade3, TestCascade2])
+
+ c = TestCascade3(dummy=1)
+ b = TestCascade2(cID=c.id, dummy=1)
+ c.destroySelf()
Modified: SQLObject/branches/0.7-bugfix/sqlobject/main.py
===================================================================
--- SQLObject/branches/0.7-bugfix/sqlobject/main.py 2006-09-05 13:45:01 UTC (rev 1901)
+++ SQLObject/branches/0.7-bugfix/sqlobject/main.py 2006-09-05 13:49:58 UTC (rev 1902)
@@ -1442,7 +1442,7 @@
if col.cascade == False:
# Found a restriction
restrict = True
- query.append("%s = (%s)" % (col.dbName, self.id))
+ query.append(getattr(k.q, col.name) == self.id)
if col.cascade == 'null':
setnull = col.name
elif col.cascade:
@@ -1451,7 +1451,7 @@
"Class %s depends on %s accoriding to "
"findDependantColumns, but this seems inaccurate"
% (k, klass))
- query = ' OR '.join(query)
+ query = sqlbuilder.OR(*query)
results = k.select(query, connection=self._connection)
if restrict:
if results.count():
|
|
From: <sub...@co...> - 2006-09-05 13:45:09
|
Author: phd
Date: 2006-09-05 07:45:01 -0600 (Tue, 05 Sep 2006)
New Revision: 1901
Added:
SQLObject/trunk/sqlobject/inheritance/tests/testDestroyCascade.py
Modified:
SQLObject/trunk/sqlobject/main.py
Log:
Applied the patch 1546314: Fix bug 1546294.
Added: SQLObject/trunk/sqlobject/inheritance/tests/testDestroyCascade.py
===================================================================
--- SQLObject/trunk/sqlobject/inheritance/tests/testDestroyCascade.py (rev 0)
+++ SQLObject/trunk/sqlobject/inheritance/tests/testDestroyCascade.py 2006-09-05 13:45:01 UTC (rev 1901)
@@ -0,0 +1,20 @@
+from sqlobject import *
+from sqlobject.inheritance import *
+from sqlobject.tests.dbtest import *
+
+class TestCascade1(InheritableSQLObject):
+ dummy = IntCol()
+
+class TestCascade2(TestCascade1):
+ c = ForeignKey('TestCascade3', cascade='null')
+
+class TestCascade3(SQLObject):
+ dummy = IntCol()
+
+
+def test_destroySelf():
+ setupClass([TestCascade1, TestCascade3, TestCascade2])
+
+ c = TestCascade3(dummy=1)
+ b = TestCascade2(cID=c.id, dummy=1)
+ c.destroySelf()
Modified: SQLObject/trunk/sqlobject/main.py
===================================================================
--- SQLObject/trunk/sqlobject/main.py 2006-09-04 15:19:02 UTC (rev 1900)
+++ SQLObject/trunk/sqlobject/main.py 2006-09-05 13:45:01 UTC (rev 1901)
@@ -1498,7 +1498,7 @@
if col.cascade == False:
# Found a restriction
restrict = True
- query.append("%s = (%s)" % (col.dbName, self.id))
+ query.append(getattr(k.q, col.name) == self.id)
if col.cascade == 'null':
setnull = col.name
elif col.cascade:
@@ -1507,7 +1507,7 @@
"Class %s depends on %s accoriding to "
"findDependantColumns, but this seems inaccurate"
% (k, klass))
- query = ' OR '.join(query)
+ query = sqlbuilder.OR(*query)
results = k.select(query, connection=self._connection)
if restrict:
if results.count():
|
|
From: SourceForge.net <no...@so...> - 2006-09-04 16:17:34
|
Patches item #1546314, was opened at 2006-08-24 18:44 Message generated for change (Comment added) made by rick446 You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540674&aid=1546314&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: None Group: None Status: Open Resolution: Invalid Priority: 5 Submitted By: Rick Copeland (rick446) Assigned to: Oleg Broytmann (phd) Summary: Fix bug 1546294 Initial Comment: Here is the patch that fixes bug 1546294. ---------------------------------------------------------------------- >Comment By: Rick Copeland (rick446) Date: 2006-09-04 12:17 Message: Logged In: YES user_id=1583356 I'll give more detail when I get back to work tomorrow, but the "boolean" thing is simple to explain. The WHERE clause generated actually included the *quoted string* "c_id = (1)", as in SELECT blah FROM blah WHERE "c_id = (1)" The use of sqlbuilder in the patch prevents this weird quoting, and seems to be a better way of generating queries, anyway (by the DRY principle). Like I said, I can give you all the details of my installation tomorrow, but my recollection is that I'm using psycopg2, Python 2.4, Postgres 7.4 server, and (I believe) a Postgres 8.0 client. ---------------------------------------------------------------------- Comment By: Oleg Broytmann (phd) Date: 2006-09-04 12:10 Message: Logged In: YES user_id=4799 I'dlike to wait until a clear test. You have reported that the test failed with psycopg2.ProgrammingError: invalid input syntax for type boolean: "c_id = (1)" But I don't see any boolean there. Are you sure you've submitted the same test that produced the error message? Your test works for me with python 2.3 and 2.4, with SQLite and Postgres 7.4, with PySQLite1 and PySQLite2, psycopg1 and psycopg2. ---------------------------------------------------------------------- Comment By: Rick Copeland (rick446) Date: 2006-09-04 11:40 Message: Logged In: YES user_id=1583356 Given that the test which I attached fails, what is the next step to resolve this issue? ---------------------------------------------------------------------- Comment By: Oleg Broytmann (phd) Date: 2006-09-04 10:29 Message: Logged In: YES user_id=4799 I rewrote the test to the SQLObject test suite: from sqlobject import * from sqlobject.inheritance import * from sqlobject.tests.dbtest import * class TestCascade1(InheritableSQLObject): dummy=IntCol() class TestCascade2(TestCascade1): c=ForeignKey('TestCascade3', cascade='null') class TestCascade3(SQLObject): dummy=IntCol() def test_destroySelf(): setupClass([TestCascade1, TestCascade3, TestCascade2]) c = TestCascade3(dummy=1) b = TestCascade2(cID=c.id, dummy=1) c.destroySelf() print b and it works even without your patch. So the test is invalid. This is the debugging output: ============================= test process starts ============================= testing-mode: inprocess executable: /usr/local/bin/python (2.4.3-final-0) using py lib: /usr/local/src/Python/py-dist/py <rev unknown> testDestroyCascade.py[1] inserting into sys.path: /usr/local/src/Python/py-dist 1/QueryOne: SELECT COUNT(relname) FROM pg_class WHERE relname = 'test_cascade2' 1/QueryR : SELECT COUNT(relname) FROM pg_class WHERE relname = 'test_cascade2' 1/COMMIT : auto 1/QueryOne: SELECT COUNT(relname) FROM pg_class WHERE relname = 'test_cascade3' 1/QueryR : SELECT COUNT(relname) FROM pg_class WHERE relname = 'test_cascade3' 1/COMMIT : auto 1/QueryOne: SELECT COUNT(relname) FROM pg_class WHERE relname = 'test_cascade1' 1/QueryR : SELECT COUNT(relname) FROM pg_class WHERE relname = 'test_cascade1' 1/COMMIT : auto 1/QueryOne: SELECT COUNT(relname) FROM pg_class WHERE relname = 'test_cascade2' 1/QueryR : SELECT COUNT(relname) FROM pg_class WHERE relname = 'test_cascade2' 1/COMMIT : auto 1/QueryOne: SELECT COUNT(relname) FROM pg_class WHERE relname = 'test_cascade3' 1/QueryR : SELECT COUNT(relname) FROM pg_class WHERE relname = 'test_cascade3' 1/COMMIT : auto 1/QueryOne: SELECT COUNT(relname) FROM pg_class WHERE relname = 'test_cascade1' 1/QueryR : SELECT COUNT(relname) FROM pg_class WHERE relname = 'test_cascade1' 1/COMMIT : auto 1/QueryOne: SELECT COUNT(relname) FROM pg_class WHERE relname = 'test_cascade1' 1/QueryR : SELECT COUNT(relname) FROM pg_class WHERE relname = 'test_cascade1' 1/COMMIT : auto 1/Query : CREATE TABLE test_cascade1 ( id SERIAL PRIMARY KEY, child_name VARCHAR(255), dummy INT ) 1/QueryR : CREATE TABLE test_cascade1 ( id SERIAL PRIMARY KEY, child_name VARCHAR(255), dummy INT ) 1/COMMIT : auto 1/QueryOne: SELECT COUNT(relname) FROM pg_class WHERE relname = 'test_cascade3' 1/QueryR : SELECT COUNT(relname) FROM pg_class WHERE relname = 'test_cascade3' 1/COMMIT : auto 1/Query : CREATE TABLE test_cascade3 ( id SERIAL PRIMARY KEY, dummy INT ) 1/QueryR : CREATE TABLE test_cascade3 ( id SERIAL PRIMARY KEY, dummy INT ) 1/COMMIT : auto 1/QueryOne: SELECT COUNT(relname) FROM pg_class WHERE relname = 'test_cascade2' 1/QueryR : SELECT COUNT(relname) FROM pg_class WHERE relname = 'test_cascade2' 1/COMMIT : auto 1/Query : CREATE TABLE test_cascade2 ( id SERIAL PRIMARY KEY, child_name VARCHAR(255), c_id INT, CONSTRAINT c_id_exists FOREIGN KEY (c_id) REFERENCES test_cascade3 (id) ON DELETE SET NULL ) 1/QueryR : CREATE TABLE test_cascade2 ( id SERIAL PRIMARY KEY, child_name VARCHAR(255), c_id INT, CONSTRAINT c_id_exists FOREIGN KEY (c_id) REFERENCES test_cascade3 (id) ON DELETE SET NULL ) 1/COMMIT : auto 1/QueryIns: INSERT INTO test_cascade3 (id, dummy) VALUES (1, 1) 1/COMMIT : auto 1/QueryOne: SELECT dummy FROM test_cascade3 WHERE id = (1) 1/QueryR : SELECT dummy FROM test_cascade3 WHERE id = (1) 1/COMMIT : auto 1/QueryIns: INSERT INTO test_cascade1 (id, dummy, child_name) VALUES (1, 1, NULL) 1/COMMIT : auto 1/QueryOne: SELECT child_name, dummy FROM test_cascade1 WHERE id = (1) 1/QueryR : SELECT child_name, dummy FROM test_cascade1 WHERE id = (1) 1/COMMIT : auto 1/Query : UPDATE test_cascade1 SET child_name = ('TestCascade2') WHERE id = (1) 1/QueryR : UPDATE test_cascade1 SET child_name = ('TestCascade2') WHERE id = (1) 1/COMMIT : auto 1/QueryIns: INSERT INTO test_cascade2 (id, child_name, c_id) VALUES (1, NULL, 1) 1/COMMIT : auto 1/QueryOne: SELECT child_name, c_id FROM test_cascade2. ================== tests finished: 1 passed in 0.28 seconds =================== WHERE id = (1) 1/QueryR : SELECT child_name, c_id FROM test_cascade2 WHERE id = (1) 1/COMMIT : auto 1/Select : SELECT test_cascade2.id, test_cascade2.child_name, test_cascade2.c_id FROM test_cascade2 WHERE c_id = (1) 1/QueryR : SELECT test_cascade2.id, test_cascade2.child_name, test_cascade2.c_id FROM test_cascade2 WHERE c_id = (1) 1/COMMIT : auto 1/Query : UPDATE test_cascade2 SET c_id = (NULL) WHERE id = (1) 1/QueryR : UPDATE test_cascade2 SET c_id = (NULL) WHERE id = (1) 1/COMMIT : auto 1/Query : DELETE FROM test_cascade3 WHERE id = (1) 1/QueryR : DELETE FROM test_cascade3 WHERE id = (1) 1/COMMIT : auto <TestCascade2 1L cID=None dummy=1> ---------------------------------------------------------------------- Comment By: Rick Copeland (rick446) Date: 2006-09-01 17:02 Message: Logged In: YES user_id=1583356 OK, here's a test that fails with the exception psycopg2.ProgrammingError: invalid input syntax for type boolean: "c_id = (1)" It appears to work OK on sqlite (my other test platform) ---------------------------------------------------------------------- Comment By: Oleg Broytmann (phd) Date: 2006-09-01 11:26 Message: Logged In: YES user_id=4799 Please add a test or at least short test script that fails without the patch. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540674&aid=1546314&group_id=74338 |
|
From: SourceForge.net <no...@so...> - 2006-09-04 16:10:59
|
Patches item #1546314, was opened at 2006-08-25 02:44 Message generated for change (Comment added) made by phd You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540674&aid=1546314&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: None Group: None Status: Open Resolution: Invalid Priority: 5 Submitted By: Rick Copeland (rick446) Assigned to: Oleg Broytmann (phd) Summary: Fix bug 1546294 Initial Comment: Here is the patch that fixes bug 1546294. ---------------------------------------------------------------------- >Comment By: Oleg Broytmann (phd) Date: 2006-09-04 20:10 Message: Logged In: YES user_id=4799 I'dlike to wait until a clear test. You have reported that the test failed with psycopg2.ProgrammingError: invalid input syntax for type boolean: "c_id = (1)" But I don't see any boolean there. Are you sure you've submitted the same test that produced the error message? Your test works for me with python 2.3 and 2.4, with SQLite and Postgres 7.4, with PySQLite1 and PySQLite2, psycopg1 and psycopg2. ---------------------------------------------------------------------- Comment By: Rick Copeland (rick446) Date: 2006-09-04 19:40 Message: Logged In: YES user_id=1583356 Given that the test which I attached fails, what is the next step to resolve this issue? ---------------------------------------------------------------------- Comment By: Oleg Broytmann (phd) Date: 2006-09-04 18:29 Message: Logged In: YES user_id=4799 I rewrote the test to the SQLObject test suite: from sqlobject import * from sqlobject.inheritance import * from sqlobject.tests.dbtest import * class TestCascade1(InheritableSQLObject): dummy=IntCol() class TestCascade2(TestCascade1): c=ForeignKey('TestCascade3', cascade='null') class TestCascade3(SQLObject): dummy=IntCol() def test_destroySelf(): setupClass([TestCascade1, TestCascade3, TestCascade2]) c = TestCascade3(dummy=1) b = TestCascade2(cID=c.id, dummy=1) c.destroySelf() print b and it works even without your patch. So the test is invalid. This is the debugging output: ============================= test process starts ============================= testing-mode: inprocess executable: /usr/local/bin/python (2.4.3-final-0) using py lib: /usr/local/src/Python/py-dist/py <rev unknown> testDestroyCascade.py[1] inserting into sys.path: /usr/local/src/Python/py-dist 1/QueryOne: SELECT COUNT(relname) FROM pg_class WHERE relname = 'test_cascade2' 1/QueryR : SELECT COUNT(relname) FROM pg_class WHERE relname = 'test_cascade2' 1/COMMIT : auto 1/QueryOne: SELECT COUNT(relname) FROM pg_class WHERE relname = 'test_cascade3' 1/QueryR : SELECT COUNT(relname) FROM pg_class WHERE relname = 'test_cascade3' 1/COMMIT : auto 1/QueryOne: SELECT COUNT(relname) FROM pg_class WHERE relname = 'test_cascade1' 1/QueryR : SELECT COUNT(relname) FROM pg_class WHERE relname = 'test_cascade1' 1/COMMIT : auto 1/QueryOne: SELECT COUNT(relname) FROM pg_class WHERE relname = 'test_cascade2' 1/QueryR : SELECT COUNT(relname) FROM pg_class WHERE relname = 'test_cascade2' 1/COMMIT : auto 1/QueryOne: SELECT COUNT(relname) FROM pg_class WHERE relname = 'test_cascade3' 1/QueryR : SELECT COUNT(relname) FROM pg_class WHERE relname = 'test_cascade3' 1/COMMIT : auto 1/QueryOne: SELECT COUNT(relname) FROM pg_class WHERE relname = 'test_cascade1' 1/QueryR : SELECT COUNT(relname) FROM pg_class WHERE relname = 'test_cascade1' 1/COMMIT : auto 1/QueryOne: SELECT COUNT(relname) FROM pg_class WHERE relname = 'test_cascade1' 1/QueryR : SELECT COUNT(relname) FROM pg_class WHERE relname = 'test_cascade1' 1/COMMIT : auto 1/Query : CREATE TABLE test_cascade1 ( id SERIAL PRIMARY KEY, child_name VARCHAR(255), dummy INT ) 1/QueryR : CREATE TABLE test_cascade1 ( id SERIAL PRIMARY KEY, child_name VARCHAR(255), dummy INT ) 1/COMMIT : auto 1/QueryOne: SELECT COUNT(relname) FROM pg_class WHERE relname = 'test_cascade3' 1/QueryR : SELECT COUNT(relname) FROM pg_class WHERE relname = 'test_cascade3' 1/COMMIT : auto 1/Query : CREATE TABLE test_cascade3 ( id SERIAL PRIMARY KEY, dummy INT ) 1/QueryR : CREATE TABLE test_cascade3 ( id SERIAL PRIMARY KEY, dummy INT ) 1/COMMIT : auto 1/QueryOne: SELECT COUNT(relname) FROM pg_class WHERE relname = 'test_cascade2' 1/QueryR : SELECT COUNT(relname) FROM pg_class WHERE relname = 'test_cascade2' 1/COMMIT : auto 1/Query : CREATE TABLE test_cascade2 ( id SERIAL PRIMARY KEY, child_name VARCHAR(255), c_id INT, CONSTRAINT c_id_exists FOREIGN KEY (c_id) REFERENCES test_cascade3 (id) ON DELETE SET NULL ) 1/QueryR : CREATE TABLE test_cascade2 ( id SERIAL PRIMARY KEY, child_name VARCHAR(255), c_id INT, CONSTRAINT c_id_exists FOREIGN KEY (c_id) REFERENCES test_cascade3 (id) ON DELETE SET NULL ) 1/COMMIT : auto 1/QueryIns: INSERT INTO test_cascade3 (id, dummy) VALUES (1, 1) 1/COMMIT : auto 1/QueryOne: SELECT dummy FROM test_cascade3 WHERE id = (1) 1/QueryR : SELECT dummy FROM test_cascade3 WHERE id = (1) 1/COMMIT : auto 1/QueryIns: INSERT INTO test_cascade1 (id, dummy, child_name) VALUES (1, 1, NULL) 1/COMMIT : auto 1/QueryOne: SELECT child_name, dummy FROM test_cascade1 WHERE id = (1) 1/QueryR : SELECT child_name, dummy FROM test_cascade1 WHERE id = (1) 1/COMMIT : auto 1/Query : UPDATE test_cascade1 SET child_name = ('TestCascade2') WHERE id = (1) 1/QueryR : UPDATE test_cascade1 SET child_name = ('TestCascade2') WHERE id = (1) 1/COMMIT : auto 1/QueryIns: INSERT INTO test_cascade2 (id, child_name, c_id) VALUES (1, NULL, 1) 1/COMMIT : auto 1/QueryOne: SELECT child_name, c_id FROM test_cascade2. ================== tests finished: 1 passed in 0.28 seconds =================== WHERE id = (1) 1/QueryR : SELECT child_name, c_id FROM test_cascade2 WHERE id = (1) 1/COMMIT : auto 1/Select : SELECT test_cascade2.id, test_cascade2.child_name, test_cascade2.c_id FROM test_cascade2 WHERE c_id = (1) 1/QueryR : SELECT test_cascade2.id, test_cascade2.child_name, test_cascade2.c_id FROM test_cascade2 WHERE c_id = (1) 1/COMMIT : auto 1/Query : UPDATE test_cascade2 SET c_id = (NULL) WHERE id = (1) 1/QueryR : UPDATE test_cascade2 SET c_id = (NULL) WHERE id = (1) 1/COMMIT : auto 1/Query : DELETE FROM test_cascade3 WHERE id = (1) 1/QueryR : DELETE FROM test_cascade3 WHERE id = (1) 1/COMMIT : auto <TestCascade2 1L cID=None dummy=1> ---------------------------------------------------------------------- Comment By: Rick Copeland (rick446) Date: 2006-09-02 01:02 Message: Logged In: YES user_id=1583356 OK, here's a test that fails with the exception psycopg2.ProgrammingError: invalid input syntax for type boolean: "c_id = (1)" It appears to work OK on sqlite (my other test platform) ---------------------------------------------------------------------- Comment By: Oleg Broytmann (phd) Date: 2006-09-01 19:26 Message: Logged In: YES user_id=4799 Please add a test or at least short test script that fails without the patch. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540674&aid=1546314&group_id=74338 |
|
From: SourceForge.net <no...@so...> - 2006-09-04 15:40:46
|
Patches item #1546314, was opened at 2006-08-24 18:44 Message generated for change (Comment added) made by rick446 You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540674&aid=1546314&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: None Group: None Status: Open Resolution: Invalid Priority: 5 Submitted By: Rick Copeland (rick446) Assigned to: Oleg Broytmann (phd) Summary: Fix bug 1546294 Initial Comment: Here is the patch that fixes bug 1546294. ---------------------------------------------------------------------- >Comment By: Rick Copeland (rick446) Date: 2006-09-04 11:40 Message: Logged In: YES user_id=1583356 Given that the test which I attached fails, what is the next step to resolve this issue? ---------------------------------------------------------------------- Comment By: Oleg Broytmann (phd) Date: 2006-09-04 10:29 Message: Logged In: YES user_id=4799 I rewrote the test to the SQLObject test suite: from sqlobject import * from sqlobject.inheritance import * from sqlobject.tests.dbtest import * class TestCascade1(InheritableSQLObject): dummy=IntCol() class TestCascade2(TestCascade1): c=ForeignKey('TestCascade3', cascade='null') class TestCascade3(SQLObject): dummy=IntCol() def test_destroySelf(): setupClass([TestCascade1, TestCascade3, TestCascade2]) c = TestCascade3(dummy=1) b = TestCascade2(cID=c.id, dummy=1) c.destroySelf() print b and it works even without your patch. So the test is invalid. This is the debugging output: ============================= test process starts ============================= testing-mode: inprocess executable: /usr/local/bin/python (2.4.3-final-0) using py lib: /usr/local/src/Python/py-dist/py <rev unknown> testDestroyCascade.py[1] inserting into sys.path: /usr/local/src/Python/py-dist 1/QueryOne: SELECT COUNT(relname) FROM pg_class WHERE relname = 'test_cascade2' 1/QueryR : SELECT COUNT(relname) FROM pg_class WHERE relname = 'test_cascade2' 1/COMMIT : auto 1/QueryOne: SELECT COUNT(relname) FROM pg_class WHERE relname = 'test_cascade3' 1/QueryR : SELECT COUNT(relname) FROM pg_class WHERE relname = 'test_cascade3' 1/COMMIT : auto 1/QueryOne: SELECT COUNT(relname) FROM pg_class WHERE relname = 'test_cascade1' 1/QueryR : SELECT COUNT(relname) FROM pg_class WHERE relname = 'test_cascade1' 1/COMMIT : auto 1/QueryOne: SELECT COUNT(relname) FROM pg_class WHERE relname = 'test_cascade2' 1/QueryR : SELECT COUNT(relname) FROM pg_class WHERE relname = 'test_cascade2' 1/COMMIT : auto 1/QueryOne: SELECT COUNT(relname) FROM pg_class WHERE relname = 'test_cascade3' 1/QueryR : SELECT COUNT(relname) FROM pg_class WHERE relname = 'test_cascade3' 1/COMMIT : auto 1/QueryOne: SELECT COUNT(relname) FROM pg_class WHERE relname = 'test_cascade1' 1/QueryR : SELECT COUNT(relname) FROM pg_class WHERE relname = 'test_cascade1' 1/COMMIT : auto 1/QueryOne: SELECT COUNT(relname) FROM pg_class WHERE relname = 'test_cascade1' 1/QueryR : SELECT COUNT(relname) FROM pg_class WHERE relname = 'test_cascade1' 1/COMMIT : auto 1/Query : CREATE TABLE test_cascade1 ( id SERIAL PRIMARY KEY, child_name VARCHAR(255), dummy INT ) 1/QueryR : CREATE TABLE test_cascade1 ( id SERIAL PRIMARY KEY, child_name VARCHAR(255), dummy INT ) 1/COMMIT : auto 1/QueryOne: SELECT COUNT(relname) FROM pg_class WHERE relname = 'test_cascade3' 1/QueryR : SELECT COUNT(relname) FROM pg_class WHERE relname = 'test_cascade3' 1/COMMIT : auto 1/Query : CREATE TABLE test_cascade3 ( id SERIAL PRIMARY KEY, dummy INT ) 1/QueryR : CREATE TABLE test_cascade3 ( id SERIAL PRIMARY KEY, dummy INT ) 1/COMMIT : auto 1/QueryOne: SELECT COUNT(relname) FROM pg_class WHERE relname = 'test_cascade2' 1/QueryR : SELECT COUNT(relname) FROM pg_class WHERE relname = 'test_cascade2' 1/COMMIT : auto 1/Query : CREATE TABLE test_cascade2 ( id SERIAL PRIMARY KEY, child_name VARCHAR(255), c_id INT, CONSTRAINT c_id_exists FOREIGN KEY (c_id) REFERENCES test_cascade3 (id) ON DELETE SET NULL ) 1/QueryR : CREATE TABLE test_cascade2 ( id SERIAL PRIMARY KEY, child_name VARCHAR(255), c_id INT, CONSTRAINT c_id_exists FOREIGN KEY (c_id) REFERENCES test_cascade3 (id) ON DELETE SET NULL ) 1/COMMIT : auto 1/QueryIns: INSERT INTO test_cascade3 (id, dummy) VALUES (1, 1) 1/COMMIT : auto 1/QueryOne: SELECT dummy FROM test_cascade3 WHERE id = (1) 1/QueryR : SELECT dummy FROM test_cascade3 WHERE id = (1) 1/COMMIT : auto 1/QueryIns: INSERT INTO test_cascade1 (id, dummy, child_name) VALUES (1, 1, NULL) 1/COMMIT : auto 1/QueryOne: SELECT child_name, dummy FROM test_cascade1 WHERE id = (1) 1/QueryR : SELECT child_name, dummy FROM test_cascade1 WHERE id = (1) 1/COMMIT : auto 1/Query : UPDATE test_cascade1 SET child_name = ('TestCascade2') WHERE id = (1) 1/QueryR : UPDATE test_cascade1 SET child_name = ('TestCascade2') WHERE id = (1) 1/COMMIT : auto 1/QueryIns: INSERT INTO test_cascade2 (id, child_name, c_id) VALUES (1, NULL, 1) 1/COMMIT : auto 1/QueryOne: SELECT child_name, c_id FROM test_cascade2. ================== tests finished: 1 passed in 0.28 seconds =================== WHERE id = (1) 1/QueryR : SELECT child_name, c_id FROM test_cascade2 WHERE id = (1) 1/COMMIT : auto 1/Select : SELECT test_cascade2.id, test_cascade2.child_name, test_cascade2.c_id FROM test_cascade2 WHERE c_id = (1) 1/QueryR : SELECT test_cascade2.id, test_cascade2.child_name, test_cascade2.c_id FROM test_cascade2 WHERE c_id = (1) 1/COMMIT : auto 1/Query : UPDATE test_cascade2 SET c_id = (NULL) WHERE id = (1) 1/QueryR : UPDATE test_cascade2 SET c_id = (NULL) WHERE id = (1) 1/COMMIT : auto 1/Query : DELETE FROM test_cascade3 WHERE id = (1) 1/QueryR : DELETE FROM test_cascade3 WHERE id = (1) 1/COMMIT : auto <TestCascade2 1L cID=None dummy=1> ---------------------------------------------------------------------- Comment By: Rick Copeland (rick446) Date: 2006-09-01 17:02 Message: Logged In: YES user_id=1583356 OK, here's a test that fails with the exception psycopg2.ProgrammingError: invalid input syntax for type boolean: "c_id = (1)" It appears to work OK on sqlite (my other test platform) ---------------------------------------------------------------------- Comment By: Oleg Broytmann (phd) Date: 2006-09-01 11:26 Message: Logged In: YES user_id=4799 Please add a test or at least short test script that fails without the patch. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540674&aid=1546314&group_id=74338 |
|
From: <sub...@co...> - 2006-09-04 15:19:07
|
Author: phd
Date: 2006-09-04 09:19:02 -0600 (Mon, 04 Sep 2006)
New Revision: 1900
Modified:
home/phd/SQLObject/paramstyles/sqlobject/main.py
home/phd/SQLObject/paramstyles/sqlobject/tests/test_unicode.py
Log:
Merged patches from the revisions 1895:1899 from the trunk
Modified: home/phd/SQLObject/paramstyles/sqlobject/main.py
===================================================================
--- home/phd/SQLObject/paramstyles/sqlobject/main.py 2006-09-04 15:17:56 UTC (rev 1899)
+++ home/phd/SQLObject/paramstyles/sqlobject/main.py 2006-09-04 15:19:02 UTC (rev 1900)
@@ -1279,10 +1279,14 @@
return getID(obj)
def _findAlternateID(cls, name, dbName, value, connection=None):
+ for key, column in cls.sqlmeta.columns.items():
+ if (key == name) and isinstance(column, col.SOUnicodeCol):
+ if isinstance(value, unicode):
+ value = value.encode(column.dbEncoding)
return (connection or cls._connection)._SO_selectOneAlt(
cls,
[cls.sqlmeta.idName] +
- [col.dbName for col in cls.sqlmeta.columnList],
+ [column.dbName for column in cls.sqlmeta.columnList],
dbName,
value), None
_findAlternateID = classmethod(_findAlternateID)
Modified: home/phd/SQLObject/paramstyles/sqlobject/tests/test_unicode.py
===================================================================
--- home/phd/SQLObject/paramstyles/sqlobject/tests/test_unicode.py 2006-09-04 15:17:56 UTC (rev 1899)
+++ home/phd/SQLObject/paramstyles/sqlobject/tests/test_unicode.py 2006-09-04 15:19:02 UTC (rev 1900)
@@ -7,7 +7,7 @@
class TestUnicode(SQLObject):
count = IntCol(alternateID=True)
- col1 = UnicodeCol()
+ col1 = UnicodeCol(alternateID=True)
col2 = UnicodeCol(dbEncoding='latin-1')
try:
@@ -44,7 +44,7 @@
def test_select():
setup()
- for value in data:
+ for i, value in enumerate(data):
rows = list(TestUnicode.select(TestUnicode.q.col1 == value))
assert len(rows) == 1
rows = list(TestUnicode.select(TestUnicode.q.col2 == value))
@@ -60,6 +60,8 @@
assert len(rows) == 1
rows = list(TestUnicode.selectBy(col1=value, col2=value))
assert len(rows) == 1
+ row = TestUnicode.byCol1(value)
+ assert row.count == i
rows = list(TestUnicode.select(OR(
TestUnicode.q.col1 == u'\u00f0',
TestUnicode.q.col2 == u'test'
|
|
From: <sub...@co...> - 2006-09-04 15:17:57
|
Author: phd
Date: 2006-09-04 09:17:56 -0600 (Mon, 04 Sep 2006)
New Revision: 1899
Modified:
home/phd/SQLObject/paramstyles/sqlobject/dbconnection.py
home/phd/SQLObject/paramstyles/sqlobject/main.py
home/phd/SQLObject/paramstyles/sqlobject/sqlbuilder.py
home/phd/SQLObject/paramstyles/sqlobject/tests/test_unicode.py
Log:
Merged patches from the revisions 1890:1895 from the trunk
Modified: home/phd/SQLObject/paramstyles/sqlobject/dbconnection.py
===================================================================
--- home/phd/SQLObject/paramstyles/sqlobject/dbconnection.py 2006-09-04 15:15:00 UTC (rev 1898)
+++ home/phd/SQLObject/paramstyles/sqlobject/dbconnection.py 2006-09-04 15:17:56 UTC (rev 1899)
@@ -96,7 +96,8 @@
else:
host, rest = rest.split('/', 1)
if host and host.find('@') != -1:
- user, host = host.rsplit('@', 1)
+ user = host[:host.rfind('@')] # Python 2.3 doesn't have .rsplit()
+ host = host[host.rfind('@')+1:] # !!!
if user.find(':') != -1:
user, password = user.split(':', 1)
else:
Modified: home/phd/SQLObject/paramstyles/sqlobject/main.py
===================================================================
--- home/phd/SQLObject/paramstyles/sqlobject/main.py 2006-09-04 15:15:00 UTC (rev 1898)
+++ home/phd/SQLObject/paramstyles/sqlobject/main.py 2006-09-04 15:17:56 UTC (rev 1899)
@@ -1328,6 +1328,11 @@
select = classmethod(select)
def selectBy(cls, connection=None, **kw):
+ for key, column in cls.sqlmeta.columns.items():
+ if (key in kw) and isinstance(column, col.SOUnicodeCol):
+ value = kw[key]
+ if isinstance(value, unicode):
+ kw[key] = value.encode(column.dbEncoding)
conn = connection or cls._connection
return cls.SelectResultsClass(cls,
conn._SO_columnClause(cls, kw),
Modified: home/phd/SQLObject/paramstyles/sqlobject/sqlbuilder.py
===================================================================
--- home/phd/SQLObject/paramstyles/sqlobject/sqlbuilder.py 2006-09-04 15:15:00 UTC (rev 1898)
+++ home/phd/SQLObject/paramstyles/sqlobject/sqlbuilder.py 2006-09-04 15:17:56 UTC (rev 1899)
@@ -363,6 +363,23 @@
registerConverter(SQLObjectField, SQLExprConverter)
+
+class UnicodeField(SQLObjectField):
+ def __init__(self, tableName, fieldName, original, column):
+ SQLObjectField.__init__(self, tableName, fieldName, original)
+ self.column = column
+ def __eq__(self, other):
+ if isinstance(other, unicode):
+ other = other.encode(self.column.dbEncoding)
+ return SQLOp('=', self, other)
+ def __ne__(self, other):
+ if isinstance(other, unicode):
+ other = other.encode(self.column.dbEncoding)
+ return SQLOp('<>', self, other)
+
+registerConverter(UnicodeField, SQLExprConverter)
+
+
class Table(SQLExpression, SQLListMixin):
FieldClass = Field
@@ -379,6 +396,7 @@
class SQLObjectTable(Table):
FieldClass = SQLObjectField
+ UnicodeFieldClass = UnicodeField
def __init__(self, soClass):
self.soClass = soClass
@@ -395,9 +413,12 @@
elif attr not in self.soClass.sqlmeta.columns:
raise AttributeError("%s instance has no attribute '%s'" % (self.soClass.__name__, attr))
else:
- return self.FieldClass(self.tableName,
- self.soClass.sqlmeta.columns[attr].dbName,
- attr)
+ column = self.soClass.sqlmeta.columns[attr]
+ if hasattr(column, "dbEncoding"):
+ return self.UnicodeFieldClass(self.tableName, column.dbName,
+ attr, column)
+ else:
+ return self.FieldClass(self.tableName, column.dbName, attr)
class TableSpace:
TableClass = Table
Modified: home/phd/SQLObject/paramstyles/sqlobject/tests/test_unicode.py
===================================================================
--- home/phd/SQLObject/paramstyles/sqlobject/tests/test_unicode.py 2006-09-04 15:15:00 UTC (rev 1898)
+++ home/phd/SQLObject/paramstyles/sqlobject/tests/test_unicode.py 2006-09-04 15:17:56 UTC (rev 1899)
@@ -5,7 +5,7 @@
## Unicode columns
########################################
-class Unicode1(SQLObject):
+class TestUnicode(SQLObject):
count = IntCol(alternateID=True)
col1 = UnicodeCol()
col2 = UnicodeCol(dbEncoding='latin-1')
@@ -16,24 +16,54 @@
def enumerate(lst):
return [(i, lst[i]) for i in range(len(lst))]
-def test_create():
- setupClass(Unicode1)
- data = [u'\u00f0', u'test', 'ascii test']
+data = [u'\u00f0', u'test', 'ascii test']
+items = []
+def setup():
+ global items
items = []
+ setupClass(TestUnicode)
for i, n in enumerate(data):
- items.append(Unicode1(count=i, col1=n, col2=n))
+ items.append(TestUnicode(count=i, col1=n, col2=n))
+
+def test_create():
+ setup()
for n, item in zip(data, items):
- item.col1 = item.col2 = n
- for n, item in zip(data, items):
assert item.col1 == item.col2
assert item.col1 == n
- conn = Unicode1._connection
+
+ conn = TestUnicode._connection
rows = conn.queryAll("""
SELECT count, col1, col2
- FROM unicode1
+ FROM test_unicode
ORDER BY count
""")
for count, col1, col2 in rows:
assert data[count].encode('utf-8') == col1
assert data[count].encode('latin1') == col2
+
+def test_select():
+ setup()
+ for value in data:
+ rows = list(TestUnicode.select(TestUnicode.q.col1 == value))
+ assert len(rows) == 1
+ rows = list(TestUnicode.select(TestUnicode.q.col2 == value))
+ assert len(rows) == 1
+ rows = list(TestUnicode.select(AND(
+ TestUnicode.q.col1 == value,
+ TestUnicode.q.col2 == value
+ )))
+ assert len(rows) == 1
+ rows = list(TestUnicode.selectBy(col1=value))
+ assert len(rows) == 1
+ rows = list(TestUnicode.selectBy(col2=value))
+ assert len(rows) == 1
+ rows = list(TestUnicode.selectBy(col1=value, col2=value))
+ assert len(rows) == 1
+ rows = list(TestUnicode.select(OR(
+ TestUnicode.q.col1 == u'\u00f0',
+ TestUnicode.q.col2 == u'test'
+ )))
+ assert len(rows) == 2
+ rows = list(TestUnicode.selectBy(col1=u'\u00f0', col2=u'test'))
+ assert len(rows) == 0
|
|
From: <sub...@co...> - 2006-09-04 15:15:02
|
Author: phd
Date: 2006-09-04 09:15:00 -0600 (Mon, 04 Sep 2006)
New Revision: 1898
Modified:
SQLObject/docs/News.txt
SQLObject/docs/SQLObject.txt
Log:
Updated docs: removed duplicate description of the unicode fix, added a .byName() example.
Modified: SQLObject/docs/News.txt
===================================================================
--- SQLObject/docs/News.txt 2006-09-04 15:01:36 UTC (rev 1897)
+++ SQLObject/docs/News.txt 2006-09-04 15:15:00 UTC (rev 1898)
@@ -111,23 +111,10 @@
* Fixed a longstanding problem with UnicodeCol - at last you can use unicode
strings in .select() and .selectBy() queries. There are some limitations,
- though:
+ though; see the description of the UnicodeCol_.
- - only simple q-magic fields are supported; no expressions;
- - only == and <> operators are supported;
+.. _UnicodeCol: SQLObject.html#column-types
- The following code works::
-
- MyTable.select(u'value' == MyTable.q.name)
- MyTable.select(MyTable.q.name <> u'value')
- MyTable.select(OR(MyTable.q.col1 == u'value1', MyTable.q.col2 <> u'value2'))
- MyTable.selectBy(name = u'value')
- MyTable.selectBy(col1=u'value1', col2=u'value2')
-
- The following still does not work::
-
- MyTable.select((MyTable.q.name + MyTable.q.surname) == u'value')
-
* Cull patch (clear cache).
* .destroySelf() inside a transaction.
Modified: SQLObject/docs/SQLObject.txt
===================================================================
--- SQLObject/docs/SQLObject.txt 2006-09-04 15:01:36 UTC (rev 1897)
+++ SQLObject/docs/SQLObject.txt 2006-09-04 15:15:00 UTC (rev 1898)
@@ -1140,6 +1140,7 @@
MyTable.select(OR(MyTable.q.col1 == u'value1', MyTable.q.col2 <> u'value2'))
MyTable.selectBy(name = u'value')
MyTable.selectBy(col1=u'value1', col2=u'value2')
+ MyTable.byCol1(u'value1') # if col1 is an alternateID
The following does not work::
|
|
From: SourceForge.net <no...@so...> - 2006-09-04 15:11:48
|
Bugs item #1551880, was opened at 2006-09-04 14:54 Message generated for change (Comment added) made by phd You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540672&aid=1551880&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: DBM Group: SQLObject release (specify) >Status: Closed >Resolution: Works For Me Priority: 5 Submitted By: Nobody/Anonymous (nobody) >Assigned to: Oleg Broytmann (phd) Summary: broken uri for user with password Initial Comment: The uri-Method of DBConnection swaps @ and : for uris with user and password Example: connection_string = 'postgres://user:password@localhost/database' print connectionForURI(connection_string).uri() -> postgres://user@password:localhost/database Version: lib/python2.4/site-packages/SQLObject-0.7.1b1-py2.4.egg/sqlobject/ dbconnection.py ---------------------------------------------------------------------- >Comment By: Oleg Broytmann (phd) Date: 2006-09-04 19:11 Message: Logged In: YES user_id=4799 This has been fixed already: from sqlobject import connectionForURI conn = connectionForURI("postgres://user:password@host/db") print conn.uri() => postgres://user:password@host/db ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540672&aid=1551880&group_id=74338 |
|
From: SourceForge.net <no...@so...> - 2006-09-04 15:02:00
|
Bugs item #1547743, was opened at 2006-08-28 11:57 Message generated for change (Comment added) made by phd You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540672&aid=1547743&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: None Priority: 5 Submitted By: dado1945 (dado1945) Assigned to: Nobody/Anonymous (nobody) Summary: sqlobject-0.7.1dev_r1884, Mysql and unicode Initial Comment: Please, check if suplied string is not unicode already in mysqlconnection.py. There is extract how it could look like: import types ..... if self.need_unicode: # For MysqlDB 1.2.1 and later, we go # encoding->unicode->charset (in the mysql db) if type(query) != types.UnicodeType: query = unicode(query, self.encoding) return cursor.execute(query) else: return cursor.execute(query) ..... Or use "isinstance(query, unicode)". I don't know what different we will have and which one is better to use however. ---------------------------------------------------------------------- >Comment By: Oleg Broytmann (phd) Date: 2006-09-04 19:01 Message: Logged In: YES user_id=4799 The problem is in the code page = model.Article.byName(pagename) "pagename" is unicode here. This is a longstanding problem in SQLObject that I fixed a few days ago. But I have forgotted to fix .byName() case. Thank you for reminding! Fixed it now. Committed in the revision 1896 to the trunk, 1897 to the 0.7-branch. ---------------------------------------------------------------------- Comment By: dado1945 (dado1945) Date: 2006-09-02 00:00 Message: Logged In: YES user_id=1533929 I think here is answer: >>> u = u'1' >>> a = '%s' % u >>> type(a) <type 'unicode'> ---------------------------------------------------------------------- Comment By: dado1945 (dado1945) Date: 2006-09-01 23:58 Message: Logged In: YES user_id=1533929 Here how it happens. I have checked all the traceback and have not found anything what would change unicode string to simple string. I happens only in select it seems. Assignment work OK as far as I remember. File "D:\daliaus\projects\tekshtpleksht\tekshtpleksht\controllers.py", line 208, in save page = model.Article.byName(pagename) File "<string>", line 1, in <lambda> File "d:\program files\python2.4\lib\site-packages\SQLObject-0.7.1dev_r1860-py2.4.egg\sqlobject\main.py", line 1266, in _SO_fetchAlternateID result, obj = cls._findAlternateID(name, dbName, value, connection) File "d:\program files\python2.4\lib\site-packages\SQLObject-0.7.1dev_r1860-py2.4.egg\sqlobject\main.py", line 1262, in _findAlternateID value), None File "d:\program files\python2.4\lib\site-packages\SQLObject-0.7.1dev_r1860-py2.4.egg\sqlobject\dbconnection.py", line 590, in _SO_selectOneAlt return self.queryOne("SELECT %s FROM %s WHERE %s = %s" % File "d:\program files\python2.4\lib\site-packages\SQLObject-0.7.1dev_r1860-py2.4.egg\sqlobject\dbconnection.py", line 760, in queryOne return self._dbConnection._queryOne(self._connection, s) File "d:\program files\python2.4\lib\site-packages\SQLObject-0.7.1dev_r1860-py2.4.egg\sqlobject\dbconnection.py", line 342, in _queryOne self._executeRetry(conn, c, s) File "D:\Program Files\Python2.4\lib\site-packages\sqlobject-0.7.1dev_r1860-py2.4.egg\sqlobject\mysql\mysqlconnection.py", line 74, in _executeRetry myquery = unicode(query, self.encoding) TypeError: decoding Unicode is not supported ---------------------------------------------------------------------- Comment By: Oleg Broytmann (phd) Date: 2006-09-01 19:28 Message: Logged In: YES user_id=4799 But how can the query be unicode in _executeRetry()? The query came from SQLObject so it must be an ascii string here... ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540672&aid=1547743&group_id=74338 |
|
From: <sub...@co...> - 2006-09-04 15:01:40
|
Author: phd
Date: 2006-09-04 09:01:36 -0600 (Mon, 04 Sep 2006)
New Revision: 1897
Modified:
SQLObject/branches/0.7-bugfix/docs/News.txt
SQLObject/branches/0.7-bugfix/docs/SQLObject.txt
SQLObject/branches/0.7-bugfix/sqlobject/main.py
SQLObject/branches/0.7-bugfix/sqlobject/tests/test_unicode.py
Log:
Extended unicode patch to the .byName() case where "name" is an alternateID.
Modified: SQLObject/branches/0.7-bugfix/docs/News.txt
===================================================================
--- SQLObject/branches/0.7-bugfix/docs/News.txt 2006-09-04 15:01:13 UTC (rev 1896)
+++ SQLObject/branches/0.7-bugfix/docs/News.txt 2006-09-04 15:01:36 UTC (rev 1897)
@@ -51,23 +51,10 @@
* Fixed a longstanding problem with UnicodeCol - at last you can use unicode
strings in .select() and .selectBy() queries. There are some limitations,
- though:
+ though; see the description of the UnicodeCol_.
- - only simple q-magic fields are supported; no expressions;
- - only == and <> operators are supported;
+.. _UnicodeCol: SQLObject.html#column-types
- The following code works::
-
- MyTable.select(u'value' == MyTable.q.name)
- MyTable.select(MyTable.q.name <> u'value')
- MyTable.select(OR(MyTable.q.col1 == u'value1', MyTable.q.col2 <> u'value2'))
- MyTable.selectBy(name = u'value')
- MyTable.selectBy(col1=u'value1', col2=u'value2')
-
- The following still does not work::
-
- MyTable.select((MyTable.q.name + MyTable.q.surname) == u'value')
-
* Cull patch (clear cache).
* .destroySelf() inside a transaction.
Modified: SQLObject/branches/0.7-bugfix/docs/SQLObject.txt
===================================================================
--- SQLObject/branches/0.7-bugfix/docs/SQLObject.txt 2006-09-04 15:01:13 UTC (rev 1896)
+++ SQLObject/branches/0.7-bugfix/docs/SQLObject.txt 2006-09-04 15:01:36 UTC (rev 1897)
@@ -1139,6 +1139,7 @@
MyTable.select(OR(MyTable.q.col1 == u'value1', MyTable.q.col2 <> u'value2'))
MyTable.selectBy(name = u'value')
MyTable.selectBy(col1=u'value1', col2=u'value2')
+ MyTable.byCol1(u'value1') # if col1 is an alternateID
The following does not work::
Modified: SQLObject/branches/0.7-bugfix/sqlobject/main.py
===================================================================
--- SQLObject/branches/0.7-bugfix/sqlobject/main.py 2006-09-04 15:01:13 UTC (rev 1896)
+++ SQLObject/branches/0.7-bugfix/sqlobject/main.py 2006-09-04 15:01:36 UTC (rev 1897)
@@ -1255,10 +1255,14 @@
return getID(obj)
def _findAlternateID(cls, name, dbName, value, connection=None):
+ for key, column in cls.sqlmeta.columns.items():
+ if (key == name) and isinstance(column, col.SOUnicodeCol):
+ if isinstance(value, unicode):
+ value = value.encode(column.dbEncoding)
return (connection or cls._connection)._SO_selectOneAlt(
cls,
[cls.sqlmeta.idName] +
- [col.dbName for col in cls.sqlmeta.columnList],
+ [column.dbName for column in cls.sqlmeta.columnList],
dbName,
value), None
_findAlternateID = classmethod(_findAlternateID)
Modified: SQLObject/branches/0.7-bugfix/sqlobject/tests/test_unicode.py
===================================================================
--- SQLObject/branches/0.7-bugfix/sqlobject/tests/test_unicode.py 2006-09-04 15:01:13 UTC (rev 1896)
+++ SQLObject/branches/0.7-bugfix/sqlobject/tests/test_unicode.py 2006-09-04 15:01:36 UTC (rev 1897)
@@ -7,7 +7,7 @@
class TestUnicode(SQLObject):
count = IntCol(alternateID=True)
- col1 = UnicodeCol()
+ col1 = UnicodeCol(alternateID=True)
col2 = UnicodeCol(dbEncoding='latin-1')
try:
@@ -44,7 +44,7 @@
def test_select():
setup()
- for value in data:
+ for i, value in enumerate(data):
rows = list(TestUnicode.select(TestUnicode.q.col1 == value))
assert len(rows) == 1
rows = list(TestUnicode.select(TestUnicode.q.col2 == value))
@@ -60,6 +60,8 @@
assert len(rows) == 1
rows = list(TestUnicode.selectBy(col1=value, col2=value))
assert len(rows) == 1
+ row = TestUnicode.byCol1(value)
+ assert row.count == i
rows = list(TestUnicode.select(OR(
TestUnicode.q.col1 == u'\u00f0',
TestUnicode.q.col2 == u'test'
|
|
From: <sub...@co...> - 2006-09-04 15:01:22
|
Author: phd
Date: 2006-09-04 09:01:13 -0600 (Mon, 04 Sep 2006)
New Revision: 1896
Modified:
SQLObject/trunk/sqlobject/main.py
SQLObject/trunk/sqlobject/tests/test_unicode.py
Log:
Extended unicode patch to the .byName() case where "name" is an alternateID.
Modified: SQLObject/trunk/sqlobject/main.py
===================================================================
--- SQLObject/trunk/sqlobject/main.py 2006-09-01 13:14:02 UTC (rev 1895)
+++ SQLObject/trunk/sqlobject/main.py 2006-09-04 15:01:13 UTC (rev 1896)
@@ -1279,10 +1279,14 @@
return getID(obj)
def _findAlternateID(cls, name, dbName, value, connection=None):
+ for key, column in cls.sqlmeta.columns.items():
+ if (key == name) and isinstance(column, col.SOUnicodeCol):
+ if isinstance(value, unicode):
+ value = value.encode(column.dbEncoding)
return (connection or cls._connection)._SO_selectOneAlt(
cls,
[cls.sqlmeta.idName] +
- [col.dbName for col in cls.sqlmeta.columnList],
+ [column.dbName for column in cls.sqlmeta.columnList],
dbName,
value), None
_findAlternateID = classmethod(_findAlternateID)
Modified: SQLObject/trunk/sqlobject/tests/test_unicode.py
===================================================================
--- SQLObject/trunk/sqlobject/tests/test_unicode.py 2006-09-01 13:14:02 UTC (rev 1895)
+++ SQLObject/trunk/sqlobject/tests/test_unicode.py 2006-09-04 15:01:13 UTC (rev 1896)
@@ -7,7 +7,7 @@
class TestUnicode(SQLObject):
count = IntCol(alternateID=True)
- col1 = UnicodeCol()
+ col1 = UnicodeCol(alternateID=True)
col2 = UnicodeCol(dbEncoding='latin-1')
try:
@@ -44,7 +44,7 @@
def test_select():
setup()
- for value in data:
+ for i, value in enumerate(data):
rows = list(TestUnicode.select(TestUnicode.q.col1 == value))
assert len(rows) == 1
rows = list(TestUnicode.select(TestUnicode.q.col2 == value))
@@ -60,6 +60,8 @@
assert len(rows) == 1
rows = list(TestUnicode.selectBy(col1=value, col2=value))
assert len(rows) == 1
+ row = TestUnicode.byCol1(value)
+ assert row.count == i
rows = list(TestUnicode.select(OR(
TestUnicode.q.col1 == u'\u00f0',
TestUnicode.q.col2 == u'test'
|
|
From: SourceForge.net <no...@so...> - 2006-09-04 14:29:55
|
Patches item #1546314, was opened at 2006-08-25 02:44 Message generated for change (Comment added) made by phd You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540674&aid=1546314&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: None Group: None Status: Open >Resolution: Invalid Priority: 5 Submitted By: Rick Copeland (rick446) Assigned to: Oleg Broytmann (phd) Summary: Fix bug 1546294 Initial Comment: Here is the patch that fixes bug 1546294. ---------------------------------------------------------------------- >Comment By: Oleg Broytmann (phd) Date: 2006-09-04 18:29 Message: Logged In: YES user_id=4799 I rewrote the test to the SQLObject test suite: from sqlobject import * from sqlobject.inheritance import * from sqlobject.tests.dbtest import * class TestCascade1(InheritableSQLObject): dummy=IntCol() class TestCascade2(TestCascade1): c=ForeignKey('TestCascade3', cascade='null') class TestCascade3(SQLObject): dummy=IntCol() def test_destroySelf(): setupClass([TestCascade1, TestCascade3, TestCascade2]) c = TestCascade3(dummy=1) b = TestCascade2(cID=c.id, dummy=1) c.destroySelf() print b and it works even without your patch. So the test is invalid. This is the debugging output: ============================= test process starts ============================= testing-mode: inprocess executable: /usr/local/bin/python (2.4.3-final-0) using py lib: /usr/local/src/Python/py-dist/py <rev unknown> testDestroyCascade.py[1] inserting into sys.path: /usr/local/src/Python/py-dist 1/QueryOne: SELECT COUNT(relname) FROM pg_class WHERE relname = 'test_cascade2' 1/QueryR : SELECT COUNT(relname) FROM pg_class WHERE relname = 'test_cascade2' 1/COMMIT : auto 1/QueryOne: SELECT COUNT(relname) FROM pg_class WHERE relname = 'test_cascade3' 1/QueryR : SELECT COUNT(relname) FROM pg_class WHERE relname = 'test_cascade3' 1/COMMIT : auto 1/QueryOne: SELECT COUNT(relname) FROM pg_class WHERE relname = 'test_cascade1' 1/QueryR : SELECT COUNT(relname) FROM pg_class WHERE relname = 'test_cascade1' 1/COMMIT : auto 1/QueryOne: SELECT COUNT(relname) FROM pg_class WHERE relname = 'test_cascade2' 1/QueryR : SELECT COUNT(relname) FROM pg_class WHERE relname = 'test_cascade2' 1/COMMIT : auto 1/QueryOne: SELECT COUNT(relname) FROM pg_class WHERE relname = 'test_cascade3' 1/QueryR : SELECT COUNT(relname) FROM pg_class WHERE relname = 'test_cascade3' 1/COMMIT : auto 1/QueryOne: SELECT COUNT(relname) FROM pg_class WHERE relname = 'test_cascade1' 1/QueryR : SELECT COUNT(relname) FROM pg_class WHERE relname = 'test_cascade1' 1/COMMIT : auto 1/QueryOne: SELECT COUNT(relname) FROM pg_class WHERE relname = 'test_cascade1' 1/QueryR : SELECT COUNT(relname) FROM pg_class WHERE relname = 'test_cascade1' 1/COMMIT : auto 1/Query : CREATE TABLE test_cascade1 ( id SERIAL PRIMARY KEY, child_name VARCHAR(255), dummy INT ) 1/QueryR : CREATE TABLE test_cascade1 ( id SERIAL PRIMARY KEY, child_name VARCHAR(255), dummy INT ) 1/COMMIT : auto 1/QueryOne: SELECT COUNT(relname) FROM pg_class WHERE relname = 'test_cascade3' 1/QueryR : SELECT COUNT(relname) FROM pg_class WHERE relname = 'test_cascade3' 1/COMMIT : auto 1/Query : CREATE TABLE test_cascade3 ( id SERIAL PRIMARY KEY, dummy INT ) 1/QueryR : CREATE TABLE test_cascade3 ( id SERIAL PRIMARY KEY, dummy INT ) 1/COMMIT : auto 1/QueryOne: SELECT COUNT(relname) FROM pg_class WHERE relname = 'test_cascade2' 1/QueryR : SELECT COUNT(relname) FROM pg_class WHERE relname = 'test_cascade2' 1/COMMIT : auto 1/Query : CREATE TABLE test_cascade2 ( id SERIAL PRIMARY KEY, child_name VARCHAR(255), c_id INT, CONSTRAINT c_id_exists FOREIGN KEY (c_id) REFERENCES test_cascade3 (id) ON DELETE SET NULL ) 1/QueryR : CREATE TABLE test_cascade2 ( id SERIAL PRIMARY KEY, child_name VARCHAR(255), c_id INT, CONSTRAINT c_id_exists FOREIGN KEY (c_id) REFERENCES test_cascade3 (id) ON DELETE SET NULL ) 1/COMMIT : auto 1/QueryIns: INSERT INTO test_cascade3 (id, dummy) VALUES (1, 1) 1/COMMIT : auto 1/QueryOne: SELECT dummy FROM test_cascade3 WHERE id = (1) 1/QueryR : SELECT dummy FROM test_cascade3 WHERE id = (1) 1/COMMIT : auto 1/QueryIns: INSERT INTO test_cascade1 (id, dummy, child_name) VALUES (1, 1, NULL) 1/COMMIT : auto 1/QueryOne: SELECT child_name, dummy FROM test_cascade1 WHERE id = (1) 1/QueryR : SELECT child_name, dummy FROM test_cascade1 WHERE id = (1) 1/COMMIT : auto 1/Query : UPDATE test_cascade1 SET child_name = ('TestCascade2') WHERE id = (1) 1/QueryR : UPDATE test_cascade1 SET child_name = ('TestCascade2') WHERE id = (1) 1/COMMIT : auto 1/QueryIns: INSERT INTO test_cascade2 (id, child_name, c_id) VALUES (1, NULL, 1) 1/COMMIT : auto 1/QueryOne: SELECT child_name, c_id FROM test_cascade2. ================== tests finished: 1 passed in 0.28 seconds =================== WHERE id = (1) 1/QueryR : SELECT child_name, c_id FROM test_cascade2 WHERE id = (1) 1/COMMIT : auto 1/Select : SELECT test_cascade2.id, test_cascade2.child_name, test_cascade2.c_id FROM test_cascade2 WHERE c_id = (1) 1/QueryR : SELECT test_cascade2.id, test_cascade2.child_name, test_cascade2.c_id FROM test_cascade2 WHERE c_id = (1) 1/COMMIT : auto 1/Query : UPDATE test_cascade2 SET c_id = (NULL) WHERE id = (1) 1/QueryR : UPDATE test_cascade2 SET c_id = (NULL) WHERE id = (1) 1/COMMIT : auto 1/Query : DELETE FROM test_cascade3 WHERE id = (1) 1/QueryR : DELETE FROM test_cascade3 WHERE id = (1) 1/COMMIT : auto <TestCascade2 1L cID=None dummy=1> ---------------------------------------------------------------------- Comment By: Rick Copeland (rick446) Date: 2006-09-02 01:02 Message: Logged In: YES user_id=1583356 OK, here's a test that fails with the exception psycopg2.ProgrammingError: invalid input syntax for type boolean: "c_id = (1)" It appears to work OK on sqlite (my other test platform) ---------------------------------------------------------------------- Comment By: Oleg Broytmann (phd) Date: 2006-09-01 19:26 Message: Logged In: YES user_id=4799 Please add a test or at least short test script that fails without the patch. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540674&aid=1546314&group_id=74338 |
|
From: SourceForge.net <no...@so...> - 2006-09-04 10:54:35
|
Bugs item #1551880, was opened at 2006-09-04 03:54 Message generated for change (Tracker Item Submitted) made by Item Submitter You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540672&aid=1551880&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: DBM Group: SQLObject release (specify) Status: Open Resolution: None Priority: 5 Submitted By: Nobody/Anonymous (nobody) Assigned to: Nobody/Anonymous (nobody) Summary: broken uri for user with password Initial Comment: The uri-Method of DBConnection swaps @ and : for uris with user and password Example: connection_string = 'postgres://user:password@localhost/database' print connectionForURI(connection_string).uri() -> postgres://user@password:localhost/database Version: lib/python2.4/site-packages/SQLObject-0.7.1b1-py2.4.egg/sqlobject/ dbconnection.py ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540672&aid=1551880&group_id=74338 |
|
From: SourceForge.net <no...@so...> - 2006-09-01 21:02:44
|
Patches item #1546314, was opened at 2006-08-24 18:44 Message generated for change (Comment added) made by rick446 You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540674&aid=1546314&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: None Group: None Status: Open Resolution: None Priority: 5 Submitted By: Rick Copeland (rick446) Assigned to: Oleg Broytmann (phd) Summary: Fix bug 1546294 Initial Comment: Here is the patch that fixes bug 1546294. ---------------------------------------------------------------------- >Comment By: Rick Copeland (rick446) Date: 2006-09-01 17:02 Message: Logged In: YES user_id=1583356 OK, here's a test that fails with the exception psycopg2.ProgrammingError: invalid input syntax for type boolean: "c_id = (1)" It appears to work OK on sqlite (my other test platform) ---------------------------------------------------------------------- Comment By: Oleg Broytmann (phd) Date: 2006-09-01 11:26 Message: Logged In: YES user_id=4799 Please add a test or at least short test script that fails without the patch. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540674&aid=1546314&group_id=74338 |
|
From: SourceForge.net <no...@so...> - 2006-09-01 20:00:50
|
Bugs item #1547743, was opened at 2006-08-28 10:57 Message generated for change (Comment added) made by dado1945 You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540672&aid=1547743&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: Open Resolution: None Priority: 5 Submitted By: dado1945 (dado1945) Assigned to: Nobody/Anonymous (nobody) Summary: sqlobject-0.7.1dev_r1884, Mysql and unicode Initial Comment: Please, check if suplied string is not unicode already in mysqlconnection.py. There is extract how it could look like: import types ..... if self.need_unicode: # For MysqlDB 1.2.1 and later, we go # encoding->unicode->charset (in the mysql db) if type(query) != types.UnicodeType: query = unicode(query, self.encoding) return cursor.execute(query) else: return cursor.execute(query) ..... Or use "isinstance(query, unicode)". I don't know what different we will have and which one is better to use however. ---------------------------------------------------------------------- >Comment By: dado1945 (dado1945) Date: 2006-09-01 23:00 Message: Logged In: YES user_id=1533929 I think here is answer: >>> u = u'1' >>> a = '%s' % u >>> type(a) <type 'unicode'> ---------------------------------------------------------------------- Comment By: dado1945 (dado1945) Date: 2006-09-01 22:58 Message: Logged In: YES user_id=1533929 Here how it happens. I have checked all the traceback and have not found anything what would change unicode string to simple string. I happens only in select it seems. Assignment work OK as far as I remember. File "D:\daliaus\projects\tekshtpleksht\tekshtpleksht\controllers.py", line 208, in save page = model.Article.byName(pagename) File "<string>", line 1, in <lambda> File "d:\program files\python2.4\lib\site-packages\SQLObject-0.7.1dev_r1860-py2.4.egg\sqlobject\main.py", line 1266, in _SO_fetchAlternateID result, obj = cls._findAlternateID(name, dbName, value, connection) File "d:\program files\python2.4\lib\site-packages\SQLObject-0.7.1dev_r1860-py2.4.egg\sqlobject\main.py", line 1262, in _findAlternateID value), None File "d:\program files\python2.4\lib\site-packages\SQLObject-0.7.1dev_r1860-py2.4.egg\sqlobject\dbconnection.py", line 590, in _SO_selectOneAlt return self.queryOne("SELECT %s FROM %s WHERE %s = %s" % File "d:\program files\python2.4\lib\site-packages\SQLObject-0.7.1dev_r1860-py2.4.egg\sqlobject\dbconnection.py", line 760, in queryOne return self._dbConnection._queryOne(self._connection, s) File "d:\program files\python2.4\lib\site-packages\SQLObject-0.7.1dev_r1860-py2.4.egg\sqlobject\dbconnection.py", line 342, in _queryOne self._executeRetry(conn, c, s) File "D:\Program Files\Python2.4\lib\site-packages\sqlobject-0.7.1dev_r1860-py2.4.egg\sqlobject\mysql\mysqlconnection.py", line 74, in _executeRetry myquery = unicode(query, self.encoding) TypeError: decoding Unicode is not supported ---------------------------------------------------------------------- Comment By: Oleg Broytmann (phd) Date: 2006-09-01 18:28 Message: Logged In: YES user_id=4799 But how can the query be unicode in _executeRetry()? The query came from SQLObject so it must be an ascii string here... ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540672&aid=1547743&group_id=74338 |
|
From: SourceForge.net <no...@so...> - 2006-09-01 19:58:38
|
Bugs item #1547743, was opened at 2006-08-28 10:57 Message generated for change (Comment added) made by dado1945 You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540672&aid=1547743&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: Open Resolution: None Priority: 5 Submitted By: dado1945 (dado1945) Assigned to: Nobody/Anonymous (nobody) Summary: sqlobject-0.7.1dev_r1884, Mysql and unicode Initial Comment: Please, check if suplied string is not unicode already in mysqlconnection.py. There is extract how it could look like: import types ..... if self.need_unicode: # For MysqlDB 1.2.1 and later, we go # encoding->unicode->charset (in the mysql db) if type(query) != types.UnicodeType: query = unicode(query, self.encoding) return cursor.execute(query) else: return cursor.execute(query) ..... Or use "isinstance(query, unicode)". I don't know what different we will have and which one is better to use however. ---------------------------------------------------------------------- >Comment By: dado1945 (dado1945) Date: 2006-09-01 22:58 Message: Logged In: YES user_id=1533929 Here how it happens. I have checked all the traceback and have not found anything what would change unicode string to simple string. I happens only in select it seems. Assignment work OK as far as I remember. File "D:\daliaus\projects\tekshtpleksht\tekshtpleksht\controllers.py", line 208, in save page = model.Article.byName(pagename) File "<string>", line 1, in <lambda> File "d:\program files\python2.4\lib\site-packages\SQLObject-0.7.1dev_r1860-py2.4.egg\sqlobject\main.py", line 1266, in _SO_fetchAlternateID result, obj = cls._findAlternateID(name, dbName, value, connection) File "d:\program files\python2.4\lib\site-packages\SQLObject-0.7.1dev_r1860-py2.4.egg\sqlobject\main.py", line 1262, in _findAlternateID value), None File "d:\program files\python2.4\lib\site-packages\SQLObject-0.7.1dev_r1860-py2.4.egg\sqlobject\dbconnection.py", line 590, in _SO_selectOneAlt return self.queryOne("SELECT %s FROM %s WHERE %s = %s" % File "d:\program files\python2.4\lib\site-packages\SQLObject-0.7.1dev_r1860-py2.4.egg\sqlobject\dbconnection.py", line 760, in queryOne return self._dbConnection._queryOne(self._connection, s) File "d:\program files\python2.4\lib\site-packages\SQLObject-0.7.1dev_r1860-py2.4.egg\sqlobject\dbconnection.py", line 342, in _queryOne self._executeRetry(conn, c, s) File "D:\Program Files\Python2.4\lib\site-packages\sqlobject-0.7.1dev_r1860-py2.4.egg\sqlobject\mysql\mysqlconnection.py", line 74, in _executeRetry myquery = unicode(query, self.encoding) TypeError: decoding Unicode is not supported ---------------------------------------------------------------------- Comment By: Oleg Broytmann (phd) Date: 2006-09-01 18:28 Message: Logged In: YES user_id=4799 But how can the query be unicode in _executeRetry()? The query came from SQLObject so it must be an ascii string here... ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540672&aid=1547743&group_id=74338 |
|
From: SourceForge.net <no...@so...> - 2006-09-01 15:39:05
|
Patches item #1539325, was opened at 2006-08-13 01:42 Message generated for change (Comment added) made by phd You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540674&aid=1539325&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: None Group: None Status: Open Resolution: None Priority: 5 Submitted By: Arlo Belshee (abelcodemonk) Assigned to: Oleg Broytmann (phd) Summary: fromDatabase and delColumn for sqlite Initial Comment: This patch implements both fromDatabase and delColumn for sqlite. I added sqlite to the appropriate existing tests; it passes them. fromDatabase is done by parsing the table creation sql from the sqlite_master table. This will work with any sqlite 3, and I think dates back into sqlite 2, but I'm not sure. delColumn is implemented by renaming the table, creating a new table without the one column, then copying all the data over. This is obviously not as efficient as on DBs that support drop column directly, but it works. This implementation of dropColumn does deal correctly with triggers, foreign keys, and indices that reference the table whose column is being dropped. It does not deal correctly with triggers & indices attached directly to the table being altered. Attached items will be lost. Extending the implementation to support re-creating those indices & triggers should be straightforward, but is beyond my needs. You are welcome to do so. Finally, this patch slightly improves the implementation of addColumn for sqlite. It performs a vacuum operation after each column add. See the sqlite documentation for why this is a good idea. ---------------------------------------------------------------------- >Comment By: Oleg Broytmann (phd) Date: 2006-09-01 19:39 Message: Logged In: YES user_id=4799 The second patch is invalid because patch program doesn't understand svn ignore lists. This must be done manually if at all. I just run a script find . -name '*.py[co]' | xargs rm before commit. And what are the problems with SQLIte and transactions? All tests are now passed. Can you write a test script that demonstrates the problem(s)? ---------------------------------------------------------------------- Comment By: Arlo Belshee (abelcodemonk) Date: 2006-08-27 20:20 Message: Logged In: YES user_id=1027257 I've slightly update my previous patch. Feel free to use whichever version you'd like - I just want to get these new functions into the main code line as quickly as possible. I need them in order to support migrations in TurboGears. This update does two things: 1. svn:ignore *.pyc in a bunch of directories. 2. Add sqlite to the -transactions list in the supportsMatrix. Why: 1: I find it easier to see what needs to get added to svn if I don't have clutter on the various "modified files" lists. Thus, I make sure to always tell svn how to handle each file: ignore it or commit it. I find it reduces the chances of bad checkins. 2: sqlite fails several tests that require transactions. It really doesn't handle them well. This may be dues to my adding vacuuming to addColumn, or it may be new failures because I added sqlite to the list of DBs that support fromDatabase() and delColumn. In any case, I found this to be the fastest reasonable way to express what SQLite can do. Feel free to modify if you want to go another way. ---------------------------------------------------------------------- Comment By: Arlo Belshee (abelcodemonk) Date: 2006-08-27 20:09 Message: Logged In: YES user_id=1027257 Why vacuum after addColumn: According to SQLite's docs, alter table add column doesn't add the column to the table's main location in the file, but rather creates it at the end of the file and the DB then takes care of pretending that the column adjoins all the other columns. Unfortunately, older versions of SQLite don't do this pretending, so can't read a table that has had a column added. Vacuum re-creates the table as a single table, meaning that all versions can then read it. Delete column, being not supported directly by SQLite, doesn't do anything funny. Since my implementation is just to create a new table without the column being dropped, all the tables remain together without any weird extra space, and a vacuum is not needed. Why I added semicolons: No, they are not needed, if you are using pysqlite. However, they are required in the interactive SQLite interpreter. I added the semicolons so that I could quickly paste generated SQL statements into the interactive console while I was trying to get things working. Since the semicolons have no effect with pysqlite, I just left them in for the next time I wan't to do this. Feel free to take them out if you'd like. On the name of delColumn(): Feel free to name it delColumn. I gave the longer and clear name to the low-level implementation primarily to highlight the performance implications involved. The public-facing objects still expose delColumn; that is translated to a call to recreateTableWithoutColumn() if the sqliteconnection is being used. So, external programs use it as deleteColumn(), but my patch is easier to understand and the performance implications are clearer. Mostly, I was hoping that that would speed patch approval. ;) Feel free to name the function as you will. On transactions: Yeah, you can't vacuum in transactions. However, sqlite's support for transactions is already fairly problematic. I find I can't use transactions with SQLite on any real problems anyway, so I don't worry about it. When I need transactions, then I generally need a more full-featured DBMS than SQLite. If you have a different opinion on this, you could remove the call to vacuum in addColumn(). You are trading off read speed & the ability for older versions of sqlite to read such a modified table. Yer call. ---------------------------------------------------------------------- Comment By: Oleg Broytmann (phd) Date: 2006-08-15 17:08 Message: Logged In: YES user_id=4799 Thank you very much! recreateTableWithoutColumn() is an excellent solution! I have some questions about the patch. Why have you added semicolons? I think they are not needed. Why VACUUM after addColumn()? It is more logical to do VACUUM after delColumn(), I suppose. And, BTW, "This command will fail if there is an active transaction." (from the SQLite documentation). Your patch deletes .delColumn(). But I have a number of programs that relies on a presence of the method (even if it's empty). I think you could just call recreateTableWithoutColumn() from delColumn() or raise a warning or an exception. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540674&aid=1539325&group_id=74338 |
|
From: SourceForge.net <no...@so...> - 2006-09-01 15:28:59
|
Bugs item #1547743, was opened at 2006-08-28 11:57 Message generated for change (Comment added) made by phd You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540672&aid=1547743&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: Open Resolution: None Priority: 5 Submitted By: dado1945 (dado1945) Assigned to: Nobody/Anonymous (nobody) Summary: sqlobject-0.7.1dev_r1884, Mysql and unicode Initial Comment: Please, check if suplied string is not unicode already in mysqlconnection.py. There is extract how it could look like: import types ..... if self.need_unicode: # For MysqlDB 1.2.1 and later, we go # encoding->unicode->charset (in the mysql db) if type(query) != types.UnicodeType: query = unicode(query, self.encoding) return cursor.execute(query) else: return cursor.execute(query) ..... Or use "isinstance(query, unicode)". I don't know what different we will have and which one is better to use however. ---------------------------------------------------------------------- >Comment By: Oleg Broytmann (phd) Date: 2006-09-01 19:28 Message: Logged In: YES user_id=4799 But how can the query be unicode in _executeRetry()? The query came from SQLObject so it must be an ascii string here... ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540672&aid=1547743&group_id=74338 |
|
From: SourceForge.net <no...@so...> - 2006-09-01 15:26:21
|
Patches item #1546314, was opened at 2006-08-25 02:44 Message generated for change (Comment added) made by phd You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540674&aid=1546314&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: None Group: None Status: Open Resolution: None Priority: 5 Submitted By: Rick Copeland (rick446) >Assigned to: Oleg Broytmann (phd) Summary: Fix bug 1546294 Initial Comment: Here is the patch that fixes bug 1546294. ---------------------------------------------------------------------- >Comment By: Oleg Broytmann (phd) Date: 2006-09-01 19:26 Message: Logged In: YES user_id=4799 Please add a test or at least short test script that fails without the patch. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540674&aid=1546314&group_id=74338 |