[Modeling-cvs] ProjectModeling/Modeling/tests test_EditingContext_Global.py,1.42,1.43
Status: Abandoned
Brought to you by:
sbigaret
From: <sbi...@us...> - 2003-08-22 03:26:13
|
Update of /cvsroot/modeling/ProjectModeling/Modeling/tests In directory sc8-pr-cvs1:/tmp/cvs-serv14315/Modeling/tests Modified Files: test_EditingContext_Global.py Log Message: Added Oracle to the list of supported db Index: test_EditingContext_Global.py =================================================================== RCS file: /cvsroot/modeling/ProjectModeling/Modeling/tests/test_EditingContext_Global.py,v retrieving revision 1.42 retrieving revision 1.43 diff -C2 -d -r1.42 -r1.43 *** test_EditingContext_Global.py 10 Aug 2003 14:38:15 -0000 1.42 --- test_EditingContext_Global.py 20 Aug 2003 20:39:59 -0000 1.43 *************** *** 937,941 **** "[EditingContext] IN/NOT IN operators in qualifiers" ec=EditingContext() ! objects=ec.fetch('Writer', 'age in [24, 82]') objects_names=[o.getLastName() for o in objects] self.failUnless(len(objects)==2) --- 937,941 ---- "[EditingContext] IN/NOT IN operators in qualifiers" ec=EditingContext() ! objects=ec.fetch('Writer', 'age in [24, 82, 81]') objects_names=[o.getLastName() for o in objects] self.failUnless(len(objects)==2) *************** *** 943,947 **** self.failUnless('Dard' in objects_names) ! objects=ec.fetch('Writer', 'age not in [24, 82]') objects_names=[o.getLastName() for o in objects] self.failUnless(len(objects)==1) --- 943,947 ---- self.failUnless('Dard' in objects_names) ! objects=ec.fetch('Writer', 'age not in [24, 82, 81]') objects_names=[o.getLastName() for o in objects] self.failUnless(len(objects)==1) *************** *** 1322,1326 **** channel.evaluateExpression(sqlExpr) ! def reinitDB(): """ Reinitializes the database: recreates the db's schema needed for these tests --- 1322,1326 ---- channel.evaluateExpression(sqlExpr) ! def reinitDB(database_cfg): """ Reinitializes the database: recreates the db's schema needed for these tests *************** *** 1358,1361 **** --- 1358,1367 ---- pks=[pk.values()[0] for pk in pks] sqlExpr=pgAdaptor.expressionClass()() + + if database_cfg=='Oracle.cfg': + sqlExpr.setStatement("alter session set nls_date_format = 'YYYY-MM-DD HH24:mi:ss'") + channel.evaluateExpression(sqlExpr) + + sqlExpr.setStatement("insert into WRITER "\ "(id, age, last_name,first_name,birthday,fk_writer_id)"\ *************** *** 1368,1372 **** sqlExpr.setStatement("insert into WRITER "\ "(id, age, last_name,first_name,birthday,fk_writer_id)"\ ! " values (%i,81,'Dard','Frederic','1921-06-29 04:56:34.00', %i)"%(pks[2], pks[1])) channel.evaluateExpression(sqlExpr) # Book --- 1374,1378 ---- sqlExpr.setStatement("insert into WRITER "\ "(id, age, last_name,first_name,birthday,fk_writer_id)"\ ! " values (%i,81,'Dard','Frederic','1921-06-29 04:56:34', %i)"%(pks[2], pks[1])) channel.evaluateExpression(sqlExpr) # Book *************** *** 1404,1408 **** -h Prints this message -p enables profiling ! -d sets the database adaptor to use: Postgresql (default), MySQL or SQLite -r reinitialize the (postgresql) database the database defined in the model 'model_AuthorBooks' --- 1410,1415 ---- -h Prints this message -p enables profiling ! -d sets the database adaptor to use: Postgresql (default), MySQL, Oracle ! or SQLite -r reinitialize the (postgresql) database the database defined in the model 'model_AuthorBooks' *************** *** 1435,1439 **** if k=='-p': profile=1; continue if k=='-d': ! if v not in ('Postgresql', 'MySQL', 'SQLite'): usage(me, 1) database_cfg='%s.cfg'%v continue --- 1442,1446 ---- if k=='-p': profile=1; continue if k=='-d': ! if v not in ('Postgresql', 'MySQL', 'Oracle', 'SQLite'): usage(me, 1) database_cfg='%s.cfg'%v continue *************** *** 1450,1456 **** author_books_model.entityNamed('Writer').attributeNamed('birthday').setExternalType('DATETIME') utils.enable_model_cache_and_compute() ! if reinitDB_flag: reinitDB(); return if profile: --- 1457,1467 ---- author_books_model.entityNamed('Writer').attributeNamed('birthday').setExternalType('DATETIME') + # Oracle specifics: change TIMESTAMP to DATE + if database_cfg=='Oracle.cfg': + author_books_model.entityNamed('Writer').attributeNamed('birthday').setExternalType('DATE') + utils.enable_model_cache_and_compute() ! if reinitDB_flag: reinitDB(database_cfg); return if profile: |