push null test into each type

This commit is contained in:
Paul Trowbridge 2022-10-25 13:24:15 -04:00
parent e60a92cfdc
commit cf5abeddbe

View File

@ -199,54 +199,71 @@ public class jrunner {
t++; t++;
nr = ""; nr = "";
for (int i = 1; i <= cols; i++){ for (int i = 1; i <= cols; i++){
nc = rs.getString(i); switch (dtn[i]){
if (nc == null) { case "VARCHAR":
nc = "NULL"; nc = rs.getString(i).replace("'","''");
} if (rs.wasNull() || nc == null) {
else { nc = "NULL";
if (rs.wasNull()) { break;
nc = "NULL";
} else {
switch (dtn[i]){
case "VARCHAR":
nc = rs.getString(i).replace("'","''");
if (trim) { nc = nc.trim();}
nc = "'" + nc + "'";
break;
case "CLOB":
nc = rs.getString(i).replace("'","''");
if (trim) { nc = nc.trim();}
nc = "'" + nc + "'";
break;
case "CHAR":
nc = rs.getString(i).replace("'","''");
if (trim) { nc = nc.trim();}
nc = "'" + nc + "'";
break;
case "DATE":
nc = "'" + rs.getString(i) + "'";
if (nc == "'1/1/0001 12:00:00 AM'") {
nc = "NULL";
}
break;
case "TIME":
nc = "'" + rs.getString(i).replace("'","''") + "'";
break;
case "TIMESTAMP":
nc = "'" + rs.getString(i).replace("'","''") + "'";
break;
case "BIGINT":
nc = rs.getString(i);
default:
if (rs.getString(i) != "") {
nc = rs.getString(i);
}
else {
nc = "NULL";
}
break;
} }
} if (trim) { nc = nc.trim();}
nc = "'" + nc + "'";
break;
case "CLOB":
nc = rs.getString(i).replace("'","''");
if (rs.wasNull() || nc == null) {
nc = "NULL";
break;
}
if (trim) { nc = nc.trim();}
nc = "'" + nc + "'";
break;
case "CHAR":
nc = rs.getString(i).replace("'","''");
if (rs.wasNull() || nc == null) {
nc = "NULL";
break;
}
if (trim) { nc = nc.trim();}
nc = "'" + nc + "'";
break;
case "DATE":
nc = "'" + rs.getString(i) + "'";
if (rs.wasNull() || nc == null) {
nc = "NULL";
break;
}
if (nc == "'1/1/0001 12:00:00 AM'") {
nc = "NULL";
}
break;
case "TIME":
nc = "'" + rs.getString(i).replace("'","''") + "'";
if (rs.wasNull() || nc == null) {
nc = "NULL";
break;
}
break;
case "TIMESTAMP":
nc = "'" + rs.getString(i).replace("'","''") + "'";
if (rs.wasNull() || nc == null) {
nc = "NULL";
break;
}
break;
case "BIGINT":
nc = rs.getString(i);
if (rs.wasNull() || nc == null) {
nc = "NULL";
break;
}
default:
nc = rs.getString(i);
if (rs.wasNull() || nc == null) {
nc = "NULL";
break;
}
break;
} }
if (i != 1){ if (i != 1){
nr = nr + ","; nr = nr + ",";