From 9a99c08f2102e30694aec29b9c942dbc5ee16b89 Mon Sep 17 00:00:00 2001 From: Paul Trowbridge Date: Tue, 21 Aug 2018 15:56:54 -0400 Subject: [PATCH] extract types to array before switching --- runner.cs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/runner.cs b/runner.cs index d24aa38..bce1b27 100644 --- a/runner.cs +++ b/runner.cs @@ -23,7 +23,7 @@ namespace test string nl = Environment.NewLine; 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 + "-dcs destination connection string"; msg = msg + nl + "-sq path to source query"; @@ -120,9 +120,16 @@ namespace test r = r + 1; t = t +1 ; 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++) { if (getv[i] != null) { - switch (ibmdr.GetDataTypeName(i)){ + switch (dtn[i]){ case "VARCHAR": nc = "'" + getv[i].ToString().Replace("'","''") + "'"; break;