Skip to content
This repository has been archived by the owner on Nov 30, 2021. It is now read-only.

Commit

Permalink
BZ-1049238 - Enable manual execution of the DDL script
Browse files Browse the repository at this point in the history
  • Loading branch information
dgutierr committed Mar 17, 2015
1 parent 5dd6ce9 commit 65a7a70
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
Expand Up @@ -47,7 +47,7 @@ public class DatabaseAutoSynchronizer {
@Inject @Config("dashb_installed_module")
protected String installedModulesTable;

@Inject @Config("delimiter //, //, , delimiter ;, GO")
@Inject @Config("DELIMITER //,//,// DELIMITER ;,GO")
protected String[] excludedScriptStatements;

@Inject @Config("-- CUSTOM_DELIMITER")
Expand Down Expand Up @@ -109,8 +109,8 @@ protected void runDDL(final String ddl) throws Exception {
if (ddl.startsWith(customDelimiterEnabler)) separator = customDelimiter;
String[] statements = splitString(ddl, separator);
for (int i = 0; i < statements.length; i++) {
final String ddlStatement = removeComments(statements[i]);
if (ArrayUtils.contains(excludedScriptStatements, ddlStatement)) {
final String ddlStatement = removeComments(statements[i]).trim();
if (ddlStatement.length() == 0 || ArrayUtils.contains(excludedScriptStatements, ddlStatement)) {
continue;
}

Expand Down
Expand Up @@ -26,13 +26,19 @@ CREATE TABLE hibernate_unique_key (
INSERT INTO hibernate_unique_key VALUES(1);
-- CUSTOM_DELIMITER

DELIMITER //
-- CUSTOM_DELIMITER

CREATE PROCEDURE nextVal()
MODIFIES SQL DATA
BEGIN
UPDATE hibernate_unique_key SET next_hi = next_hi + 1;
END
-- CUSTOM_DELIMITER

//
-- CUSTOM_DELIMITER

CREATE FUNCTION currVal()
RETURNS int
READS SQL DATA
Expand All @@ -41,6 +47,9 @@ BEGIN
END
-- CUSTOM_DELIMITER

// DELIMITER ;
-- CUSTOM_DELIMITER

CREATE TABLE dashb_data_source (
dbid bigint(50) primary key,
ds_type varchar(512),
Expand Down

0 comments on commit 65a7a70

Please sign in to comment.