mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Merged V3.4 to HEAD (SQL-level fixes)
23368: Merged V3.3-BUG-FIX to V3.4 23363: Merged V3.3 to V3.3-BUG-FIX 23358: (RECORD ONLY) Removed redundant svn:mergeinfo 23359: Minor I18N fix on patch.updateMimetypes2 23360: Fixed ALF-3167: Websphere/Db2 SchemaBootstrap.dumpSchema is failing due to result set is closed error - SchemaDump uses nested resultset reads, which is incompatible with SchemaBootstrap's auto-commit connection - Also pull back some changes to fix MySQL builds after MySQL upgrades 23361: More patch I18N 23362: Merged V3.2 to V3.3 23333: Fixed ALF-5396: Missing FK indexes on non-MySQL databases 23324: Fixed ALF-5396: Missing FK indexes on non-MySQL databases - Create scripts were manually ported and required full clean-install testing in addition to upgrade testing 23372: Fixed ALF-5421: update_ChildAssocsIndex ibatis statement does not include child_node_id 23523: Merged BRANCHES/DEV/V3.3-BUG-FIX to BRANCHES/V3.4: 23490: Merged BRANCHES/V3.3 to BRANCHES/DEV/V3.3-BUG-FIX: 23470: Merged V3.2 to V3.3 23395: Merged BRANCHES/DEV/BELARUS/HEAD_2010_09_21 to V32 22821: ALF-4203: WCM 2.2.7 case-sensitivity causes errors after upgrade to 3.2.x. 23055: ALF-4203: WCM 2.2.7 case-sensitivity causes errors after upgrade to 3.2.x (record-only, used only part of this checkin). 23198: ALF-4203: WCM 2.2.7 case-sensitivity causes errors after upgrade to 3.2.x. 23398: ALF-4203: fix for "WCM 2.2.7 case-senstivity causes err rs after upgrade to 3.2.x" - updated template for patch.eliminateDuplicates 23433: Fix for ALF-4203: "WCM 2.2.7 case-sensitivity causes errors after upgrade to 3.2.x" - revised fix 23752: Fixed ALF-5453: Remove old Audit tables from schema create scripts 23957: Fixed ALF-5308: SQL error when changing name for record / folder with dispostion schedule applied 24250: Fix typo in original fix of ALF-5308 and add unit test 24345: Merged V3.3 to V3.4 24337: Fixed ALF-6078: WCM: alf_lock table version number fails during roll-over. - Added specific, minor fixes for 3.4 24352: Fix SQL fallout from ALF-6078 git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@24354 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -41,6 +41,7 @@ import javax.xml.transform.sax.SAXTransformerFactory;
|
||||
import javax.xml.transform.sax.TransformerHandler;
|
||||
import javax.xml.transform.stream.StreamResult;
|
||||
|
||||
import org.alfresco.util.PropertyCheck;
|
||||
import org.hibernate.dialect.Dialect;
|
||||
import org.hibernate.dialect.Oracle8iDialect;
|
||||
import org.hibernate.dialect.TypeNames;
|
||||
@@ -67,8 +68,8 @@ public class Main
|
||||
/** Should we scale down string field widths (assuming 4 bytes to one character?). */
|
||||
private boolean scaleCharacters;
|
||||
|
||||
/** The JDBC connection. */
|
||||
private Connection con;
|
||||
/** The JDBC DataSource. */
|
||||
private DataSource dataSource;
|
||||
|
||||
/**
|
||||
* The main method.
|
||||
@@ -92,15 +93,13 @@ public class Main
|
||||
/**
|
||||
* Creates a new instance of this tool by starting up a full context.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public Main(final String contextPath) throws Exception
|
||||
{
|
||||
final ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(new String[]
|
||||
{
|
||||
"file:" + contextPath
|
||||
});
|
||||
final DataSource datasource = (DataSource) context.getBean("dataSource");
|
||||
this.con = datasource.getConnection();
|
||||
this.dataSource = (DataSource) context.getBean("dataSource");
|
||||
|
||||
// Use Java reflection to bypass accessibility rules and get hold of hibernate's type mapping!
|
||||
final Properties hibProps = (Properties) context.getBean("hibernateConfigProperties");
|
||||
@@ -116,9 +115,9 @@ public class Main
|
||||
* @param connection the database connection to use for metadata queries
|
||||
* @param dialect the Hibernate dialect
|
||||
*/
|
||||
public Main(final Connection connection, final Dialect dialect) throws Exception
|
||||
public Main(final DataSource dataSource, final Dialect dialect) throws Exception
|
||||
{
|
||||
this.con = connection;
|
||||
this.dataSource = dataSource;
|
||||
|
||||
// Initialize
|
||||
init(dialect);
|
||||
@@ -163,7 +162,19 @@ public class Main
|
||||
*/
|
||||
public void execute(File outputFile) throws Exception
|
||||
{
|
||||
final NamedElementCollection result = execute();
|
||||
PropertyCheck.mandatory(this, "dataSource", dataSource);
|
||||
// Get a Connection
|
||||
Connection connection = dataSource.getConnection();
|
||||
NamedElementCollection result = null;
|
||||
try
|
||||
{
|
||||
connection.setAutoCommit(false);
|
||||
result = execute(connection);
|
||||
}
|
||||
finally
|
||||
{
|
||||
try { connection.close(); } catch (Throwable e) {}
|
||||
}
|
||||
|
||||
// Set up a SAX TransformerHandler for outputting XML
|
||||
final SAXTransformerFactory stf = (SAXTransformerFactory) TransformerFactory.newInstance();
|
||||
@@ -190,11 +201,11 @@ public class Main
|
||||
*
|
||||
* @return Returns the named XML elements
|
||||
*/
|
||||
public NamedElementCollection execute() throws Exception
|
||||
private NamedElementCollection execute(Connection con) throws Exception
|
||||
{
|
||||
final NamedElementCollection schemaCol = new NamedElementCollection("schema", "table");
|
||||
|
||||
final DatabaseMetaData dbmd = this.con.getMetaData();
|
||||
final DatabaseMetaData dbmd = con.getMetaData();
|
||||
|
||||
// Assume that if there are schemas, we want the one named after the connection user or the one called "dbo" (MS
|
||||
// SQL hack)
|
||||
@@ -398,19 +409,6 @@ public class Main
|
||||
this.elementName = elementName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds an attribute.
|
||||
*
|
||||
* @param name
|
||||
* the name
|
||||
* @param value
|
||||
* the value
|
||||
*/
|
||||
public void addAttribute(final String name, final String value)
|
||||
{
|
||||
this.attributes.addAttribute("", "", name, "CDATA", value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a named element.
|
||||
*
|
||||
|
Reference in New Issue
Block a user