print headers for each section; evaluate null as a potential string object status

This commit is contained in:
Paul Trowbridge 2022-10-24 13:28:26 +00:00
parent ccb1ca589a
commit 54ab5645b1
1 changed files with 12 additions and 6 deletions

View File

@ -118,11 +118,14 @@ public class jrunner {
} }
} }
System.out.println(scu); System.out.println("------------db info---------------------------------------");
System.out.println(scn); System.out.println("source db uri: " + scu);
System.out.println(dcu); System.out.println("source db username: " + scn);
System.out.println(dcn); System.out.println("destination db uri: " + dcu);
System.out.println("destination username: " + dcn);
System.out.println("------------source sql------------------------------------");
System.out.println(sq); System.out.println(sq);
System.out.println("------------destination table-----------------------------");
System.out.println(dt); System.out.println(dt);
//return; //return;
@ -152,8 +155,8 @@ public class jrunner {
e.printStackTrace(); e.printStackTrace();
System.exit(0); System.exit(0);
} }
//----------------------------------------open resultset------------------------------------------------------------ //----------------------------------------open resultset------------------------------------------------------------
System.out.println("issue connecting to desctination:");
try { try {
stmt = scon.createStatement(); stmt = scon.createStatement();
rs = stmt.executeQuery(sq); rs = stmt.executeQuery(sq);
@ -169,6 +172,7 @@ public class jrunner {
//---------------------------------------build meta--------------------------------------------------------------- //---------------------------------------build meta---------------------------------------------------------------
try { try {
cols = rs.getMetaData().getColumnCount(); cols = rs.getMetaData().getColumnCount();
System.out.println("------------source metadata-------------------------------");
System.out.println("number of cols: " + cols); System.out.println("number of cols: " + cols);
getv = new String[cols + 1]; getv = new String[cols + 1];
dtn = new String[cols + 1]; dtn = new String[cols + 1];
@ -185,6 +189,7 @@ public class jrunner {
e.printStackTrace(); e.printStackTrace();
System.exit(0); System.exit(0);
} }
System.out.println("------------row count-------------------------------------");
//-------------------------------build & execute sql------------------------------------------------------------- //-------------------------------build & execute sql-------------------------------------------------------------
try { try {
while (rs.next()) { while (rs.next()) {
@ -193,7 +198,7 @@ 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 (dtn[i] == "DATE" && nc == "null") { if (nc == null) {
nc = "NULL"; nc = "NULL";
} }
else { else {
@ -292,5 +297,6 @@ public class jrunner {
System.out.println("issue closing connections"); System.out.println("issue closing connections");
e.printStackTrace(); e.printStackTrace();
} }
System.out.println("");
} }
} }