Changeset 6981
- Timestamp:
- Oct 8, 2015, 9:05:54 AM (7 years ago)
- Location:
- trunk
- Files:
-
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo changed
/branches/3.6-stable (added) merged: 6973-6978 /tags/3.6 (added) merged: 6979
- Property svn:mergeinfo changed
-
trunk/config/dist/mysql-queries.xml
r6330 r6981 28 28 --> 29 29 <predefined-queries> 30 <query id="DROP_NOT_NULL_CONSTRAINT" type="SQL"> 31 <sql> 32 ALTER TABLE [{1}] MODIFY [{2}] {3} NULL 33 </sql> 34 <description> 35 An SQL query that drops a NOT NULL contraint from column (2) with data type (3) 36 in a table (1). 37 </description> 38 </query> 30 39 31 40 </predefined-queries> -
trunk/credits.txt
r6818 r6981 1 1 $Id$ 2 2 3 The current BASE team is (at BASE 3. 5release)3 The current BASE team is (at BASE 3.6 release) 4 4 {{{ 5 5 Jari Häkkinen -
trunk/doc/src/docbook/user/annotations.xml
r6961 r6981 807 807 </para> 808 808 809 <para> 810 Use the <guibutton>Inherit</guibutton> button to inherit the selected 811 annotations by reference, and the <guibutton>Clone</guibutton> button 812 to clone the values of the selected annotations. 813 </para> 814 809 815 <note> 810 816 <itemizedlist> 811 817 <listitem> 812 818 <para> 813 Already inherited annotations are not shown in the dialog. 814 </para> 815 </listitem> 816 <listitem> 817 <para> 818 By default, the inheritance is implemented by reference. To convert 819 it to a cloned annotation select it in the list and click on <guilabel>clone</guilabel>. 819 Already inherited or cloned annotations are not shown in the dialog. 820 </para> 821 </listitem> 822 <listitem> 823 <para> 824 Annotations that are inherited by reference can easily be converted to 825 cloned annotations. Select the annotation in the list and click on the 826 <guilabel>clone</guilabel> link. 820 827 <nohelp> 821 828 <figure> … … 831 838 </figure> 832 839 </nohelp> 833 834 840 </para> 835 841 </listitem> -
trunk/src/core/net/sf/basedb/core/Update.java
r6941 r6981 1337 1337 1338 1338 // Drop NOT NULL on Annotations.value_id 1339 dropNotNullConstraint(session, "Annotations", "value_id" );1339 dropNotNullConstraint(session, "Annotations", "value_id", "int"); 1340 1340 1341 1341 // Drop UNIQUE constraint on Annotations.annotationset_id/annotationtype_id … … 1657 1657 TableInfo info = getTableInfo(session, tableName); 1658 1658 String indexName = info.findIndexName(null, new HashSet<String>(Arrays.asList(columnNames))); 1659 1659 1660 if (indexName != null) 1660 1661 { 1661 1662 DbEngine engine = HibernateUtil.getDbEngine(); 1663 1664 // Drop foreign keys using any of the column names in the index 1665 List<ForeignKeyInfo> dropped = new ArrayList<ForeignKeyInfo>(); 1666 if (engine.dropForeignKeysUsedInIndex()) 1667 { 1668 for (ForeignKeyInfo fk : info.getForeignKeys()) 1669 { 1670 for (String colName : columnNames) 1671 { 1672 if (fk.getFkColumns().contains(colName)) 1673 { 1674 dropped.add(fk); 1675 String fkSql = engine.getDropForeignKeySql(null, null, tableName, fk.getName()); 1676 query = HibernateUtil.createSqlQuery(session, fkSql); 1677 query.executeUpdate(); 1678 break; 1679 } 1680 } 1681 } 1682 } 1683 1662 1684 String sql = engine.getDropIndexSql(null, null, tableName, indexName, unique); 1663 1685 query = HibernateUtil.createSqlQuery(session, sql); 1664 1686 query.executeUpdate(); 1687 1688 // Re-created dropped foreign keys 1689 for (ForeignKeyInfo fk : dropped) 1690 { 1691 String fkSql = engine.getCreateForeignKeySql(null, null, tableName, fk.getName(), fk.getFkColumns(), fk.getRefName(), fk.getRefColumns()); 1692 query = HibernateUtil.createSqlQuery(session, fkSql); 1693 query.executeUpdate(); 1694 } 1695 1665 1696 } 1666 1697 // Only commit if we started a new transaction … … 1696 1727 } 1697 1728 1698 private static void dropNotNullConstraint(org.hibernate.Session session, String tableName, String columnName )1729 private static void dropNotNullConstraint(org.hibernate.Session session, String tableName, String columnName, String mySqlDataType) 1699 1730 { 1700 1731 org.hibernate.Transaction tx = null; … … 1705 1736 tx = session.getTransaction().isActive() ? null : HibernateUtil.newTransaction(session); 1706 1737 1707 query = HibernateUtil.getPredefinedSQLQuery(session, "DROP_NOT_NULL_CONSTRAINT", tableName, columnName );1738 query = HibernateUtil.getPredefinedSQLQuery(session, "DROP_NOT_NULL_CONSTRAINT", tableName, columnName, mySqlDataType); 1708 1739 query.executeUpdate(); 1709 1740 -
trunk/src/core/net/sf/basedb/core/dbengine/AbstractDbEngine.java
r6721 r6981 75 75 } 76 76 77 77 /** 78 @return FALSE 79 @since 3.6 80 */ 81 @Override 82 public boolean dropForeignKeysUsedInIndex() 83 { 84 return false; 85 } 86 78 87 /** 79 88 Return the SQL unmodified. -
trunk/src/core/net/sf/basedb/core/dbengine/DbEngine.java
r6880 r6981 123 123 */ 124 124 public String getDropIndexSql(String catalog, String schema, String table, String name, boolean unique); 125 126 /** 127 When dropping an index, must foreign keys that uses the same columns also be 128 dropped (before dropping the index)? Default is FALSE, but MySQL need TRUE. 129 @since 3.6 130 */ 131 public boolean dropForeignKeysUsedInIndex(); 125 132 126 133 /** -
trunk/src/core/net/sf/basedb/core/dbengine/MySQLEngine.java
r6684 r6981 114 114 sql.append(")"); 115 115 return sql.toString(); 116 } 117 118 /** 119 @return TRUE 120 @since 3.6 121 */ 122 @Override 123 public boolean dropForeignKeysUsedInIndex() 124 { 125 return true; 116 126 } 117 127 -
trunk/src/core/net/sf/basedb/core/log/db/AnnotationLogger.java
r6968 r6981 40 40 import net.sf.basedb.core.log.EntityLogger; 41 41 import net.sf.basedb.core.log.LogManager; 42 import net.sf.basedb.core.plugin.ParameterValues;43 42 import net.sf.basedb.util.Values; 44 43 import net.sf.basedb.util.formatter.Formatter; -
trunk/www/common/annotations/annotate.js
r6955 r6981 468 468 { 469 469 var unit = units[unitNo]; 470 var option = new Option(unit.symbol, unit.id, selected == unit.id);470 var option = new Option(unit.symbol, unit.id, false, selected == unit.id); 471 471 option.title = unit.description; 472 472 unitList[unitList.length] = option; … … 683 683 annotate.valueOnBlur = function(event) 684 684 { 685 if (!selectedAnnotation &&selectedMultiIndex < 0) return;685 if (!selectedAnnotation || selectedMultiIndex < 0) return; 686 686 687 687 var frm = document.forms['annotations']; … … 981 981 Doc.show('inherited-list'); 982 982 var inheritedId = event.detail.id; 983 var clone = event.detail.clone; 983 984 984 985 // Check if we have info about this annotation already … … 989 990 { 990 991 entry.modified = INHERITED; 992 if (clone && entry.source != 'CLONED') 993 { 994 annotate.convertToCloned(entry); 995 } 996 else if (!clone && entry.source != 'INHERITED') 997 { 998 annotate.convertToInherited(entry); 999 } 991 1000 Doc.show(entry.id); 992 1001 return; … … 1002 1011 request.open("GET", url, true); 1003 1012 request.send(null); 1004 Ajax.setReadyStateHandler(request, annotate.inheritInfoLoaded, annotate.inheritInfoLoaded); 1013 var callback = clone ? annotate.inheritInfoLoadedAndClone : annotate.inheritInfoLoaded; 1014 Ajax.setReadyStateHandler(request, callback, callback); 1015 } 1016 1017 /** 1018 Callback that converts the inherited annotation to a cloned 1019 annotation. 1020 */ 1021 annotate.inheritInfoLoadedAndClone = function(request) 1022 { 1023 var entry = annotate.inheritInfoLoaded(request); 1024 annotate.convertToCloned(entry); 1005 1025 } 1006 1026 … … 1023 1043 annotations[annotations.length] = entry; 1024 1044 annotate.createAnnotationEntryInList(entry, true); 1045 return entry; 1025 1046 } 1026 1047 -
trunk/www/common/annotations/inherit.js
r6947 r6981 32 32 // Buttons (on standalone dialog) 33 33 Buttons.addClickHandler('close', App.closeWindow); 34 Buttons.addClickHandler('btnOk', inherit.save); 34 Buttons.addClickHandler('btnInherit', inherit.save); 35 Buttons.addClickHandler('btnClone', inherit.save); 35 36 36 37 Events.addEventHandler('quickFilter', 'keyup', inherit.quickFilter); … … 80 81 } 81 82 82 inherit.saveInheritedAnnotations = function( )83 inherit.saveInheritedAnnotations = function(clone) 83 84 { 84 85 var tree = Doc.element('joust'); … … 100 101 var detail = {}; 101 102 detail.id = menuItem.externalId; 103 detail.clone = clone; 102 104 if (isInherited) 103 105 { … … 140 142 Save the annotations in standalone mode. 141 143 */ 142 inherit.save = function( )144 inherit.save = function(event) 143 145 { 144 inherit.saveInheritedAnnotations(); 146 var clone = Data.int(event.currentTarget, 'clone', 0); 147 inherit.saveInheritedAnnotations(clone); 145 148 App.closeWindow(); 146 149 } -
trunk/www/common/annotations/inherit.jsp
r6947 r6981 371 371 372 372 <base:buttongroup subclass="dialogbuttons"> 373 <base:button id="btnOk" title="Ok" /> 373 <base:button id="btnClone" title="Clone" image="copy.png" data-clone="1" /> 374 <base:button id="btnInherit" title="Inherit" image="inherit.png" /> 374 375 <base:button id="close" title="Cancel" /> 375 376 </base:buttongroup> -
trunk/www/common/close_popup.js
r6218 r6981 54 54 if (notifyTarget) 55 55 { 56 var evt = document.createEvent('Event');56 var evt = myOpener.document.createEvent('CustomEvent'); 57 57 evt.initEvent('base-notify', false, true); 58 58 notifyTarget.dispatchEvent(evt);
Note: See TracChangeset
for help on using the changeset viewer.