Changeset 3597
- Timestamp:
- Jul 25, 2007, 7:55:39 AM (16 years ago)
- Location:
- trunk/src/core
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/core/common-queries.xml
r3557 r3597 2688 2688 </query> 2689 2689 2690 <query id="UPDATE_PROPERTY_FILTER" type="SQL"> 2691 <sql> 2692 UPDATE [PropertyFilters] 2693 SET [property] = :newProperty 2694 WHERE [property] = :oldProperty 2695 </sql> 2696 <description> 2697 An SQL query that changes the property for all PropertyFilters 2698 with a given value. 2699 </description> 2700 </query> 2690 2701 2691 2702 -
trunk/src/core/net/sf/basedb/core/HibernateUtil.java
r3593 r3597 1350 1350 assert session != null : "session == null"; 1351 1351 assert sql != null : "sql == null"; 1352 sql = sql.replace('[', getDialect().openQuote()).replace(']', getDialect().closeQuote()); 1352 1353 try 1353 1354 { … … 1368 1369 assert session != null : "session == null"; 1369 1370 assert sql != null : "sql == null"; 1371 sql = sql.replace('[', getDialect().openQuote()).replace(']', getDialect().closeQuote()); 1370 1372 try 1371 1373 { -
trunk/src/core/net/sf/basedb/core/Install.java
r3596 r3597 101 101 method. 102 102 */ 103 public static final int NEW_SCHEMA_VERSION = Integer.valueOf( 39).intValue();103 public static final int NEW_SCHEMA_VERSION = Integer.valueOf(40).intValue(); 104 104 105 105 public static synchronized void createTables(boolean update, final ProgressReporter progress) -
trunk/src/core/net/sf/basedb/core/Update.java
r3594 r3597 463 463 Remove AnyToAny links created by older versions of the 464 464 Base1PluginExecuter plug-in. 465 </td> 466 </tr> 467 468 <tr> 469 <td>40</td> 470 <td> 471 Change invalid property filter on 'guiContexts.itemType' to 472 '$ctx.itemType'. 465 473 </td> 466 474 </tr> … … 662 670 } 663 671 672 if (schemaVersion < 40) 673 { 674 if (progress != null) progress.display((int)(39*progress_factor), "--Updating schema version: " + schemaVersion + " -> 40..."); 675 schemaVersion = updateToSchemaVersion40(session); 676 } 677 664 678 /* 665 if (schemaVersion < 39)666 { 667 if (progress != null) progress.display((int)( 39*progress_factor), "--Updating schema version: " + schemaVersion + " -> 40...");668 schemaVersion = setSchemaVersionInTransaction(session, 4 0);679 if (schemaVersion < 41) 680 { 681 if (progress != null) progress.display((int)(40*progress_factor), "--Updating schema version: " + schemaVersion + " -> 41..."); 682 schemaVersion = setSchemaVersionInTransaction(session, 41); 669 683 - or - 670 schemaVersion = updateToSchemaVersion4 0(session);684 schemaVersion = updateToSchemaVersion41(session); 671 685 } 672 686 ... etc... … … 1532 1546 if (tx != null) HibernateUtil.rollback(tx); 1533 1547 log.error("updateToSchemaVersion39: FAILED", ex); 1548 throw ex; 1549 } 1550 return schemaVersion; 1551 } 1552 1553 /** 1554 Update property filter on 'guiContexts.itemType' to '$ctx.itemType' 1555 @return The new schema version (=40) 1556 */ 1557 private static int updateToSchemaVersion40(org.hibernate.Session session) 1558 { 1559 final int schemaVersion = 40; 1560 org.hibernate.Transaction tx = null; 1561 try 1562 { 1563 tx = HibernateUtil.newTransaction(session); 1564 1565 // Change property values 1566 org.hibernate.Query query = HibernateUtil.getPredefinedSQLQuery(session, 1567 "UPDATE_PROPERTY_FILTER"); 1568 /* 1569 UPDATE PropertyFilters pf 1570 SET pf.property = :newProperty 1571 WHERE pf.property = :oldProperty 1572 */ 1573 query.setString("oldProperty", "guiContexts.itemType"); 1574 query.setString("newProperty", "$ctx.itemType"); 1575 HibernateUtil.executeUpdate(query); 1576 1577 // Update the schema version number 1578 setSchemaVersion(session, schemaVersion); 1579 1580 // Commit the changes 1581 HibernateUtil.commit(tx); 1582 log.info("updateToSchemaVersion40: OK"); 1583 } 1584 catch (BaseException ex) 1585 { 1586 if (tx != null) HibernateUtil.rollback(tx); 1587 log.error("updateToSchemaVersion40: FAILED", ex); 1534 1588 throw ex; 1535 1589 }
Note: See TracChangeset
for help on using the changeset viewer.