set value as NULL if getString returns null an wasNull fails

This commit is contained in:
Paul Trowbridge 2022-10-20 22:03:54 -04:00
parent 4b52dac2e9
commit 3c0f249492

View File

@ -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){