Skip to content

Commit 41c3e76

Browse files
Bernhard SchlegelBernhard Schlegel
authored andcommitted
CHANGE: Bugfixes in ESQLNumArray and ESQLTextArray
1 parent 4522104 commit 41c3e76

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

bin/sql_dumper.jar

-6 Bytes
Binary file not shown.

src/main/java/sqldump/etl/esql/functions/ESQLNumArray.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ public static List<String> execute(String match, Log log) {
3737
while (m2.find())
3838
count++;
3939
log.info("found " + String.valueOf(count) + " elements");
40+
// count now holds the number of actual values (the blocksize
41+
// itself is not included. So e.g. 2, val1, val2, val3 would
42+
// lead to count = 3
4043

4144
String[] values = block.split(",", 0); // no limit, may cause stability issue on small hardware
4245

@@ -49,7 +52,7 @@ public static List<String> execute(String match, Log log) {
4952
for (int k = 0; k < blocksize && j <= (count); k++) {
5053
String tempstr = values[j].toString();
5154
tempstr = tempstr.replace("\"", "");
52-
if ((k + 1) < blocksize && (j + 1) < (count)) {
55+
if ((k + 1) < blocksize && j < (count)) {
5356
tempstr += ", ";
5457
}
5558
superString += tempstr;

src/main/java/sqldump/etl/esql/functions/ESQLTextArray.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@ public static List<String> execute(String match, Log log) {
4444
int blocksize = Integer.parseInt(values[0]);
4545

4646
// add all numbers in range
47-
for (int j = 1; j < (count); j++) {
47+
for (int j = 1; j < (count+1);) {
4848
String superString = "(";
49-
for (int k = 0; k < blocksize && j <= (count); k++) {
49+
for (int k = 0; k < blocksize && j <= (count+1); k++) {
5050
String tempstr = values[j].toString();
5151
tempstr = tempstr.replace("\"", "'");
5252
if ((k + 1) < blocksize && (j + 1) < (count)) {

0 commit comments

Comments
 (0)