public MSSQLToNetezzaDataCopy(MSSQLDataUtils sourceDataUtils, NetezzaDataUtils destDataUtils, Logger logger, string nzServer, string nzUser, string nzPrivateKeyPath)
 {
     this.sourceDataUtils  = sourceDataUtils;
     this.destDataUtils    = destDataUtils;
     this.logger           = logger;
     this.nzServer         = nzServer;
     this.nzUser           = nzUser;
     this.nzPrivateKeyPath = nzPrivateKeyPath;
 }
        private List <Col> GetColumns(string sourceDB, string sourceTableName, string schema, string originalTableName)
        {
            //get actual field list on the source table
            var includeColumns = new List <string>()
            {
                "SYS_CHANGE_VERSION", "SYS_CHANGE_OPERATION"
            };
            var columns = sourceDataUtils.GetFieldList(sourceDB, sourceTableName, schema, originalTableName, includeColumns);
            //get the table config object
            var table = Config.TableByName(originalTableName);

            var cols = new List <Col>();

            foreach (TColumn col in columns)
            {
                string typeName = col.dataType.BaseType;

                ColumnModifier mod = null;
                //see if there are any column modifiers which override our length defaults
                ColumnModifier[] modifiers = table.ColumnModifiers;
                if (modifiers != null)
                {
                    IEnumerable <ColumnModifier> mods = modifiers.Where(c => ((c.columnName == col.name) && (c.type == "ShortenField")));
                    mod = mods.FirstOrDefault();
                }

                string modDataType = DataType.MapDataType(SqlFlavor.MSSQL, SqlFlavor.Netezza, typeName);
                if (typeName != modDataType)
                {
                    if (mod != null && Regex.IsMatch(modDataType, @".*\(\d+\)$"))
                    {
                        modDataType = Regex.Replace(modDataType, @"\d+", mod.length.ToString());
                    }
                    cols.Add(new Col(NetezzaDataUtils.MapReservedWord(col.name), modDataType, col.dataType));
                    continue;
                }

                if (col.dataType.UsesMaxLength())
                {
                    if (mod != null)
                    {
                        typeName += "(" + mod.length + ")";
                    }
                    else if (Config.NetezzaStringLength > 0)
                    {
                        typeName += "(" + ((col.dataType.CharacterMaximumLength > Config.NetezzaStringLength ||
                                            col.dataType.CharacterMaximumLength < 1) ? Config.NetezzaStringLength : col.dataType.CharacterMaximumLength) + ")";
                    }
                    else
                    {
                        typeName += "(" + (col.dataType.CharacterMaximumLength > 0 ? col.dataType.CharacterMaximumLength : 16000) + ")";
                    }
                }
                else if (col.dataType.UsesPrecisionScale())
                {
                    typeName += "(" + col.dataType.NumericPrecision + "," + col.dataType.NumericScale + ")";
                }
                cols.Add(new Col(NetezzaDataUtils.MapReservedWord(col.name), typeName, col.dataType));
            }
            return(cols);
        }