Compare commits

...

2 Commits

Author SHA1 Message Date
efd922b2e0 v.036 2022-10-25 14:43:53 -04:00
3b4af2bf47 set fetch size; replace quotes only after handling null 2022-10-25 14:43:30 -04:00

View File

@ -35,7 +35,7 @@ public class jrunner {
Integer cols = null; Integer cols = null;
String[] dtn = null; String[] dtn = null;
msg = "jrunner version 0.35"; msg = "jrunner version 0.36";
msg = msg + nl + "-scu source jdbc url"; msg = msg + nl + "-scu source jdbc url";
msg = msg + nl + "-scn source username"; msg = msg + nl + "-scn source username";
msg = msg + nl + "-scp source passowrd"; msg = msg + nl + "-scp source passowrd";
@ -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":