modeling-cvs Mailing List for Object-Relational Bridge for python (Page 9)
Status: Abandoned
Brought to you by:
sbigaret
You can subscribe to this list here.
2003 |
Jan
|
Feb
|
Mar
(54) |
Apr
(29) |
May
(94) |
Jun
(47) |
Jul
(156) |
Aug
(132) |
Sep
(40) |
Oct
(6) |
Nov
(18) |
Dec
(24) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2004 |
Jan
(18) |
Feb
(59) |
Mar
(7) |
Apr
|
May
(8) |
Jun
(2) |
Jul
(12) |
Aug
(15) |
Sep
(12) |
Oct
(6) |
Nov
(25) |
Dec
(1) |
2005 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2006 |
Jan
|
Feb
(27) |
Mar
|
Apr
(16) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2009 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <sbi...@us...> - 2004-01-20 20:26:45
|
Update of /cvsroot/modeling/ProjectModeling/Modeling/DatabaseAdaptors/MySQLAdaptorLayer In directory sc8-pr-cvs1:/tmp/cvs-serv25998/Modeling/DatabaseAdaptors/MySQLAdaptorLayer Added Files: mysql_utils.py Log Message: Forgot to add this file when the fix for bug #857803 was submitted --- NEW FILE: mysql_utils.py --- #----------------------------------------------------------------------------- # # Modeling Framework: an Object-Relational Bridge for python # (c) 2001, 2002, 2003 Sebastien Bigaret # # This file is part of the Modeling Framework. # # The Modeling Framework is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as published # by the Free Software Foundation; either version 2 of the License, or (at # your option) any later version. # # The Modeling Framework is distributed in the hope that it will be # useful, but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License along # with the Modeling Framework; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # #----------------------------------------------------------------------------- """ MySQL Adaptor Layer's utils Central point for determining MySQL specifics, like the version of the mysql server in use. CVS information $Id: mysql_utils.py,v 1.1 2004/01/20 20:26:42 sbigaret Exp $ """ __version__='$Revision: 1.1 $'[11:-2] import os import MySQLdb def mysql_server_version(): """ Returns the version of the mysql server currently in use. If the environment variable MDL_MYSQL_SERVER_VERSION is set, it returns the information it contains, otherwise it calls MySQLdb.get_client_info(). Acceptable values for ``MDL_MYSQL_SERVER_VERSION`` are e.g: 3.23, 4, 4.0.11a-gamma. Return value: A 4-values tuple: (VERSION, PATCH_LEVEL, SUBLEVEL, EXTRA_VERSION) E.g. (4,0,11,'a-gamma') Note that the env. is checked before MySQLdb.get_client_info() is called, because on some installation the latter reports a different version than the server's one (this happens e.g. when the client python adaptor is linked to an older mysql-library); in such cases, the env.variable allows the user to explicitly set the version of the mysql db-server. """ s = os.environ.get('MDL_MYSQL_SERVER_VERSION','') if not s: s=MySQLdb.get_client_info() v_list = s.split('.', 3) if len(v_list)==1: v_list+=['0', ''] if len(v_list)==2: v_list+=[''] version = int(v_list[0]) patch_level = int(v_list[1]) s = v_list[2] i=0 for i in range(len(s)): if not s[i].isdigit(): break if s[i].isdigit(): i+=1 if i == 0: sublevel = 0 else: sublevel = int(s[:i]) extra_version = s[i:] return (version, patch_level, sublevel, extra_version) |
From: <sbi...@us...> - 2004-01-20 19:47:30
|
Update of /cvsroot/modeling/ProjectModeling/Modeling/tests In directory sc8-pr-cvs1:/tmp/cvs-serv16595/tests Modified Files: MySQL.cfg Log Message: Fixed db name Index: MySQL.cfg =================================================================== RCS file: /cvsroot/modeling/ProjectModeling/Modeling/tests/MySQL.cfg,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** MySQL.cfg 3 Aug 2003 11:13:49 -0000 1.2 --- MySQL.cfg 20 Jan 2004 19:47:27 -0000 1.3 *************** *** 10,14 **** [AuthorBooks] ! database: ADDRESS_BOOK [StoreEmployees] --- 10,14 ---- [AuthorBooks] ! database: AUTHOR_BOOKS [StoreEmployees] |
From: <sbi...@us...> - 2004-01-20 19:44:03
|
Update of /cvsroot/modeling/ProjectModeling/Modeling/DatabaseAdaptors/PostgresqlAdaptorLayer In directory sc8-pr-cvs1:/tmp/cvs-serv15683/Modeling/DatabaseAdaptors/PostgresqlAdaptorLayer Modified Files: __init__.py Log Message: doc. updated Index: __init__.py =================================================================== RCS file: /cvsroot/modeling/ProjectModeling/Modeling/DatabaseAdaptors/PostgresqlAdaptorLayer/__init__.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** __init__.py 24 Aug 2003 14:15:13 -0000 1.4 --- __init__.py 20 Jan 2004 19:44:00 -0000 1.5 *************** *** 50,53 **** --- 50,55 ---- 'user', 'password' -- user credentials + 'port' -- optional; the port to which the database server listens to + Supported SQL datatypes are: |
From: <sbi...@us...> - 2004-01-20 19:43:35
|
Update of /cvsroot/modeling/ProjectModeling/Modeling/DatabaseAdaptors/MySQLAdaptorLayer In directory sc8-pr-cvs1:/tmp/cvs-serv15580/Modeling/DatabaseAdaptors/MySQLAdaptorLayer Modified Files: MySQLAdaptor.py __init__.py Log Message: MySQL: the model's connection dictionary may now give a specific port to connect to. Index: MySQLAdaptor.py =================================================================== RCS file: /cvsroot/modeling/ProjectModeling/Modeling/DatabaseAdaptors/MySQLAdaptorLayer/MySQLAdaptor.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** MySQLAdaptor.py 28 Jan 2003 18:17:14 -0000 1.2 --- MySQLAdaptor.py 20 Jan 2004 19:43:32 -0000 1.3 *************** *** 85,94 **** - 'host' -> 'host' (unchanged) """ ! return {'db': '%(database)s'%aModelConnectionDictionary, ! 'user': '%(user)s'%aModelConnectionDictionary, ! 'passwd': '%(password)s'%aModelConnectionDictionary, ! 'host': '%(host)s'%aModelConnectionDictionary} ! def dbAPI_gimmeCnxAndCursorForDBAdmin(self, administrativeConnectionDictionary): cnxDict=self.dbAPI_connectionDictionaryForConnect(administrativeConnectionDictionary) --- 85,99 ---- - 'host' -> 'host' (unchanged) + - 'port' -> 'port' (unchanged) if and only if the key exists + """ ! dbAPI_d={ 'db': '%(database)s'%aModelConnectionDictionary, ! 'user': '%(user)s'%aModelConnectionDictionary, ! 'passwd': '%(password)s'%aModelConnectionDictionary, ! 'host': '%(host)s'%aModelConnectionDictionary } ! if aModelConnectionDictionary.get('port'): ! dbAPI_d['port']=int(aModelConnectionDictionary['port']) ! return dbAPI_d ! def dbAPI_gimmeCnxAndCursorForDBAdmin(self, administrativeConnectionDictionary): cnxDict=self.dbAPI_connectionDictionaryForConnect(administrativeConnectionDictionary) Index: __init__.py =================================================================== RCS file: /cvsroot/modeling/ProjectModeling/Modeling/DatabaseAdaptors/MySQLAdaptorLayer/__init__.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** __init__.py 24 Aug 2003 14:15:13 -0000 1.4 --- __init__.py 20 Jan 2004 19:43:32 -0000 1.5 *************** *** 40,44 **** 'user', 'password' -- user credentials ! Supported SQL datatypes are: --- 40,46 ---- 'user', 'password' -- user credentials ! ! 'port' -- optional; the port to which the database server listens to ! Supported SQL datatypes are: |
From: <sbi...@us...> - 2004-01-20 19:43:35
|
Update of /cvsroot/modeling/ProjectModeling In directory sc8-pr-cvs1:/tmp/cvs-serv15580 Modified Files: CHANGES Log Message: MySQL: the model's connection dictionary may now give a specific port to connect to. Index: CHANGES =================================================================== RCS file: /cvsroot/modeling/ProjectModeling/CHANGES,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** CHANGES 20 Jan 2004 15:55:13 -0000 1.32 --- CHANGES 20 Jan 2004 19:43:32 -0000 1.33 *************** *** 8,11 **** --- 8,14 ---- -------------------------------------------------------- + * MySQL: the model's connection dictionary may now give a specific port to + connect to. + * Relationship.py: added __ne__ (for python 2.1 and 2.2), fixed FlattenedRelationship.__eq__ |
From: <sbi...@us...> - 2004-01-20 16:07:16
|
Update of /cvsroot/modeling/ProjectModeling/Modeling In directory sc8-pr-cvs1:/tmp/cvs-serv29756/Modeling Modified Files: ObjectStoreCoordinator.py Log Message: changed a msg. status dbg->warn Index: ObjectStoreCoordinator.py =================================================================== RCS file: /cvsroot/modeling/ProjectModeling/Modeling/ObjectStoreCoordinator.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** ObjectStoreCoordinator.py 18 Jul 2003 10:37:41 -0000 1.11 --- ObjectStoreCoordinator.py 20 Jan 2004 16:07:13 -0000 1.12 *************** *** 581,585 **** exc=StringIO.StringIO() traceback.print_exc(file=exc) ! debug(exc.getvalue()) del exc --- 581,585 ---- exc=StringIO.StringIO() traceback.print_exc(file=exc) ! warn(exc.getvalue()) del exc |
From: <sbi...@us...> - 2004-01-20 16:05:44
|
Update of /cvsroot/modeling/ProjectModeling/Modeling/tests In directory sc8-pr-cvs1:/tmp/cvs-serv29463/Modeling/tests Modified Files: test_EditingContext_Global.py Log Message: misc. Index: test_EditingContext_Global.py =================================================================== RCS file: /cvsroot/modeling/ProjectModeling/Modeling/tests/test_EditingContext_Global.py,v retrieving revision 1.45 retrieving revision 1.46 diff -C2 -d -r1.45 -r1.46 *** test_EditingContext_Global.py 15 Dec 2003 15:15:46 -0000 1.45 --- test_EditingContext_Global.py 20 Jan 2004 16:05:40 -0000 1.46 *************** *** 995,999 **** objects=ec2.fetch('Writer', q) objects_names=[o.getLastName() for o in objects] ! print objects_names self.failUnless(len(objects)==1) self.failUnless('Rabelais' in objects_names) --- 995,999 ---- objects=ec2.fetch('Writer', q) objects_names=[o.getLastName() for o in objects] ! #print objects_names self.failUnless(len(objects)==1) self.failUnless('Rabelais' in objects_names) |
From: <sbi...@us...> - 2004-01-20 15:55:16
|
Update of /cvsroot/modeling/ProjectModeling/Modeling In directory sc8-pr-cvs1:/tmp/cvs-serv27096/Modeling Modified Files: Relationship.py Log Message: * Relationship.py: added __ne__ (for python 2.1 and 2.2), fixed FlattenedRelationship.__eq__ * Fixed bug #862182: Validation refusing valid relations between objects (TODO: tests units for this) Index: Relationship.py =================================================================== RCS file: /cvsroot/modeling/ProjectModeling/Modeling/Relationship.py,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** Relationship.py 28 Jul 2003 07:18:59 -0000 1.15 --- Relationship.py 20 Jan 2004 15:55:13 -0000 1.16 *************** *** 239,244 **** self._entity = anEntity _setSourceEntity = setEntity #Compatibility w/ old API,_TBD should be removed ! ! # XMLCapabilityInterface def initWithXMLDOMNode(self, aNode, encoding='iso-8859-1'): --- 239,248 ---- self._entity = anEntity _setSourceEntity = setEntity #Compatibility w/ old API,_TBD should be removed ! ! # special ! def __ne__(self, aRelationship): ! # See test_Relationship.test_00_equality_n_inequality() for details ! return not self.__eq__(aRelationship) ! # XMLCapabilityInterface def initWithXMLDOMNode(self, aNode, encoding='iso-8859-1'): *************** *** 740,748 **** # values refer to the correct entity? _values2=list(_values) # _TBD do we need a copy here? (cf.'for' statement) for _value in _values: try: if _value.isFault(): continue - validNames=[self.destinationEntity().name()] - validNames+=[e.name() for e in self.destinationEntity().subEntities()] if _value.entityName() not in validNames: _error.addErrorForKey(Validation.TYPE_MISMATCH, self.name()) --- 744,752 ---- # values refer to the correct entity? _values2=list(_values) # _TBD do we need a copy here? (cf.'for' statement) + validNames=[self.destinationEntity().name()] + validNames+=self.destinationEntity().allSubEntitiesNames() for _value in _values: try: if _value.isFault(): continue if _value.entityName() not in validNames: _error.addErrorForKey(Validation.TYPE_MISMATCH, self.name()) *************** *** 763,770 **** def __eq__(self, aRelationship): "Tests whether both relationship are equal" ! if aRelationship is None or aRelationship.isFlattened(): return 0 try: # _TBD define __eq__ for Entity if self.name()!=aRelationship.name() or \ self.deleteRule()!=aRelationship.deleteRule() or \ --- 767,776 ---- def __eq__(self, aRelationship): "Tests whether both relationship are equal" ! if aRelationship is None: return 0 try: # _TBD define __eq__ for Entity + if aRelationship.isFlattened(): + return 0 if self.name()!=aRelationship.name() or \ self.deleteRule()!=aRelationship.deleteRule() or \ *************** *** 785,789 **** for aJoin in aRelationship.joins(): if aJoin not in self._joins: return 0 ! except: return 0 return 1 --- 791,795 ---- for aJoin in aRelationship.joins(): if aJoin not in self._joins: return 0 ! except: #AttributeError return 0 return 1 *************** *** 1170,1176 **** # values refer to the correct entity? _values2=list(_values) # _TBD do we need a copy here? (cf.'for' statement) for _value in _values: try: ! if _value.entityName()!=self.destinationEntity().name(): _error.addErrorForKey(Validation.TYPE_MISMATCH, self.name()) # remove this value from the list since following tests are inaccurate --- 1176,1184 ---- # values refer to the correct entity? _values2=list(_values) # _TBD do we need a copy here? (cf.'for' statement) + validNames=[self.destinationEntity().name()] + validNames+=self.destinationEntity().allSubEntitiesNames() for _value in _values: try: ! if _value.entityName() not in validNames: _error.addErrorForKey(Validation.TYPE_MISMATCH, self.name()) # remove this value from the list since following tests are inaccurate *************** *** 1201,1212 **** self.isFlattened()!=aRelationship.isFlattened() or \ self.isMandatory()!=aRelationship.isMandatory() or \ - self.isSimple()!=aRelationship.isSimple() or \ self.destinationEntity().name()!=aRelationship.destinationEntity().name() or \ self.multiplicityLowerBound()!=aRelationship.multiplicityLowerBound() or \ self.multiplicityUpperBound()!=aRelationship.multiplicityUpperBound() or \ ! self.propagatesPrimaryKey()!=aRelationship.propagatesPrimaryKey() or \ ! self.ownsDestination()!=aRelationship.ownsDestination(): return 0 ! except: return 0 return 1 --- 1209,1218 ---- self.isFlattened()!=aRelationship.isFlattened() or \ self.isMandatory()!=aRelationship.isMandatory() or \ self.destinationEntity().name()!=aRelationship.destinationEntity().name() or \ self.multiplicityLowerBound()!=aRelationship.multiplicityLowerBound() or \ self.multiplicityUpperBound()!=aRelationship.multiplicityUpperBound() or \ ! self.propagatesPrimaryKey()!=aRelationship.propagatesPrimaryKey(): return 0 ! except AttributeError: return 0 return 1 |
From: <sbi...@us...> - 2004-01-20 15:55:16
|
Update of /cvsroot/modeling/ProjectModeling/Modeling/tests In directory sc8-pr-cvs1:/tmp/cvs-serv27096/Modeling/tests Modified Files: test_Relationship.py Log Message: * Relationship.py: added __ne__ (for python 2.1 and 2.2), fixed FlattenedRelationship.__eq__ * Fixed bug #862182: Validation refusing valid relations between objects (TODO: tests units for this) Index: test_Relationship.py =================================================================== RCS file: /cvsroot/modeling/ProjectModeling/Modeling/tests/test_Relationship.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** test_Relationship.py 25 Jul 2003 15:39:04 -0000 1.5 --- test_Relationship.py 20 Jan 2004 15:55:13 -0000 1.6 *************** *** 49,52 **** --- 49,72 ---- "Tests the relationships" + def test_00_equality_n_inequality(self): + "[Relationship] __eq__ and __ne__" + # we make sure that '==' and '!=' operators behaves as expected + # There was a bug in FlattenedRelationship.__eq__: it was always returning + # 0 whatever the argument was. This was not detected by python v2.1 and + # v2.2 both of which were defaulting to identity comparison for '!=' + # when __ne__ was undefined (despite the fact that __eq__ was defined). + # python2.3 operator '!=' takes '__eq__' into account and that revealed + # both the bug and the fact that py2.1 and 2.2 + rel_ab=model.entityNamed('A').relationshipNamed('toB') + rel_ac=model.entityNamed('A').relationshipNamed('toCs') + import copy + rel_abb=copy.copy(rel_ab) # same, different id() + self.failUnless(rel_ab==rel_ab, "rel==rel fails") + self.failUnless(rel_ab==rel_abb, "rel==copy(rel) fails") + self.failUnless(not rel_ab!=rel_ab, "rel!=rel fails") + self.failUnless(not rel_ab!=rel_abb, "rel!=copy(rel) fails") + self.failUnless(rel_ab!=rel_ac, "not rel1!=rel2 when rel1!=rel2 !!!") + self.failUnless(not rel_ab==rel_ac, "rel1==rel2 when rel1!=rel2 !!!") + def test_01_flattenedRelationship(self): "[Relationship] flattened" |
From: <sbi...@us...> - 2004-01-20 15:55:16
|
Update of /cvsroot/modeling/ProjectModeling In directory sc8-pr-cvs1:/tmp/cvs-serv27096 Modified Files: CHANGES Log Message: * Relationship.py: added __ne__ (for python 2.1 and 2.2), fixed FlattenedRelationship.__eq__ * Fixed bug #862182: Validation refusing valid relations between objects (TODO: tests units for this) Index: CHANGES =================================================================== RCS file: /cvsroot/modeling/ProjectModeling/CHANGES,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** CHANGES 18 Dec 2003 15:35:11 -0000 1.31 --- CHANGES 20 Jan 2004 15:55:13 -0000 1.32 *************** *** 8,11 **** --- 8,17 ---- -------------------------------------------------------- + * Relationship.py: added __ne__ (for python 2.1 and 2.2), fixed + FlattenedRelationship.__eq__ + + * Fixed bug #862182: Validation refusing valid relations between objects + (TODO: tests units for this) + * Fixed bug #861048: Invalid FK constraints in generated DB schema |
From: <sbi...@us...> - 2003-12-20 15:38:03
|
Update of /cvsroot/modeling/ProjectModeling/Modeling/doc/www In directory sc8-pr-cvs1:/tmp/cvs-serv4839/Modeling/doc/www Modified Files: bug861048.txt Log Message: doc. updated Index: bug861048.txt =================================================================== RCS file: /cvsroot/modeling/ProjectModeling/Modeling/doc/www/bug861048.txt,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** bug861048.txt 20 Dec 2003 15:21:02 -0000 1.2 --- bug861048.txt 20 Dec 2003 15:38:00 -0000 1.3 *************** *** 106,145 **** See, for example, what happens when we try it with two ! test-models, *AuthorBooks* and *StoreEmployees*:: ! :*AuthorBooks* is not affected: ! > cd Modeling ! > python2.2 ./scripts/bug861048.py tests/testPackages/AuthorBooks/model_AuthorBooks.xml ! The model AuthorBooks is not affected by bug #861048 ! > python2.2 ./scripts/bug861048.py tests/testPackages/StoreEmployees/pymodel_StoreEmployees.py ! The model StoreEmployees is affected by bug #861048 ! ! - PostgreSQL, MySQL, Oracle: ! connect to your db and correct the schema with the following statements: ! ! ---- cut here ---- ! ALTER TABLE ADDRESS DROP CONSTRAINT toEmployee; ! ---- cut here ---- ! ! - SQLite; sorry, but SQLite does not support ALTER TABLE, so you have no ! other choice but to: ! ! 1. backup the file containing your database, ! ! 2. dump your database: ! $ sqlite your_database .dump > dump.db.sqlite ! ! 3. edit the file dump.db.sqlite and: ! - in CREATE TABLE ADDRESS (...), remove the statement: ! CONSTRAINT toEmployee FOREIGN KEY (FK_EMPLOYEE_ID) REFERENCES EMPLOYEE(ID) ! ! (you may have to remove a trailing comma from the previous statement if ! the CONSTRAINT line was the last one before the closing bracket in ! CREATE TABLE) ! ! 4. recreate your database: ! $ mv your_database your_database.backup ! $ sqlite your_database ".read dump.db.sqlite" --- 106,149 ---- See, for example, what happens when we try it with two ! test-models, *AuthorBooks* and *StoreEmployees*: ! - *AuthorBooks* is not affected:: ! > cd Modeling ! > python2.2 ./scripts/bug861048.py tests/testPackages/AuthorBooks/model_AuthorBooks.xml ! The model AuthorBooks is not affected by bug #861048 ! ! ! - *StoreEmployees* is affected by the bug:: ! ! > python2.2 ./scripts/bug861048.py tests/testPackages/StoreEmployees/pymodel_StoreEmployees.py ! The model StoreEmployees is affected by bug #861048 ! ! - PostgreSQL, MySQL, Oracle: ! connect to your db and correct the schema with the following statements: ! ! ---- cut here ---- ! ALTER TABLE ADDRESS DROP CONSTRAINT toEmployee; ! ---- cut here ---- ! ! - SQLite; sorry, but SQLite does not support ALTER TABLE, so you have no ! other choice but to: ! ! 1. backup the file containing your database, ! ! 2. dump your database: ! $ sqlite your_database .dump > dump.db.sqlite ! ! 3. edit the file dump.db.sqlite and: ! - in CREATE TABLE ADDRESS (...), remove the statement: ! CONSTRAINT toEmployee FOREIGN KEY (FK_EMPLOYEE_ID) REFERENCES EMPLOYEE(ID) ! ! (you may have to remove a trailing comma from the previous statement ! if the CONSTRAINT line was the last one before the closing bracket ! in CREATE TABLE) ! ! 4. recreate your database: ! $ mv your_database your_database.backup ! $ sqlite your_database ".read dump.db.sqlite" |
From: <sbi...@us...> - 2003-12-20 15:21:05
|
Update of /cvsroot/modeling/ProjectModeling/Modeling/doc/www In directory sc8-pr-cvs1:/tmp/cvs-serv2238/Modeling/doc/www Modified Files: bug861048.txt Log Message: Added instructions for bug#861048 Index: bug861048.txt =================================================================== RCS file: /cvsroot/modeling/ProjectModeling/Modeling/doc/www/bug861048.txt,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** bug861048.txt 20 Dec 2003 14:37:13 -0000 1.1 --- bug861048.txt 20 Dec 2003 15:21:02 -0000 1.2 *************** *** 59,73 **** ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ! Now if you use Postgresql and `psycopg`_, the problem is that this bug hits ! an other bug in psycopg v1.1.10 or earlier, where errors at commit time are ! silently ignored. As a consequence, if you save changes on an ! ``EditingContext`` which as an ``A`` in relation to a ``C``, the postgresql database server will reject the commit (because of the buggy FK ! constraint). But `psycopg`_ silently ignores the exception, as a consequence ! **the changes appears to be safe but none of the changes was committed in the ! database**. ! For this reason, it is strongly recommended to `psycopg`_ users to upgrade ! their copy to v1.1.11 or higher For more details, please refer the corresponding thread in the `psycopg --- 59,75 ---- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ! Now if you use Postgresql and `psycopg`_, the problem is that this bug ! hits an other bug in psycopg v1.1.10 or earlier, where errors at commit ! time are silently ignored. As a consequence, if you save changes on an ! *EditingContext* which as an *A* in relation to a *C*, the postgresql database server will reject the commit (because of the buggy FK ! constraint). But `psycopg`_ silently ignores the exception, as a ! consequence **the changes appears to be safe but none of the changes was ! committed in the database**. ! It is **strongly recommended** that `psycopg`_ users upgrade their copy ! with version 1.1.11 or higher; the framework uses constraints that are ! deferred, i.e. they are only checked at commit time, so it cannot rely ! on a db-adaptor that ignores error happening at commit time. For more details, please refer the corresponding thread in the `psycopg *************** *** 106,109 **** --- 108,112 ---- test-models, *AuthorBooks* and *StoreEmployees*:: + :*AuthorBooks* is not affected: > cd Modeling > python2.2 ./scripts/bug861048.py tests/testPackages/AuthorBooks/model_AuthorBooks.xml |
From: <sbi...@us...> - 2003-12-20 14:37:17
|
Update of /cvsroot/modeling/ProjectModeling/Modeling/doc/www In directory sc8-pr-cvs1:/tmp/cvs-serv28315/Modeling/doc/www Added Files: bug861048.txt Log Message: Added instructions for bug#861048 --- NEW FILE: bug861048.txt --- (This appears to be a binary file; contents omitted.) |
From: <sbi...@us...> - 2003-12-18 15:35:30
|
Update of /cvsroot/modeling/ProjectModeling/Modeling/scripts In directory sc8-pr-cvs1:/tmp/cvs-serv1701/Modeling/scripts Modified Files: bug861048.py Log Message: doc updated Index: bug861048.py =================================================================== RCS file: /cvsroot/modeling/ProjectModeling/Modeling/scripts/bug861048.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** bug861048.py 17 Dec 2003 17:00:08 -0000 1.1 --- bug861048.py 18 Dec 2003 15:35:21 -0000 1.2 *************** *** 23,27 **** #----------------------------------------------------------------------------- """ ! Diagnose bug #861048 and tells what should be done, if appropriate """ __version__='$Revision$'[11:-2] --- 23,30 ---- #----------------------------------------------------------------------------- """ ! Examine a model, check if it is affected by bug #861048, and, if appropriate, ! tell what should be done to correct the database schema. ! ! Usage: bug861048.py <model_file> """ __version__='$Revision$'[11:-2] *************** *** 99,106 **** import os, sys if len(sys.argv)!=2: ! print "Usage: %s <model_file>"%sys.argv[0] ! sys.exit() ! from Modeling import ModelSet, Model ! model=Model.loadModel(sys.argv[1]) ! bug861048(model) --- 102,109 ---- import os, sys if len(sys.argv)!=2: ! print __doc__ ! else: ! from Modeling import ModelSet, Model ! model=Model.loadModel(sys.argv[1]) ! bug861048(model) |
From: <sbi...@us...> - 2003-12-18 15:35:14
|
Update of /cvsroot/modeling/ProjectModeling In directory sc8-pr-cvs1:/tmp/cvs-serv1657 Modified Files: CHANGES Log Message: misc Index: CHANGES =================================================================== RCS file: /cvsroot/modeling/ProjectModeling/CHANGES,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** CHANGES 17 Dec 2003 17:00:08 -0000 1.30 --- CHANGES 18 Dec 2003 15:35:11 -0000 1.31 *************** *** 11,16 **** Added scripts/bug861048.py that you can run against your model to check if ! it is affected your database schema is affected by the bug. If it is, the ! script will tell you what should be done to fix the db-schema. * Fixed bug #857803: mysql: invalid generated sql for complex qualifiers --- 11,16 ---- Added scripts/bug861048.py that you can run against your model to check if ! the corresponding generated database schema was affected by the bug. If it ! is, the script will tell you what should be done to fix it. * Fixed bug #857803: mysql: invalid generated sql for complex qualifiers |
From: <sbi...@us...> - 2003-12-18 14:50:15
|
Update of /cvsroot/modeling/ProjectModeling/Modeling In directory sc8-pr-cvs1:/tmp/cvs-serv24097 Modified Files: SQLExpression.py Log Message: Misc. fix / py2.1 support (nested scope) Index: SQLExpression.py =================================================================== RCS file: /cvsroot/modeling/ProjectModeling/Modeling/SQLExpression.py,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** SQLExpression.py 15 Dec 2003 15:15:46 -0000 1.25 --- SQLExpression.py 18 Dec 2003 14:50:12 -0000 1.26 *************** *** 1242,1246 **** aList=(1,2,4), return '(1, 2, 4)' """ ! sqlString=lambda v,k=key: self.sqlStringForValue(v, k) if len(aList)==1: return '(%s)'%sqlString(aList[0]) --- 1242,1246 ---- aList=(1,2,4), return '(1, 2, 4)' """ ! sqlString=lambda v,k=key,self=self: self.sqlStringForValue(v, k) if len(aList)==1: return '(%s)'%sqlString(aList[0]) |
From: <sbi...@us...> - 2003-12-17 17:13:02
|
Update of /cvsroot/modeling/ProjectModeling/Modeling/DatabaseAdaptors/MySQLAdaptorLayer In directory sc8-pr-cvs1:/tmp/cvs-serv25388/Modeling/DatabaseAdaptors/MySQLAdaptorLayer Modified Files: MySQLSchemaGeneration.py Log Message: updated doc Index: MySQLSchemaGeneration.py =================================================================== RCS file: /cvsroot/modeling/ProjectModeling/Modeling/DatabaseAdaptors/MySQLAdaptorLayer/MySQLSchemaGeneration.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** MySQLSchemaGeneration.py 10 Jan 2003 10:45:45 -0000 1.1 --- MySQLSchemaGeneration.py 17 Dec 2003 17:12:58 -0000 1.2 *************** *** 50,55 **** class MySQLSchemaGeneration(SchemaGeneration): """ ! See Modeling.interfaces.SchemaGeneration for further details """ --- 50,58 ---- class MySQLSchemaGeneration(SchemaGeneration): """ + Implements the details db-schema generation which differ from the + standard behaviour implemented by SchemaGeneration. ! See also Modeling.SchemaGeneration and Modeling.interfaces.SchemaGeneration ! for further details """ *************** *** 113,116 **** --- 116,122 ---- def foreignKeyConstraintStatementsForRelationship(self, relationship): """ + Removes ' INITIALLY DEFERRED' from the statements returned by + SQLExpression's foreignKeyConstraintStatementsForRelationship() and + returns them. """ sqlExprs=SchemaGeneration.foreignKeyConstraintStatementsForRelationship.im_func(self, relationship) |
From: <sbi...@us...> - 2003-12-17 17:11:55
|
Update of /cvsroot/modeling/ProjectModeling/Modeling/DatabaseAdaptors/SQLiteAdaptorLayer In directory sc8-pr-cvs1:/tmp/cvs-serv24909/Modeling/DatabaseAdaptors/SQLiteAdaptorLayer Modified Files: SQLiteSchemaGeneration.py Log Message: Fixed bug #861048: forgot to include bug fix for SQLite Index: SQLiteSchemaGeneration.py =================================================================== RCS file: /cvsroot/modeling/ProjectModeling/Modeling/DatabaseAdaptors/SQLiteAdaptorLayer/SQLiteSchemaGeneration.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** SQLiteSchemaGeneration.py 24 Aug 2003 14:13:09 -0000 1.4 --- SQLiteSchemaGeneration.py 17 Dec 2003 17:11:52 -0000 1.5 *************** *** 170,174 **** - its inverseRelationship, if any, is a toMany relationship, ! - its source and destinationEntity share the same model If any of these conditions is not fulfilled the method returns an empty --- 170,176 ---- - its inverseRelationship, if any, is a toMany relationship, ! - its source and destinationEntity share the same model, ! ! - the destinationEntity has no sub-entity. If any of these conditions is not fulfilled the method returns an empty *************** *** 205,208 **** --- 207,213 ---- if srcEntity.model() != dstEntity.model(): return (sqlExpression,) + if dstEntity.subEntities(): + return (sqlExpression,) + st='\n CONSTRAINT %(relName)s FOREIGN KEY (%(FKs)s) REFERENCES %(dst_table)s(%(PKs)s)' from string import join |
From: <sbi...@us...> - 2003-12-17 17:00:12
|
Update of /cvsroot/modeling/ProjectModeling/Modeling/scripts In directory sc8-pr-cvs1:/tmp/cvs-serv22467/Modeling/scripts Added Files: bug861048.py Log Message: Added scripts/bug861048.py --- NEW FILE: bug861048.py --- #! /usr/bin/env python #----------------------------------------------------------------------------- # # Modeling Framework: an Object-Relational Bridge for python # (c) 2001, 2002, 2003 Sebastien Bigaret # # This file is part of the Modeling Framework. # # The Modeling Framework is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as published # by the Free Software Foundation; either version 2 of the License, or (at # your option) any later version. # # The Modeling Framework is distributed in the hope that it will be # useful, but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License along # with the Modeling Framework; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # #----------------------------------------------------------------------------- """ Diagnose bug #861048 and tells what should be done, if appropriate """ __version__='$Revision: 1.1 $'[11:-2] def bug861048(model): """Tells whether the supplied model is affected by bug#861048, and prints the necessary steps to corect the database, if appropriate""" dicts=[] for e in model.entities(): for relationship in e.relationships(): # the following conditions are roughly copy/pasted from SchemaGeneration if relationship.isToMany() or relationship.isFlattened(): continue # if there is an inverseRelationship, it should be a toMany relationship inverseRel = relationship.inverseRelationship() if not (inverseRel is None or inverseRel.isToMany() ): continue # Both source and destination entities should belong to the same model srcEntity=relationship.sourceEntity() dstEntity=relationship.destinationEntity() if srcEntity.model() != dstEntity.model(): continue if not dstEntity.subEntities(): continue from string import join vars={'table': srcEntity.externalName(), 'relName': relationship.name(), 'FKs': join([attr.columnName() for attr in relationship.sourceAttributes()], ','), 'dst_table': dstEntity.externalName(), 'PKs': join([attr.columnName() for attr in relationship.destinationAttributes()], ','), } dicts.append(vars) sqlite='CONSTRAINT %(relName)s FOREIGN KEY (%(FKs)s) REFERENCES %(dst_table)s(%(PKs)s)' others='ALTER TABLE %(table)s DROP CONSTRAINT %(relName)s;' if not dicts: print "The model %s is not affected by bug #861048"%model.name() else: print """The model %s is affected by bug #861048"""%model.name() print """ - PostgreSQL, MySQL, Oracle: connect to your db and correct the schema with the following statements:""" print "\n---- cut here ----" for vars in dicts: print others%vars print "---- cut here ----" print """ - SQLite; sorry, but SQLite does not support ALTER TABLE, so you have no other choice but to: 1. backup the file containing your database, 2. dump your database: $ sqlite your_database .dump > dump.db.sqlite 3. edit the file dump.db.sqlite and:""" for vars in dicts: print " - in CREATE TABLE %(table)s (...), remove the statement:"%vars print sqlite%vars print """ (you may have to remove a trailing comma from the previous statement if the CONSTRAINT line was the last one before the closing bracket in CREATE TABLE) 4. recreate your database: $ mv your_database your_database.backup $ sqlite your_database ".read dump.db.sqlite" """ return dicts if __name__=="__main__": import os, sys if len(sys.argv)!=2: print "Usage: %s <model_file>"%sys.argv[0] sys.exit() from Modeling import ModelSet, Model model=Model.loadModel(sys.argv[1]) bug861048(model) |
From: <sbi...@us...> - 2003-12-17 17:00:11
|
Update of /cvsroot/modeling/ProjectModeling In directory sc8-pr-cvs1:/tmp/cvs-serv22467 Modified Files: CHANGES Log Message: Added scripts/bug861048.py Index: CHANGES =================================================================== RCS file: /cvsroot/modeling/ProjectModeling/CHANGES,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** CHANGES 17 Dec 2003 15:15:32 -0000 1.29 --- CHANGES 17 Dec 2003 17:00:08 -0000 1.30 *************** *** 10,13 **** --- 10,17 ---- * Fixed bug #861048: Invalid FK constraints in generated DB schema + Added scripts/bug861048.py that you can run against your model to check if + it is affected your database schema is affected by the bug. If it is, the + script will tell you what should be done to fix the db-schema. + * Fixed bug #857803: mysql: invalid generated sql for complex qualifiers --some qualifiers led to invalid SQL when fetching, causing SyntaxError. |
From: <sbi...@us...> - 2003-12-17 15:15:36
|
Update of /cvsroot/modeling/ProjectModeling/Modeling/tests In directory sc8-pr-cvs1:/tmp/cvs-serv31692/Modeling/tests Modified Files: test_SchemaGeneration.py Log Message: Fixed bug #861048: Invalid FK constraints in generated DB schema Index: test_SchemaGeneration.py =================================================================== RCS file: /cvsroot/modeling/ProjectModeling/Modeling/tests/test_SchemaGeneration.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** test_SchemaGeneration.py 14 Mar 2003 11:40:13 -0000 1.4 --- test_SchemaGeneration.py 17 Dec 2003 15:15:33 -0000 1.5 *************** *** 133,137 **** 'Statement %s was not found'%statement) ! def test_04_tableEntityGroupsForEntities(self): "[SchemaGeneration] tableEntityGroupsForEntities" self.failUnless(len(self.schemaGeneration.tableEntityGroupsForEntities(model.entities()))==2) --- 133,148 ---- 'Statement %s was not found'%statement) ! def test_04b_foreignKeyConstraintStatementsForRelationship(self): ! "[SchemaGeneration] fk constraints / bug #861048" ! model.entityNamed('B').addSubEntity(model.entityNamed('A')) ! _rel=model.entityNamed('A').relationshipNamed('toB') ! generatedFKstatement=self.schemaGeneration.foreignKeyConstraintStatementsForRelationship(_rel) ! ! try: ! self.failIf(generatedFKstatement) ! finally: ! model.entityNamed('B').removeSubEntity(model.entityNamed('A')) ! ! def test_05_tableEntityGroupsForEntities(self): "[SchemaGeneration] tableEntityGroupsForEntities" self.failUnless(len(self.schemaGeneration.tableEntityGroupsForEntities(model.entities()))==2) |
From: <sbi...@us...> - 2003-12-17 15:15:36
|
Update of /cvsroot/modeling/ProjectModeling/Modeling In directory sc8-pr-cvs1:/tmp/cvs-serv31692/Modeling Modified Files: SchemaGeneration.py Log Message: Fixed bug #861048: Invalid FK constraints in generated DB schema Index: SchemaGeneration.py =================================================================== RCS file: /cvsroot/modeling/ProjectModeling/Modeling/SchemaGeneration.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** SchemaGeneration.py 14 Mar 2003 11:40:10 -0000 1.8 --- SchemaGeneration.py 17 Dec 2003 15:15:33 -0000 1.9 *************** *** 383,386 **** --- 383,388 ---- - its source and destinationEntity share the same model + - the destinationEntity has no sub-entity. + If any of these conditions is not fulfilled the method returns an empty sequence. *************** *** 410,413 **** --- 412,418 ---- dstEntity=relationship.destinationEntity() if srcEntity.model() != dstEntity.model(): + return () + + if dstEntity.subEntities(): return () |
From: <sbi...@us...> - 2003-12-17 15:15:36
|
Update of /cvsroot/modeling/ProjectModeling In directory sc8-pr-cvs1:/tmp/cvs-serv31692 Modified Files: CHANGES Log Message: Fixed bug #861048: Invalid FK constraints in generated DB schema Index: CHANGES =================================================================== RCS file: /cvsroot/modeling/ProjectModeling/CHANGES,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** CHANGES 15 Dec 2003 15:15:46 -0000 1.28 --- CHANGES 17 Dec 2003 15:15:32 -0000 1.29 *************** *** 8,12 **** --- 8,15 ---- -------------------------------------------------------- + * Fixed bug #861048: Invalid FK constraints in generated DB schema + * Fixed bug #857803: mysql: invalid generated sql for complex qualifiers + --some qualifiers led to invalid SQL when fetching, causing SyntaxError. * Fixed bug #847212: qualifier IN does not handle correctly strings (strings |
From: <sbi...@us...> - 2003-12-15 15:15:50
|
Update of /cvsroot/modeling/ProjectModeling/Modeling/tests In directory sc8-pr-cvs1:/tmp/cvs-serv13480/Modeling/tests Modified Files: test_EditingContext_Global.py Log Message: Fixed bug #847212: qualifier IN does not handle correctly strings (strings were not quoted as they should be) Index: test_EditingContext_Global.py =================================================================== RCS file: /cvsroot/modeling/ProjectModeling/Modeling/tests/test_EditingContext_Global.py,v retrieving revision 1.44 retrieving revision 1.45 diff -C2 -d -r1.44 -r1.45 *** test_EditingContext_Global.py 15 Dec 2003 15:05:00 -0000 1.44 --- test_EditingContext_Global.py 15 Dec 2003 15:15:46 -0000 1.45 *************** *** 965,968 **** --- 965,1005 ---- self.failUnless('Dard' in objects_names) + def test_19c_in_not_in_operators_in_qualifiers_with_strings(self): + "[EditingContext] IN/NOT IN operators in qualifiers with strings & date" + # Bug #847212: strings not handled properly + from Modeling.Qualifier import KeyValueQualifier, QualifierOperatorIn + ec=EditingContext() + q=KeyValueQualifier('lastName', QualifierOperatorIn, ['Dard', 'Cleese']) + objects=ec.fetch('Writer', q) + objects_names=[o.getLastName() for o in objects] + self.failUnless(len(objects)==2) + self.failUnless('Cleese' in objects_names) + self.failUnless('Dard' in objects_names) + + # While we're at it, test date + q=KeyValueQualifier('author.birthday', + QualifierOperatorIn, ['1484-07-02 18:16:12']) + objects=ec.fetch('Book', q) + objects_names=[b.getTitle() for b in objects] + self.failUnless(len(objects)==1) + self.failUnless('Gargantua' in objects_names) + # prepare last test w/ floats + g=objects[0] + g.setPrice(12.7) + ec.saveChanges() + + try: + # Test float + ec2=EditingContext() + q=KeyValueQualifier('books.price', QualifierOperatorIn, [12.7, 12.2]) + objects=ec2.fetch('Writer', q) + objects_names=[o.getLastName() for o in objects] + print objects_names + self.failUnless(len(objects)==1) + self.failUnless('Rabelais' in objects_names) + finally: + g.setPrice(None) + ec.saveChanges() + def test_20_snapshot(self): "[EditingContext] CustomObject.snapshot()" |
From: <sbi...@us...> - 2003-12-15 15:15:49
|
Update of /cvsroot/modeling/ProjectModeling/Modeling In directory sc8-pr-cvs1:/tmp/cvs-serv13480/Modeling Modified Files: SQLExpression.py Log Message: Fixed bug #847212: qualifier IN does not handle correctly strings (strings were not quoted as they should be) Index: SQLExpression.py =================================================================== RCS file: /cvsroot/modeling/ProjectModeling/Modeling/SQLExpression.py,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** SQLExpression.py 15 Dec 2003 15:05:00 -0000 1.24 --- SQLExpression.py 15 Dec 2003 15:15:46 -0000 1.25 *************** *** 1224,1228 **** keyString=self.sqlStringForAttributeNamed(key) if aQualifier.operator() in (QualifierOperatorIn, QualifierOperatorNotIn): ! valueString=self.sqlStringForInOperatorValue(value) else: valueString=self.sqlStringForValue(value, key) --- 1224,1228 ---- keyString=self.sqlStringForAttributeNamed(key) if aQualifier.operator() in (QualifierOperatorIn, QualifierOperatorNotIn): ! valueString=self.sqlStringForInOperatorValue(value, key) else: valueString=self.sqlStringForValue(value, key) *************** *** 1233,1237 **** return self.sqlStringForCaseInsensitiveLike(keyString, valueString) ! def sqlStringForInOperatorValue(self, aList): """ Returns the SQL string suitable for operator IN and NOT IN. --- 1233,1237 ---- return self.sqlStringForCaseInsensitiveLike(keyString, valueString) ! def sqlStringForInOperatorValue(self, aList, key): """ Returns the SQL string suitable for operator IN and NOT IN. *************** *** 1242,1249 **** aList=(1,2,4), return '(1, 2, 4)' """ if len(aList)==1: ! return '(%s)'%aList[0] else: ! return "(%s)" % ", ".join(map(str, aList)) def sqlStringForNegatedQualifier(self, aQualifier): --- 1242,1250 ---- aList=(1,2,4), return '(1, 2, 4)' """ + sqlString=lambda v,k=key: self.sqlStringForValue(v, k) if len(aList)==1: ! return '(%s)'%sqlString(aList[0]) else: ! return "(%s)" % ", ".join(map(sqlString, aList)) def sqlStringForNegatedQualifier(self, aQualifier): |