corrections to chunks insertions in a database

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/data-analysis/EcologicalEngine@95485 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Gianpaolo Coro 2014-05-09 14:38:10 +00:00
parent 557c12a56f
commit d947394cda
1 changed files with 6 additions and 1 deletions

View File

@ -167,6 +167,10 @@ public class DatabaseUtils {
}
public static void insertChunksIntoTable(String table, String columnsNames, List<String[]> values, int chunkSize,SessionFactory dbconnection) throws Exception{
insertChunksIntoTable(table, columnsNames, values, chunkSize,dbconnection, true) ;
}
public static void insertChunksIntoTable(String table, String columnsNames, List<String[]> values, int chunkSize,SessionFactory dbconnection, boolean correctApos) throws Exception{
int valuesize = values.size();
StringBuffer sb = new StringBuffer();
@ -176,7 +180,8 @@ public class DatabaseUtils {
sb.append("(");
for (int j=0;j<row.length;j++){
String preprow = row[j].replaceAll("^'", "").replaceAll("'$", "");
preprow=preprow.replace("'", ""+(char)96);
if (correctApos)
preprow=preprow.replace("'", ""+(char)96);
if (preprow.equalsIgnoreCase("NULL"))
sb.append(preprow);
else