Merged 5.1-MNT1 (5.1.0) to HEAD (5.1)

115467 adavis: Merged 5.1.N (5.1.1) to 5.1-MNT1 (5.1.0)
      114588 amorarasu: Merged 5.0.N (5.0.3) to 5.1.N (5.1.1)
         114484 amorarasu: Merged V4.2-BUG-FIX (4.2.6) to 5.0.N (5.0.3)
            114312 amorarasu: Merged V4.1-BUG-FIX (4.1.11) to V4.2-BUG-FIX (4.2.6)
               114244 tvalkevych: Merged V4.1.9 (4.1.9.13) to V4.1-BUG-FIX (4.1.11)
                  113716 dhulley: MNT-14911: Fix formatting during bug fix


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@115676 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Alan Davis
2015-10-30 00:11:52 +00:00
parent 50b777f4d9
commit d00e8e6a83

View File

@@ -1,5 +1,6 @@
/* /*
* Copyright (C) 2005-2010 Alfresco Software Limited. * Copyright (C) 2005-2015 Alfresco Software Limited.
* *
* This file is part of Alfresco * This file is part of Alfresco
* *
@@ -1329,7 +1330,7 @@ public class SchemaBootstrap extends AbstractLifecycleBean
} }
continue; continue;
} }
// Handle looping control // Handle looping control
else if (sql.startsWith("--FOREACH")) else if (sql.startsWith("--FOREACH"))
{ {
// --FOREACH table.column batch.size.property // --FOREACH table.column batch.size.property
@@ -1338,13 +1339,13 @@ public class SchemaBootstrap extends AbstractLifecycleBean
if (args.length == 3 && (sepIndex = args[1].indexOf('.')) != -1) if (args.length == 3 && (sepIndex = args[1].indexOf('.')) != -1)
{ {
doBatch = true; doBatch = true;
// Select the upper bound of the table column // Select the upper bound of the table column
String stmt = "SELECT MAX(" + args[1].substring(sepIndex+1) + ") AS upper_limit FROM " + args[1].substring(0, sepIndex); String stmt = "SELECT MAX(" + args[1].substring(sepIndex+1) + ") AS upper_limit FROM " + args[1].substring(0, sepIndex);
Object fetchedVal = executeStatement(connection, stmt, "upper_limit", false, line, scriptFile); Object fetchedVal = executeStatement(connection, stmt, "upper_limit", false, line, scriptFile);
if (fetchedVal instanceof Number) if (fetchedVal instanceof Number)
{ {
batchUpperLimit = ((Number)fetchedVal).intValue(); batchUpperLimit = ((Number)fetchedVal).intValue();
// Read the batch size from the named property // Read the batch size from the named property
String batchSizeString = globalProperties.getProperty(args[2]); String batchSizeString = globalProperties.getProperty(args[2]);
// Fall back to the default property // Fall back to the default property
if (batchSizeString == null) if (batchSizeString == null)
@@ -1473,7 +1474,7 @@ public class SchemaBootstrap extends AbstractLifecycleBean
if (this.dialect != null && this.dialect instanceof MySQLInnoDBDialect) if (this.dialect != null && this.dialect instanceof MySQLInnoDBDialect)
{ {
// note: enable bootstrap on MySQL 5.5 (eg. for auto-generated SQL, such as JBPM) // note: enable bootstrap on MySQL 5.5 (eg. for auto-generated SQL, such as JBPM)
sql = sql.replaceAll("(?i)TYPE=InnoDB", "ENGINE=InnoDB"); sql = sql.replaceAll("(?i)TYPE=InnoDB", "ENGINE=InnoDB");
} }
@@ -2121,20 +2122,20 @@ public class SchemaBootstrap extends AbstractLifecycleBean
@Override @Override
protected void onShutdown(ApplicationEvent event) protected void onShutdown(ApplicationEvent event)
{ {
// Shut down DB, if required // Shut down DB, if required
Class<?> dialectClazz = this.dialect.getClass(); Class<?> dialectClazz = this.dialect.getClass();
if (dialectClazz.equals(DerbyDialect.class)) if (dialectClazz.equals(DerbyDialect.class))
{ {
try try
{ {
DriverManager.getConnection("jdbc:derby:;shutdown=true"); DriverManager.getConnection("jdbc:derby:;shutdown=true");
} }
// Derby shutdown always triggers an exception, even when clean // Derby shutdown always triggers an exception, even when clean
catch (Throwable e) catch (Throwable e)
{ {
} }
} }
} }
/** /**
* This is a workaround for the odd Spring-Hibernate interaction during configuration. * This is a workaround for the odd Spring-Hibernate interaction during configuration.