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:
parent
557c12a56f
commit
d947394cda
|
@ -167,6 +167,10 @@ public class DatabaseUtils {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void insertChunksIntoTable(String table, String columnsNames, List<String[]> values, int chunkSize,SessionFactory dbconnection) throws Exception{
|
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();
|
int valuesize = values.size();
|
||||||
StringBuffer sb = new StringBuffer();
|
StringBuffer sb = new StringBuffer();
|
||||||
|
@ -176,7 +180,8 @@ public class DatabaseUtils {
|
||||||
sb.append("(");
|
sb.append("(");
|
||||||
for (int j=0;j<row.length;j++){
|
for (int j=0;j<row.length;j++){
|
||||||
String preprow = row[j].replaceAll("^'", "").replaceAll("'$", "");
|
String preprow = row[j].replaceAll("^'", "").replaceAll("'$", "");
|
||||||
preprow=preprow.replace("'", ""+(char)96);
|
if (correctApos)
|
||||||
|
preprow=preprow.replace("'", ""+(char)96);
|
||||||
if (preprow.equalsIgnoreCase("NULL"))
|
if (preprow.equalsIgnoreCase("NULL"))
|
||||||
sb.append(preprow);
|
sb.append(preprow);
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in New Issue