branch develop updated (239a279 -> 80d2e02)
This is an automated email from the git hooks/post-receive script. New change to branch develop in repository observe. See https://gitlab.nuiton.org/codelutin/observe.git from 239a279 Add missing validator → Now fix tests... new 80d2e02 Utilisation de SqlFileReader de nuiton-utils qui gère bien les statements sql (Fixes #8195) The 1 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "adds" were already present in the repository and have only been added to this reference. Detailed log of new commits: commit 80d2e02117888a7f76cba5920999f20bbaba8d5a Author: Tony CHEMIT <chemit@codelutin.com> Date: Fri Sep 2 16:43:43 2016 +0200 Utilisation de SqlFileReader de nuiton-utils qui gère bien les statements sql (Fixes #8195) Summary of changes: .../java/fr/ird/observe/RunScriptTopiaSqlWork.java | 34 +++++++++------------- .../fr/ird/observe/RunScriptsTopiaSqlWork.java | 6 ---- pom.xml | 2 +- 3 files changed, 14 insertions(+), 28 deletions(-) -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.
This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository observe. See https://gitlab.nuiton.org/codelutin/observe.git commit 80d2e02117888a7f76cba5920999f20bbaba8d5a Author: Tony CHEMIT <chemit@codelutin.com> Date: Fri Sep 2 16:43:43 2016 +0200 Utilisation de SqlFileReader de nuiton-utils qui gère bien les statements sql (Fixes #8195) --- .../java/fr/ird/observe/RunScriptTopiaSqlWork.java | 34 +++++++++------------- .../fr/ird/observe/RunScriptsTopiaSqlWork.java | 6 ---- pom.xml | 2 +- 3 files changed, 14 insertions(+), 28 deletions(-) diff --git a/entities/src/main/java/fr/ird/observe/RunScriptTopiaSqlWork.java b/entities/src/main/java/fr/ird/observe/RunScriptTopiaSqlWork.java index eed97d7..f07a5e1 100644 --- a/entities/src/main/java/fr/ird/observe/RunScriptTopiaSqlWork.java +++ b/entities/src/main/java/fr/ird/observe/RunScriptTopiaSqlWork.java @@ -27,6 +27,7 @@ import org.apache.commons.logging.LogFactory; import org.nuiton.topia.persistence.TopiaException; import org.nuiton.topia.persistence.support.TopiaSqlWork; import org.nuiton.util.GZUtil; +import org.nuiton.util.sql.SqlFileReader; import java.io.BufferedInputStream; import java.io.BufferedReader; @@ -89,32 +90,23 @@ public class RunScriptTopiaSqlWork implements TopiaSqlWork { try (Statement statement = connection.createStatement()) { int batchSize = 0; - String command = null; - String next; - while ((next = reader.readLine()) != null) { - String trimLine = next.trim(); + for (String statementStr : new SqlFileReader(reader)) { - if (trimLine.startsWith("--")) { + String trimLine = statementStr.trim(); + + if (trimLine.isEmpty() || trimLine.startsWith("--")) { continue; } - if (command == null) { - command = next; - } else { - command += ' ' + next; + statement.addBatch(trimLine); + if (log.isDebugEnabled()) { + log.debug("Sql statement: " + trimLine); } - if (trimLine.endsWith(";")) { - statement.addBatch(command); - if (log.isDebugEnabled()) { - log.debug("Sql statement: " + command); - } - batchSize++; - command = null; - - if (batchSize % this.batchSize == 0) { - flushStatement(statement); - } + batchSize++; + + if (batchSize % this.batchSize == 0) { + flushStatement(statement); } } @@ -134,7 +126,7 @@ public class RunScriptTopiaSqlWork implements TopiaSqlWork { } - protected BufferedReader createReader() { + private BufferedReader createReader() { try { return new BufferedReader(new InputStreamReader(new BufferedInputStream(gzip ? new GZIPInputStream(new ByteArrayInputStream(content)) : new ByteArrayInputStream(content)))); } catch (IOException e) { diff --git a/entities/src/main/java/fr/ird/observe/RunScriptsTopiaSqlWork.java b/entities/src/main/java/fr/ird/observe/RunScriptsTopiaSqlWork.java index a0ef1bc..2073cbd 100644 --- a/entities/src/main/java/fr/ird/observe/RunScriptsTopiaSqlWork.java +++ b/entities/src/main/java/fr/ird/observe/RunScriptsTopiaSqlWork.java @@ -22,9 +22,6 @@ package fr.ird.observe; * #L% */ -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - import java.sql.Connection; import java.sql.SQLException; @@ -37,9 +34,6 @@ import java.sql.SQLException; */ public class RunScriptsTopiaSqlWork extends RunScriptTopiaSqlWork { - /** Logger. */ - private static final Log log = LogFactory.getLog(RunScriptsTopiaSqlWork.class); - protected final byte[][] contents; public RunScriptsTopiaSqlWork(int batchSize, byte[][] contents) { diff --git a/pom.xml b/pom.xml index d1c3c2d..a3020af 100644 --- a/pom.xml +++ b/pom.xml @@ -166,7 +166,7 @@ <jaxxVersion>2.31</jaxxVersion> <nuitonI18nVersion>3.6.1</nuitonI18nVersion> <nuitonValidatorVersion>3.0.1</nuitonValidatorVersion> - <nuitonUtilsVersion>3.0-rc-14</nuitonUtilsVersion> + <nuitonUtilsVersion>3.0-rc-15</nuitonUtilsVersion> <xworkVersion>2.3.29</xworkVersion> <hibernateVersion>4.3.11.Final</hibernateVersion> <sl4jVersion>1.7.21</sl4jVersion> -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.
participants (1)
-
codelutin.com scm