Changeset 5267
- Timestamp:
- Mar 12, 2010, 8:59:58 AM (12 years ago)
- Location:
- branches/2.15-stable
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.15-stable/src/core/common-queries.xml
r5185 r5267 3643 3643 </description> 3644 3644 </query> 3645 <query id="FIX_NULL_IN_CONTEXTS_SORT_PROPERTY" type="SQL"> 3646 <sql> 3647 update [Contexts] 3648 set [sort_property] = null 3649 where [sort_property] like '%null%' 3650 </sql> 3651 <description> 3652 An SQL query that replaces all 'null' strings in Context.sort_property with 3653 null values. 3654 </description> 3655 </query> 3645 3656 3646 3657 </predefined-queries> -
branches/2.15-stable/src/core/net/sf/basedb/core/Install.java
r5265 r5267 114 114 method. 115 115 */ 116 public static final int NEW_SCHEMA_VERSION = Integer.valueOf(7 8).intValue();116 public static final int NEW_SCHEMA_VERSION = Integer.valueOf(79).intValue(); 117 117 118 118 public static synchronized void createTables(boolean update, final ProgressReporter progress) -
branches/2.15-stable/src/core/net/sf/basedb/core/Update.java
r5248 r5267 865 865 </td> 866 866 </tr> 867 <tr> 868 <td>79</td> 869 <td> 870 Set database column Contexts.sort_property to null if it contains a literal 871 'null' string. Fix for #1463. 872 </td> 873 </tr> 867 874 </table> 868 875 … … 1173 1180 if (progress != null) progress.display((int)(77*progress_factor), "--Updating schema version: " + schemaVersion + " -> 78..."); 1174 1181 schemaVersion = setSchemaVersionInTransaction(session, 78); 1182 } 1183 1184 if (schemaVersion < 79) 1185 { 1186 if (progress != null) progress.display((int)(78*progress_factor), 1187 "--Updating schema version: " + schemaVersion + " -> 79..."); 1188 schemaVersion = updateToSchemaVersion79(session); 1175 1189 } 1176 1190 … … 2720 2734 if (tx != null) HibernateUtil.rollback(tx); 2721 2735 log.error("updateToSchemaVersion77: FAILED", ex); 2736 throw ex; 2737 } 2738 return schemaVersion; 2739 } 2740 2741 2742 /** 2743 Set sort_property in Contexts table to null if it contains a literal string 'null'. 2744 */ 2745 private static int updateToSchemaVersion79(org.hibernate.Session session) 2746 throws BaseException 2747 { 2748 final int schemaVersion = 79; 2749 org.hibernate.Transaction tx = null; 2750 try 2751 { 2752 tx = HibernateUtil.newTransaction(session); 2753 2754 // Change property values 2755 // Load all annotation sets with a null id 2756 org.hibernate.Query query = HibernateUtil.getPredefinedSQLQuery(session, 2757 "FIX_NULL_IN_CONTEXTS_SORT_PROPERTY"); 2758 /* 2759 update [Contexts] 2760 set [sort_property] = null 2761 where [sort_property] like '%null%' 2762 */ 2763 query.executeUpdate(); 2764 2765 // Update the schema version number 2766 setSchemaVersion(session, schemaVersion); 2767 2768 // Commit the changes 2769 HibernateUtil.commit(tx); 2770 log.info("updateToSchemaVersion79: OK"); 2771 } 2772 catch (BaseException ex) 2773 { 2774 if (tx != null) HibernateUtil.rollback(tx); 2775 log.error("updateToSchemaVersion79: FAILED", ex); 2722 2776 throw ex; 2723 2777 } -
branches/2.15-stable/www/include/menu.jsp
r5256 r5267 85 85 { 86 86 // Projects menu 87 final ItemContext projectCC = sc.getCurrentContext(Item.PROJECT);88 87 int activeProjectId = sc.getActiveProjectId(); 89 final ItemQuery<Project> projectQuery = Project.getQuery(); 90 projectQuery.include(Include.MINE, Include.SHARED); 91 Order projectSortOrder = projectCC.getSortOrder(); 92 if (projectSortOrder != null) projectQuery.order(projectSortOrder); 93 projectQuery.order(Orders.asc(Hql.property("name"))); 94 projectQuery.setCacheResult(true); 95 final DbControl dc = sc.newDbControl(); 96 try 97 { 98 %> 99 <m:menu 100 id="projects" 101 style="display: none" 102 > 103 <m:menuitem 104 title="<i>- no active project -</i>" 105 onclick="<%="Main.openPopup('"+root+"my_base/projects/set_active.jsp?ID="+ID+"', 'ActivateProject', 300, 140)"%>" 106 icon="<%=activeProjectId == 0 ? "checkedmenu.gif" : null%>" 107 enabled="<%=activeProjectId != 0%>" 108 tooltip="<%=activeProjectId == 0 ? "No project is active" : "Disable the currently active project"%>" 109 /> 110 <% 88 %> 89 <m:menu 90 id="projects" 91 style="display: none" 92 > 93 <m:menuitem 94 title="<i>- no active project -</i>" 95 onclick="<%="Main.openPopup('"+root+"my_base/projects/set_active.jsp?ID="+ID+"', 'ActivateProject', 300, 140)"%>" 96 icon="<%=activeProjectId == 0 ? "checkedmenu.gif" : null%>" 97 enabled="<%=activeProjectId != 0%>" 98 tooltip="<%=activeProjectId == 0 ? "No project is active" : "Disable the currently active project"%>" 99 /> 100 <% 101 final DbControl dc = sc.newDbControl(); 102 try 103 { 104 final ItemContext projectCC = sc.getCurrentContext(Item.PROJECT); 105 final ItemQuery<Project> projectQuery = Project.getQuery(); 106 projectQuery.include(Include.MINE, Include.SHARED); 107 Order projectSortOrder = projectCC.getSortOrder(); 108 if (projectSortOrder != null) projectQuery.order(projectSortOrder); 109 projectQuery.order(Orders.asc(Hql.property("name"))); 110 projectQuery.setCacheResult(true); 111 111 ItemResultList<Project> projects = projectQuery.list(dc); 112 112 boolean breakAt20 = projects.size() > 25; … … 141 141 <% 142 142 } 143 } 144 catch (Throwable t) 145 { 146 t.printStackTrace(); 143 147 %> 144 </m:menu> 145 <% 146 } 147 finally 148 { 149 if (dc != null) dc.close(); 150 } 148 <m:menuitem 149 title="Error loading projects" 150 tooltip="<%=t.getMessage() + ": Check log file for more details"%>" 151 enabled="false" 152 icon="error.gif" 153 /> 154 <% 155 } 156 finally 157 { 158 if (dc != null) dc.close(); 159 } 160 %> 161 </m:menu> 162 <% 151 163 } 152 164 else if ("recentItems".equals(name) && sc != null && sc.isLoggedIn())
Note: See TracChangeset
for help on using the changeset viewer.