Compare commits

..

2 Commits

Author SHA1 Message Date
91405f2dfe v0.31 2022-10-20 22:05:39 -04:00
3c0f249492 set value as NULL if getString returns null an wasNull fails 2022-10-20 22:03:54 -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.30"; msg = "jrunner version 0.31";
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";
@ -193,44 +193,49 @@ public class jrunner {
nr = ""; nr = "";
for (int i = 1; i <= cols; i++){ for (int i = 1; i <= cols; i++){
nc = rs.getString(i); nc = rs.getString(i);
if (rs.wasNull()) { if (dtn[i] == "DATE" && nc == "null") {
nc = "NULL"; nc = "NULL";
} else { }
switch (dtn[i]){ else {
case "VARCHAR": if (rs.wasNull()) {
nc = rs.getString(i).replace("'","''"); nc = "NULL";
if (trim) { nc = nc.trim();} } else {
nc = "'" + nc + "'"; switch (dtn[i]){
break; case "VARCHAR":
case "CLOB": nc = rs.getString(i).replace("'","''");
nc = rs.getString(i).replace("'","''"); if (trim) { nc = nc.trim();}
if (trim) { nc = nc.trim();} nc = "'" + nc + "'";
nc = "'" + nc + "'"; break;
break; case "CLOB":
case "CHAR": nc = rs.getString(i).replace("'","''");
nc = rs.getString(i).replace("'","''"); if (trim) { nc = nc.trim();}
if (trim) { nc = nc.trim();} nc = "'" + nc + "'";
nc = "'" + nc + "'"; break;
break; case "CHAR":
case "DATE": nc = rs.getString(i).replace("'","''");
nc = "'" + rs.getString(i) + "'"; if (trim) { nc = nc.trim();}
if (nc == "'1/1/0001 12:00:00 AM'") { nc = "'" + nc + "'";
nc = "NULL"; break;
} case "DATE":
break; nc = "'" + rs.getString(i) + "'";
case "TIME": if (nc == "'1/1/0001 12:00:00 AM'") {
nc = "'" + rs.getString(i).replace("'","''") + "'"; nc = "NULL";
break; }
case "BIGINT": break;
nc = rs.getString(i); case "TIME":
default: nc = "'" + rs.getString(i).replace("'","''") + "'";
if (rs.getString(i) != "") { break;
case "BIGINT":
nc = rs.getString(i); nc = rs.getString(i);
} default:
else { if (rs.getString(i) != "") {
nc = "NULL"; nc = rs.getString(i);
} }
break; else {
nc = "NULL";
}
break;
}
} }
} }
if (i != 1){ if (i != 1){