git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/data-analysis/EcologicalEngine@85006 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
b87996cb5e
commit
660561ff4a
|
@ -174,12 +174,12 @@ public class DatabaseUtils {
|
||||||
String[] row = values.get(i);
|
String[] row = values.get(i);
|
||||||
sb.append("(");
|
sb.append("(");
|
||||||
for (int j=0;j<row.length;j++){
|
for (int j=0;j<row.length;j++){
|
||||||
sb.append("'"+row[j]+"'");
|
sb.append("'"+row[j].replaceAll("^'", "").replaceAll("'$", "")+"'");
|
||||||
if (j<row.length-1)
|
if (j<row.length-1)
|
||||||
sb.append(",");
|
sb.append(",");
|
||||||
}
|
}
|
||||||
sb.append(")");
|
sb.append(")");
|
||||||
if (stopIndex%chunkSize==0){
|
if (stopIndex>0 && stopIndex%chunkSize==0){
|
||||||
DatabaseFactory.executeSQLUpdate(insertFromBuffer(table, columnsNames, sb), dbconnection);
|
DatabaseFactory.executeSQLUpdate(insertFromBuffer(table, columnsNames, sb), dbconnection);
|
||||||
stopIndex=chunkSize;
|
stopIndex=chunkSize;
|
||||||
sb = new StringBuffer();
|
sb = new StringBuffer();
|
||||||
|
@ -189,8 +189,16 @@ public class DatabaseUtils {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stopIndex<valuesize-1){
|
if (stopIndex<valuesize-1){
|
||||||
List<String[]> sublist = values.subList(stopIndex+1, valuesize);
|
if (sb.length()>0){
|
||||||
insertChunksIntoTable(table, columnsNames, sublist, chunkSize,dbconnection);
|
// System.out.println(sb);
|
||||||
|
try{
|
||||||
|
DatabaseFactory.executeSQLUpdate(insertFromBuffer(table, columnsNames, sb), dbconnection);
|
||||||
|
}catch(Exception e){
|
||||||
|
System.out.println("Query:"+sb);
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue