mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-14 17:58:59 +00:00
Merged HEAD-BUG-FIX (5.1/Cloud) to HEAD (5.1/Cloud)
91564: Merged 5.0.N (5.0.1) to HEAD-BUG-FIX (5.1/Cloud) 91556: Merged V4.2-BUG-FIX (4.2.5) to 5.0.N (5.0.1) 91472: Merged V4.2.4 (4.2.4) to V4.2-BUG-FIX (4.2.5) 91406: Merged DEV (4.2.4) to V4.2.4 (4.2.4) 91352: MNT-12716 : 3.4 -> 4.2 Upgrade does not migrate locales of translated documents - We can now specify default value in --ASSIGN directive using ftl-like way (var=col_name!-1). git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@94811 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -15,7 +15,7 @@ CREATE TABLE tmp_locale_upgrade
|
||||
KEY idx_tmp_loc_str_v (string_value(42))
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
--ASSIGN:locale_qname_id=id
|
||||
--ASSIGN:locale_qname_id=id!-1
|
||||
SELECT alf_qname.id AS id FROM alf_qname
|
||||
JOIN alf_namespace ON (alf_namespace.id = alf_qname.ns_id)
|
||||
WHERE
|
||||
|
@@ -16,7 +16,7 @@ CREATE TABLE tmp_locale_upgrade
|
||||
CREATE INDEX idx_tmp_loc_n_id ON tmp_locale_upgrade (node_id);
|
||||
CREATE INDEX idx_tmp_loc_str_v ON tmp_locale_upgrade (string_value);
|
||||
|
||||
--ASSIGN:locale_qname_id=id
|
||||
--ASSIGN:locale_qname_id=id!-1
|
||||
SELECT alf_qname.id AS id FROM alf_qname
|
||||
JOIN alf_namespace ON (alf_namespace.id = alf_qname.ns_id)
|
||||
WHERE
|
||||
|
@@ -1254,6 +1254,7 @@ public class SchemaBootstrap extends AbstractLifecycleBean
|
||||
StringBuilder sb = new StringBuilder(1024);
|
||||
String fetchVarName = null;
|
||||
String fetchColumnName = null;
|
||||
Object defaultFetchValue = null;
|
||||
boolean doBatch = false;
|
||||
int batchUpperLimit = 0;
|
||||
int batchSize = 1;
|
||||
@@ -1314,13 +1315,18 @@ public class SchemaBootstrap extends AbstractLifecycleBean
|
||||
throw AlfrescoRuntimeException.create(ERR_STATEMENT_VAR_ASSIGNMENT_BEFORE_SQL, (line - 1), scriptUrl);
|
||||
}
|
||||
String assignStr = sql.substring(9, sql.length());
|
||||
String[] assigns = assignStr.split("=");
|
||||
String[] fetchMapping = assignStr.split("!");
|
||||
String[] assigns = fetchMapping[0].split("=");
|
||||
if (assigns.length != 2 || assigns[0].length() == 0 || assigns[1].length() == 0)
|
||||
{
|
||||
throw AlfrescoRuntimeException.create(ERR_STATEMENT_VAR_ASSIGNMENT_FORMAT, (line - 1), scriptUrl);
|
||||
}
|
||||
fetchVarName = assigns[0];
|
||||
fetchColumnName = assigns[1];
|
||||
if (fetchMapping.length > 1 && fetchMapping[1].length() > 0)
|
||||
{
|
||||
defaultFetchValue = fetchMapping[1];
|
||||
}
|
||||
continue;
|
||||
}
|
||||
// Handle looping control
|
||||
@@ -1474,12 +1480,20 @@ public class SchemaBootstrap extends AbstractLifecycleBean
|
||||
Object fetchedVal = executeStatement(connection, sql, fetchColumnName, optional, line, scriptFile);
|
||||
if (fetchVarName != null && fetchColumnName != null)
|
||||
{
|
||||
varAssignments.put(fetchVarName, fetchedVal);
|
||||
if (fetchedVal != null)
|
||||
{
|
||||
varAssignments.put(fetchVarName, fetchedVal);
|
||||
}
|
||||
else
|
||||
{
|
||||
varAssignments.put(fetchVarName, defaultFetchValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
sb.setLength(0);
|
||||
fetchVarName = null;
|
||||
fetchColumnName = null;
|
||||
defaultFetchValue = null;
|
||||
doBatch = false;
|
||||
batchUpperLimit = 0;
|
||||
batchSize = 1;
|
||||
|
Reference in New Issue
Block a user