extract types to array before switching

This commit is contained in:
Paul Trowbridge 2018-08-21 15:56:54 -04:00
parent 0cbee068f4
commit 9a99c08f21

View File

@ -23,7 +23,7 @@ namespace test
string nl = Environment.NewLine; string nl = Environment.NewLine;
string msg = "Help:"; string msg = "Help:";
msg = msg + nl + "version 0.14"; msg = msg + nl + "version 0.15";
msg = msg + nl + "-scs source connection string"; msg = msg + nl + "-scs source connection string";
msg = msg + nl + "-dcs destination connection string"; msg = msg + nl + "-dcs destination connection string";
msg = msg + nl + "-sq path to source query"; msg = msg + nl + "-sq path to source query";
@ -120,9 +120,16 @@ namespace test
r = r + 1; r = r + 1;
t = t +1 ; t = t +1 ;
nr = ""; nr = "";
var dtn = new string[ibmdr.FieldCount];
//populate all the data type names into a string array instead of calling against ibmdr in every iteration
if (t ==1 ) {
for (int i = 0; i <= ibmdr.GetValues(getv); i++){
dtn[i] = ibmdr.GetDataTypeName(i);
}
}
for ( int i = 0 ; i < ibmdr.GetValues(getv);i++) { for ( int i = 0 ; i < ibmdr.GetValues(getv);i++) {
if (getv[i] != null) { if (getv[i] != null) {
switch (ibmdr.GetDataTypeName(i)){ switch (dtn[i]){
case "VARCHAR": case "VARCHAR":
nc = "'" + getv[i].ToString().Replace("'","''") + "'"; nc = "'" + getv[i].ToString().Replace("'","''") + "'";
break; break;