You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by bo...@apache.org on 2017/02/17 05:53:06 UTC
[1/3] ant git commit: Added forceCsvQuoteChar option
Repository: ant
Updated Branches:
refs/heads/1.9.x 05d69720d -> 54f5c5fbb
Added forceCsvQuoteChar option
Project: http://git-wip-us.apache.org/repos/asf/ant/repo
Commit: http://git-wip-us.apache.org/repos/asf/ant/commit/474d23b5
Tree: http://git-wip-us.apache.org/repos/asf/ant/tree/474d23b5
Diff: http://git-wip-us.apache.org/repos/asf/ant/diff/474d23b5
Branch: refs/heads/1.9.x
Commit: 474d23b554cef3164e5edc65ab1d1a52727b9b42
Parents: a20c419
Author: Francesco Steccanella <fs...@gmail.com>
Authored: Thu Feb 16 12:13:40 2017 +0100
Committer: Stefan Bodewig <bo...@apache.org>
Committed: Fri Feb 17 06:49:14 2017 +0100
----------------------------------------------------------------------
manual/Tasks/sql.html | 7 +++++++
1 file changed, 7 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ant/blob/474d23b5/manual/Tasks/sql.html
----------------------------------------------------------------------
diff --git a/manual/Tasks/sql.html b/manual/Tasks/sql.html
index e5f4db8..bade590 100644
--- a/manual/Tasks/sql.html
+++ b/manual/Tasks/sql.html
@@ -263,6 +263,13 @@ and <b>abort</b> execution and transaction and fail task.</p>
</tr>
<tr>
+ <td width="12%" valign="top">forceCsvQuoteChar</td>
+ <td width="78%" valign="top">If true, quoting always occurs</td>
+ <td width="10%" valign="top">No, default is not set (i.e. quoting
+ occurs only where needed)</td>
+</tr>
+
+<tr>
<td valign="top">errorproperty</td>
<td valign="top">The name of a property to set in the event of an
error. <em>Since Ant 1.8.0</em></td>
[2/3] ant git commit: Added option to force the csv quote char
Posted by bo...@apache.org.
Added option to force the csv quote char
Project: http://git-wip-us.apache.org/repos/asf/ant/repo
Commit: http://git-wip-us.apache.org/repos/asf/ant/commit/a20c4195
Tree: http://git-wip-us.apache.org/repos/asf/ant/tree/a20c4195
Diff: http://git-wip-us.apache.org/repos/asf/ant/diff/a20c4195
Branch: refs/heads/1.9.x
Commit: a20c41951b850644b2b2cc3cbf17c696e6e0529c
Parents: 05d6972
Author: Francesco Steccanella <fs...@gmail.com>
Authored: Mon Feb 6 10:57:51 2017 +0100
Committer: Stefan Bodewig <bo...@apache.org>
Committed: Fri Feb 17 06:49:14 2017 +0100
----------------------------------------------------------------------
.../org/apache/tools/ant/taskdefs/SQLExec.java | 18 ++++++++++++++----
1 file changed, 14 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ant/blob/a20c4195/src/main/org/apache/tools/ant/taskdefs/SQLExec.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/SQLExec.java b/src/main/org/apache/tools/ant/taskdefs/SQLExec.java
index 6d1e514..d913566 100644
--- a/src/main/org/apache/tools/ant/taskdefs/SQLExec.java
+++ b/src/main/org/apache/tools/ant/taskdefs/SQLExec.java
@@ -274,6 +274,11 @@ public class SQLExec extends JDBCTask {
private String rowCountProperty = null;
/**
+ * The name of the property to force the csv quote character
+ */
+ private boolean forceCsvQuoteChar = false;
+
+ /**
* Set the name of the SQL file to be run.
* Required unless statements are enclosed in the build file
* @param srcFile the file containing the SQL command.
@@ -587,6 +592,13 @@ public class SQLExec extends JDBCTask {
}
/**
+ * Force the csv quote character
+ */
+ public void setForceCsvQuoteChar(boolean forceCsvQuoteChar) {
+ this.forceCsvQuoteChar = forceCsvQuoteChar;
+ }
+
+ /**
* Load the sql file and then execute it
* @throws BuildException on error.
*/
@@ -878,7 +890,7 @@ public class SQLExec extends JDBCTask {
int columnCount = md.getColumnCount();
if (columnCount > 0) {
if (showheaders) {
- out.print(md.getColumnName(1));
+ out.print(maybeQuote(md.getColumnName(1)));
for (int col = 2; col <= columnCount; col++) {
out.print(csvColumnSep);
out.print(maybeQuote(md.getColumnName(col)));
@@ -912,9 +924,7 @@ public class SQLExec extends JDBCTask {
}
private String maybeQuote(String s) {
- if (csvQuoteChar == null || s == null
- || (s.indexOf(csvColumnSep) == -1 && s.indexOf(csvQuoteChar) == -1)
- ) {
+ if (csvQuoteChar == null || s == null || (!forceCsvQuoteChar && s.indexOf(csvColumnSep) == -1 && s.indexOf(csvQuoteChar) == -1)) {
return s;
}
StringBuffer sb = new StringBuffer(csvQuoteChar);
[3/3] ant git commit: Record new forceCsvQuoteChar by Francesco
Steccanella
Posted by bo...@apache.org.
Record new forceCsvQuoteChar by Francesco Steccanella
closes #32
Project: http://git-wip-us.apache.org/repos/asf/ant/repo
Commit: http://git-wip-us.apache.org/repos/asf/ant/commit/54f5c5fb
Tree: http://git-wip-us.apache.org/repos/asf/ant/tree/54f5c5fb
Diff: http://git-wip-us.apache.org/repos/asf/ant/diff/54f5c5fb
Branch: refs/heads/1.9.x
Commit: 54f5c5fbbd51f2f7bf239756010f49fdfc99dd55
Parents: 474d23b
Author: Stefan Bodewig <bo...@apache.org>
Authored: Fri Feb 17 06:51:47 2017 +0100
Committer: Stefan Bodewig <bo...@apache.org>
Committed: Fri Feb 17 06:51:47 2017 +0100
----------------------------------------------------------------------
CONTRIBUTORS | 1 +
WHATSNEW | 7 +++++++
contributors.xml | 4 ++++
3 files changed, 12 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ant/blob/54f5c5fb/CONTRIBUTORS
----------------------------------------------------------------------
diff --git a/CONTRIBUTORS b/CONTRIBUTORS
index 1988638..17022c7 100644
--- a/CONTRIBUTORS
+++ b/CONTRIBUTORS
@@ -125,6 +125,7 @@ Erik Hatcher
Erik Langenbach
Erik Meade
Ernst de Haan
+Francesco Steccanella
Frank Harnack
Frank Somers
Frank Zeyda
http://git-wip-us.apache.org/repos/asf/ant/blob/54f5c5fb/WHATSNEW
----------------------------------------------------------------------
diff --git a/WHATSNEW b/WHATSNEW
index 781ed01..2c10b1e 100644
--- a/WHATSNEW
+++ b/WHATSNEW
@@ -1,6 +1,13 @@
Changes from Ant 1.9.9 TO Ant 1.9.10
====================================
+Other changes:
+--------------
+
+ * Added forceCsvQuoteChar option to <csv> task. When enabled the
+ values always get quoted.
+ Github Pull Request #32
+
Changes from Ant 1.9.8 TO Ant 1.9.9
===================================
http://git-wip-us.apache.org/repos/asf/ant/blob/54f5c5fb/contributors.xml
----------------------------------------------------------------------
diff --git a/contributors.xml b/contributors.xml
index 1356f38..ee049cb 100644
--- a/contributors.xml
+++ b/contributors.xml
@@ -524,6 +524,10 @@
<last>de Haan</last>
</name>
<name>
+ <first>Francesco</first>
+ <last>Steccanella</last>
+ </name>
+ <name>
<first>Frank</first>
<last>Harnack</last>
</name>