set fetch size; replace quotes only after handling null

This commit is contained in:
Paul Trowbridge 2022-10-25 14:43:30 -04:00
parent 0615163fad
commit 3b4af2bf47
1 changed files with 11 additions and 5 deletions

View File

@ -161,6 +161,7 @@ public class jrunner {
//----------------------------------------open resultset------------------------------------------------------------ //----------------------------------------open resultset------------------------------------------------------------
try { try {
stmt = scon.createStatement(); stmt = scon.createStatement();
stmt.setFetchSize(10000);
rs = stmt.executeQuery(sq); rs = stmt.executeQuery(sq);
//while (rs.next()) { //while (rs.next()) {
// System.out.println(rs.getString("x")); // System.out.println(rs.getString("x"));
@ -201,29 +202,32 @@ public class jrunner {
for (int i = 1; i <= cols; i++){ for (int i = 1; i <= cols; i++){
switch (dtn[i]){ switch (dtn[i]){
case "VARCHAR": case "VARCHAR":
nc = rs.getString(i).replace("'","''"); nc = rs.getString(i);
if (rs.wasNull() || nc == null) { if (rs.wasNull() || nc == null) {
nc = "NULL"; nc = "NULL";
break; break;
} }
nc.replace("'","''");
if (trim) { nc = nc.trim();} if (trim) { nc = nc.trim();}
nc = "'" + nc + "'"; nc = "'" + nc + "'";
break; break;
case "CLOB": case "CLOB":
nc = rs.getString(i).replace("'","''"); nc = rs.getString(i);
if (rs.wasNull() || nc == null) { if (rs.wasNull() || nc == null) {
nc = "NULL"; nc = "NULL";
break; break;
} }
nc.replace("'","''");
if (trim) { nc = nc.trim();} if (trim) { nc = nc.trim();}
nc = "'" + nc + "'"; nc = "'" + nc + "'";
break; break;
case "CHAR": case "CHAR":
nc = rs.getString(i).replace("'","''"); nc = rs.getString(i);
if (rs.wasNull() || nc == null) { if (rs.wasNull() || nc == null) {
nc = "NULL"; nc = "NULL";
break; break;
} }
nc.replace("'","''");
if (trim) { nc = nc.trim();} if (trim) { nc = nc.trim();}
nc = "'" + nc + "'"; nc = "'" + nc + "'";
break; break;
@ -239,19 +243,21 @@ public class jrunner {
} }
break; break;
case "TIME": case "TIME":
nc = rs.getString(i).replace("'","''"); nc = rs.getString(i);
if (rs.wasNull() || nc == null) { if (rs.wasNull() || nc == null) {
nc = "NULL"; nc = "NULL";
break; break;
} }
nc.replace("'","''");
nc = "'" + nc + "'"; nc = "'" + nc + "'";
break; break;
case "TIMESTAMP": case "TIMESTAMP":
nc = rs.getString(i).replace("'","''"); nc = rs.getString(i);
if (rs.wasNull() || nc == null) { if (rs.wasNull() || nc == null) {
nc = "NULL"; nc = "NULL";
break; break;
} }
nc.replace("'","''");
nc = "'" + nc + "'"; nc = "'" + nc + "'";
break; break;
case "BIGINT": case "BIGINT":