public DbsyncTvColumnType(Columnn stl) { this.s = stl; this.Text = s.COULUMN_NAME1; this.typeOfIcon = ColumnIcon; this.Name = this.Text; }
//public override List<string> alterTable(Tablee tabIn) //{ // throw new NotImplementedException(); //} public override List<string> addcolumn(Tablee tabIn, Columnn colIn) { List<string> output = new List<string>(); string nulnotnull; if (colIn.IS_NULLABLE1 == "YES") nulnotnull = "NULL"; else nulnotnull = "NOT NULL"; output.Add("ALTER TABLE " + tabIn.NazovTabulky + " ADD " + colIn.COULUMN_NAME1 + " " + generateType(colIn) + " " + nulnotnull); //zistim ci existuje constrainta na povodnej tabulke if (colIn.COULUMN_DEFAULT1.Length > 0) { string name = "DF_" + tabIn.NazovTabulky + "_" + colIn.COULUMN_NAME1; foreach (Constraintt con in tabIn.Constrainty) { if (con.Constraint_typ == "DEFAULT") { if (con.Column[0] == colIn.COULUMN_NAME1) { //zrusim existujucu constraint output.Add("ALTER TABLE " + tabIn.NazovTabulky + " DROP CONSTRAINT " + con.Constraint_nam); name = con.Constraint_nam; } } } output.Add("ALTER TABLE " + tabIn.NazovTabulky + " ADD CONSTRAINT " + name + " DEFAULT " + colIn.COULUMN_DEFAULT1 + " FOR " + colIn.COULUMN_NAME1); } return output; }
public DbSyncColumnDiff(Columnn columnAin, Columnn columnBin) { ColumnA = columnAin; ColumnB = columnBin; columnAtributesListA = new List<ObjectAtribute>(); columnAtributesListB = new List<ObjectAtribute>(); if (ColumnA == null || ColumnB == null) { if (ColumnA != null) { this.columnName = ColumnA.COULUMN_NAME1; columnAtributesListA.Add(new ObjectAtribute("Name of column", ColumnA.COULUMN_NAME1, true)); columnAtributesListA.Add(new ObjectAtribute("Coulumn default", ColumnA.COULUMN_DEFAULT1, true)); columnAtributesListA.Add(new ObjectAtribute("Datatype", ColumnA.DATA_TYPE1, true)); columnAtributesListA.Add(new ObjectAtribute("Date Time Precision", ColumnA.DATETIME_PRECISION1, true)); //columnAtributesListA.Add(new ObjectAtribute("Character set catalog", ColumnA.CHARACTER_SET_CATALOG1, true)); //columnAtributesListA.Add(new ObjectAtribute("Character set name", ColumnA.CHARACTER_SET_NAME1, true)); //columnAtributesListA.Add(new ObjectAtribute("Character set schema", ColumnA.CHARACTER_SET_SCHEMA1, true)); //columnAtributesListA.Add(new ObjectAtribute("Character max length", ColumnA.CHARACTER_MAXIMUM_LENGTH1, true)); //columnAtributesListA.Add(new ObjectAtribute("Character octet length", ColumnA.CHARACTER_OCTET_LENGTH1, true)); columnAtributesListA.Add(new ObjectAtribute("Is nullable", ColumnA.IS_NULLABLE1, true)); columnAtributesListA.Add(new ObjectAtribute("Numeric precision", ColumnA.NUMERIC_PRECISION1, true)); columnAtributesListA.Add(new ObjectAtribute("Numeric scale", ColumnA.NUMERIC_SCALE1, true)); //columnAtributesListA.Add(new ObjectAtribute("Name of fk Column", ColumnA.FK_NameOFPKCol, true)); //columnAtributesListA.Add(new ObjectAtribute("Name of fk Tab", ColumnA.FK_nameOFPKTab, true)); //columnAtributesListA.Add(new ObjectAtribute("Is forein Key", ColumnA.Is_foreinKey().ToString(), true)); //columnAtributesListA.Add(new ObjectAtribute("Is primary Key", ColumnA.Is_primaryKey().ToString(), true)); //columnAtributesListA.Add(new ObjectAtribute("Name of Fk", ColumnA.Name_of_FK, true)); //columnAtributesListA.Add(new ObjectAtribute("Name of pk", ColumnA.Name_of_PK, true)); } else if (ColumnB != null) { this.columnName = ColumnB.COULUMN_NAME1; columnAtributesListB.Add(new ObjectAtribute("Name of column", ColumnB.COULUMN_NAME1, true)); columnAtributesListB.Add(new ObjectAtribute("Coulumn default", ColumnB.COULUMN_DEFAULT1, true)); columnAtributesListB.Add(new ObjectAtribute("Datatype", ColumnB.DATA_TYPE1, true)); columnAtributesListB.Add(new ObjectAtribute("Date Time Precision", ColumnB.DATETIME_PRECISION1, true)); //columnAtributesListB.Add(new ObjectAtribute("Character set catalog", ColumnB.CHARACTER_SET_CATALOG1, true)); //columnAtributesListB.Add(new ObjectAtribute("Character set name", ColumnB.CHARACTER_SET_NAME1, true)); //columnAtributesListB.Add(new ObjectAtribute("Character set schema", ColumnB.CHARACTER_SET_SCHEMA1, true)); //columnAtributesListB.Add(new ObjectAtribute("Character max length", ColumnB.CHARACTER_MAXIMUM_LENGTH1, true)); //columnAtributesListB.Add(new ObjectAtribute("Character octet length", ColumnB.CHARACTER_OCTET_LENGTH1, true)); columnAtributesListB.Add(new ObjectAtribute("Is nullable", ColumnB.IS_NULLABLE1, true)); columnAtributesListB.Add(new ObjectAtribute("Numeric precision", ColumnB.NUMERIC_PRECISION1, true)); columnAtributesListB.Add(new ObjectAtribute("Numeric scale", ColumnB.NUMERIC_SCALE1, true)); //columnAtributesListB.Add(new ObjectAtribute("Name of fk Column", ColumnB.FK_NameOFPKCol, true)); //columnAtributesListB.Add(new ObjectAtribute("Name of fk Tab", ColumnB.FK_nameOFPKTab, true)); //columnAtributesListB.Add(new ObjectAtribute("Is forein Key", ColumnB.Is_foreinKey().ToString(), true)); //columnAtributesListB.Add(new ObjectAtribute("Is primary Key", ColumnB.Is_primaryKey().ToString(), true)); //columnAtributesListB.Add(new ObjectAtribute("Name of Fk", ColumnB.Name_of_FK, true)); //columnAtributesListB.Add(new ObjectAtribute("Name of pk", ColumnB.Name_of_PK, true)); } else this.columnName = "UNDEFINED"; } if (ColumnA != null && ColumnB != null) { this.columnName = ColumnA.COULUMN_NAME1; if (ColumnA.COULUMN_DEFAULT1 != ColumnB.COULUMN_DEFAULT1) diffColumnDefault = true; if (ColumnA.COULUMN_NAME1 != ColumnB.COULUMN_NAME1) diffColumnName = true; if (ColumnA.DATA_TYPE1 != ColumnB.DATA_TYPE1) diffDatatype = true; if (ColumnA.DATETIME_PRECISION1 != ColumnB.DATETIME_PRECISION1) diffDatetimePrecision = true; //if (ColumnA.FK_NameOFPKCol != ColumnB.FK_NameOFPKCol) diffFkNameOfPkCol = true; //if (ColumnA.FK_nameOFPKTab != ColumnB.FK_nameOFPKTab) diffFkNameOfPKTab = true; if (ColumnA.CHARACTER_MAXIMUM_LENGTH1 != ColumnB.CHARACTER_MAXIMUM_LENGTH1) diffCharMaxLength = true; //if (ColumnA.CHARACTER_OCTET_LENGTH1 != ColumnB.CHARACTER_OCTET_LENGTH1) diffCharOctetLength = true; //if (ColumnA.CHARACTER_SET_CATALOG1 != ColumnB.CHARACTER_SET_CATALOG1) diffCharacterSetCatalog = true; //if (ColumnA.CHARACTER_SET_NAME1 != ColumnB.CHARACTER_SET_NAME1) diffCharacterSetName = true; //if (ColumnA.CHARACTER_SET_SCHEMA1 != ColumnB.CHARACTER_SET_SCHEMA1) diffCharacterSetSchema = true; if (ColumnA.IS_NULLABLE1 != ColumnB.IS_NULLABLE1) diffIsNullable = true; //if (ColumnA.Name_of_FK != ColumnB.Name_of_FK) diffNameOfFK = true; //if (ColumnA.Name_of_PK != ColumnB.Name_of_PK) diffNameOfPk = true; //if (ColumnA.NazovStlpca != ColumnB.NazovStlpca) diffNameOfColumn = true; //if (ColumnA.NUMERIC_PRECISION_RADIX1 != ColumnB.NUMERIC_PRECISION_RADIX1) diffNumericPRecisionRadix = true; if (ColumnA.NUMERIC_PRECISION1 != ColumnB.NUMERIC_PRECISION1) diffNumericPrecision = true; if (ColumnA.NUMERIC_SCALE1 != ColumnB.NUMERIC_SCALE1) diffNumericScale = true; // if (ColumnA.ORDINAL_POSITION1 != ColumnB.ORDINAL_POSITION1) diffOrdinalPosition = true; //if (ColumnA.TABLE_NAME1 != ColumnB.TABLE_NAME1) diffTableName = true; //if (ColumnA.Is_foreinKey() != ColumnB.Is_foreinKey()) diffIsForeinKey = true; //if (ColumnA.Is_primaryKey() != ColumnB.Is_primaryKey()) diffIsPrimarykey = true; if (diffColumnDefault || diffColumnName || diffDatatype || diffDatetimePrecision || diffFkNameOfPkCol || diffFkNameOfPKTab || diffCharacterSetCatalog || diffCharacterSetName || diffCharacterSetSchema || diffCharMaxLength || diffCharOctetLength || diffIsForeinKey || diffIsNullable || diffIsPrimarykey || diffNameOfColumn || diffNameOfFK || diffNameOfPk || diffNumericPrecision || diffNumericScale ) different = true; else different = false; //naplnenie zoznamu atributov pre potreby zobrazovania ObjectAtribute columnNameOA = new ObjectAtribute("Name of column", columnName, false); columnAtributesListA.Add(columnNameOA); columnAtributesListB.Add(columnNameOA); if (diffColumnDefault) { ObjectAtribute cDefaultA = new ObjectAtribute("Coulumn default ", ColumnA.COULUMN_DEFAULT1, true); columnAtributesListA.Add(cDefaultA); ObjectAtribute cDefaultB = new ObjectAtribute("Coulumn default ", ColumnB.COULUMN_DEFAULT1, true); columnAtributesListB.Add(cDefaultB); } else { ObjectAtribute cDefault = new ObjectAtribute("Coulumn default ", ColumnA.COULUMN_DEFAULT1, false); columnAtributesListA.Add(cDefault); columnAtributesListB.Add(cDefault); } if (diffDatatype) { ObjectAtribute cDatatypeA = new ObjectAtribute("Datatype ", ColumnA.DATA_TYPE1, true); columnAtributesListA.Add(cDatatypeA); ObjectAtribute cDatatypeB = new ObjectAtribute("Datatype ", ColumnB.DATA_TYPE1, true); columnAtributesListB.Add(cDatatypeB); } else { ObjectAtribute cDatatype = new ObjectAtribute("Datatype ", ColumnA.DATA_TYPE1, false); columnAtributesListA.Add(cDatatype); columnAtributesListB.Add(cDatatype); } if (diffDatetimePrecision) { ObjectAtribute cDateTimePrecisionA = new ObjectAtribute("Date Time Precision ", ColumnA.DATETIME_PRECISION1, true); columnAtributesListA.Add(cDateTimePrecisionA); ObjectAtribute cDateTimePrecisionB = new ObjectAtribute("Date Time Precision ", ColumnB.DATETIME_PRECISION1, true); columnAtributesListB.Add(cDateTimePrecisionB); } else { ObjectAtribute cDateTimePrecision = new ObjectAtribute("Date Time Precision ", ColumnA.DATETIME_PRECISION1, false); columnAtributesListA.Add(cDateTimePrecision); columnAtributesListB.Add(cDateTimePrecision); } //if (diffCharacterSetCatalog) //{ // ObjectAtribute cCheracterSetCatA = new ObjectAtribute("Character set catalog ", ColumnA.CHARACTER_SET_CATALOG1, true); // columnAtributesListA.Add(cCheracterSetCatA); // ObjectAtribute cCheracterSetCatB = new ObjectAtribute("Character set catalog ", ColumnB.CHARACTER_SET_CATALOG1, true); // columnAtributesListB.Add(cCheracterSetCatB); //} //else //{ // ObjectAtribute cCheracterSetCat = new ObjectAtribute("Character set catalog ", ColumnA.CHARACTER_SET_CATALOG1, false); // columnAtributesListA.Add(cCheracterSetCat); // columnAtributesListB.Add(cCheracterSetCat); //} //if (diffCharacterSetName) //{ // ObjectAtribute cCharacterSetNameA = new ObjectAtribute("Character set name ", ColumnA.CHARACTER_SET_NAME1, true); // columnAtributesListA.Add(cCharacterSetNameA); // ObjectAtribute cCharacterSetNameB = new ObjectAtribute("Character set name", ColumnB.CHARACTER_SET_NAME1, true); // columnAtributesListB.Add(cCharacterSetNameB); //} //else //{ // ObjectAtribute cCheracterSetCat = new ObjectAtribute("Character set name ", ColumnA.CHARACTER_SET_NAME1, false); // columnAtributesListA.Add(cCheracterSetCat); // columnAtributesListB.Add(cCheracterSetCat); //} //if (diffCharacterSetSchema) //{ // ObjectAtribute cCharacterSetSchemaA = new ObjectAtribute("Character set schema ", ColumnA.CHARACTER_SET_SCHEMA1, true); // columnAtributesListA.Add(cCharacterSetSchemaA); // ObjectAtribute cCharacterSetSchemaB = new ObjectAtribute("Character set schema", ColumnB.CHARACTER_SET_SCHEMA1, true); // columnAtributesListB.Add(cCharacterSetSchemaB); //} //else //{ // ObjectAtribute cCharacterSetSchema = new ObjectAtribute("Character set schema", ColumnA.CHARACTER_SET_SCHEMA1, false); // columnAtributesListA.Add(cCharacterSetSchema); // columnAtributesListB.Add(cCharacterSetSchema); //} if (diffCharMaxLength) { ObjectAtribute cCharacterMaxLEngthA = new ObjectAtribute("Character max length ", ColumnA.CHARACTER_MAXIMUM_LENGTH1, true); columnAtributesListA.Add(cCharacterMaxLEngthA); ObjectAtribute cCharacterMaxLEngthB = new ObjectAtribute("Character max length ", ColumnB.CHARACTER_MAXIMUM_LENGTH1, true); columnAtributesListB.Add(cCharacterMaxLEngthB); } else { ObjectAtribute cCharacterMaxLEngth = new ObjectAtribute("Character max length ", ColumnA.CHARACTER_MAXIMUM_LENGTH1, false); columnAtributesListA.Add(cCharacterMaxLEngth); columnAtributesListB.Add(cCharacterMaxLEngth); } // if (diffCharOctetLength) //{ // ObjectAtribute cCharacterOctetLEngthA = new ObjectAtribute("Character octet length ", ColumnA.CHARACTER_OCTET_LENGTH1, true); // columnAtributesListA.Add(cCharacterOctetLEngthA); // ObjectAtribute cCharacterOctetLEngthB = new ObjectAtribute("Character octet length ", ColumnB.CHARACTER_OCTET_LENGTH1, true); // columnAtributesListB.Add(cCharacterOctetLEngthB); //} //else //{ // ObjectAtribute cCharacterOctetLEngth = new ObjectAtribute("Character octet length ", ColumnA.CHARACTER_OCTET_LENGTH1, false); // columnAtributesListA.Add(cCharacterOctetLEngth); // columnAtributesListB.Add(cCharacterOctetLEngth); //} if (diffIsNullable) { ObjectAtribute cIsNullableA = new ObjectAtribute("Is nullable ", ColumnA.IS_NULLABLE1, true); columnAtributesListA.Add(cIsNullableA); ObjectAtribute cIsNullableB = new ObjectAtribute("Is nullable ", ColumnB.IS_NULLABLE1, true); columnAtributesListB.Add(cIsNullableB); } else { ObjectAtribute cIsNullable = new ObjectAtribute("Is nullable", ColumnA.IS_NULLABLE1, false); columnAtributesListA.Add(cIsNullable); columnAtributesListB.Add(cIsNullable); } if (diffNumericPrecision) { ObjectAtribute cNumericPrecisionA = new ObjectAtribute("Numeric precision ", ColumnA.NUMERIC_PRECISION1, true); columnAtributesListA.Add(cNumericPrecisionA); ObjectAtribute cNumericPrecisionB = new ObjectAtribute("Numeric precision ", ColumnB.NUMERIC_PRECISION1, true); columnAtributesListB.Add(cNumericPrecisionB); } else { ObjectAtribute cNumericPrecision = new ObjectAtribute("Numeric precision ", ColumnA.NUMERIC_PRECISION1, false); columnAtributesListA.Add(cNumericPrecision); columnAtributesListB.Add(cNumericPrecision); } if (diffNumericScale) { ObjectAtribute cNumericScaleA = new ObjectAtribute("Numeric scale ", ColumnA.NUMERIC_SCALE1, true); columnAtributesListA.Add(cNumericScaleA); ObjectAtribute cNumericScaleB = new ObjectAtribute("Numeric scale", ColumnB.NUMERIC_SCALE1, true); columnAtributesListB.Add(cNumericScaleB); } else { ObjectAtribute cNumericScale = new ObjectAtribute("Numeric scale", ColumnA.NUMERIC_SCALE1, false); columnAtributesListA.Add(cNumericScale); columnAtributesListB.Add(cNumericScale); } //if (diffFkNameOfPkCol) //{ // ObjectAtribute cNameOfPkColA = new ObjectAtribute("Name of fk Column ", ColumnA.FK_NameOFPKCol, true); // columnAtributesListA.Add(cNameOfPkColA); // ObjectAtribute cNameOfPkColB = new ObjectAtribute("Name of fk Column ", ColumnB.FK_NameOFPKCol, true); // columnAtributesListB.Add(cNameOfPkColB); //} //else //{ // ObjectAtribute cNameOfPkCol = new ObjectAtribute("Name of fk Column ", ColumnA.FK_NameOFPKCol, false); // columnAtributesListA.Add(cNameOfPkCol); // columnAtributesListB.Add(cNameOfPkCol); //} //if (diffFkNameOfPKTab) //{ // ObjectAtribute cNameOfPkTabA = new ObjectAtribute("Name of fk Tab ", ColumnA.FK_nameOFPKTab, true); // columnAtributesListA.Add(cNameOfPkTabA); // ObjectAtribute cNameOfPkTabB = new ObjectAtribute("Name of fk Tab ", ColumnB.FK_nameOFPKTab, true); // columnAtributesListB.Add(cNameOfPkTabB); //} //else //{ // ObjectAtribute cNameOfPkTab = new ObjectAtribute("Name of fk Tab ", ColumnA.FK_nameOFPKTab, false); // columnAtributesListA.Add(cNameOfPkTab); // columnAtributesListB.Add(cNameOfPkTab); //} //if (diffIsForeinKey) //{ // ObjectAtribute cIsForeinKeyA = new ObjectAtribute("Is forein Key ", ColumnA.Is_foreinKey().ToString(), true); // columnAtributesListA.Add(cIsForeinKeyA); // ObjectAtribute cIsForeinKeyB = new ObjectAtribute("Is forein Key ", ColumnB.Is_foreinKey().ToString(), true); // columnAtributesListB.Add(cIsForeinKeyB); //} //else //{ // ObjectAtribute cIsForeinKey = new ObjectAtribute("Is forein Key ", ColumnA.Is_foreinKey().ToString(), false); // columnAtributesListA.Add(cIsForeinKey); // columnAtributesListB.Add(cIsForeinKey); //} //if (diffIsPrimarykey) //{ // ObjectAtribute cIsPrimaryKeyA = new ObjectAtribute("Is primary Key ", ColumnA.Is_primaryKey().ToString(), true); // columnAtributesListA.Add(cIsPrimaryKeyA); // ObjectAtribute cIsPrimaryKeyB = new ObjectAtribute("Is primary Key ", ColumnB.Is_primaryKey().ToString(), true); // columnAtributesListB.Add(cIsPrimaryKeyB); //} //else //{ // ObjectAtribute cIsPrimaryKey = new ObjectAtribute("Is primary Key ", ColumnA.Is_primaryKey().ToString(), false); // columnAtributesListA.Add(cIsPrimaryKey); // columnAtributesListB.Add(cIsPrimaryKey); //} //if (diffNameOfFK) //{ // ObjectAtribute cNameOfFkA = new ObjectAtribute("Name of Fk ", ColumnA.Name_of_FK, true); // columnAtributesListA.Add(cNameOfFkA); // ObjectAtribute cNameOfFkB = new ObjectAtribute("Name of Fk ", ColumnB.Name_of_FK, true); // columnAtributesListB.Add(cNameOfFkB); //} //else //{ // ObjectAtribute cNameOfFk = new ObjectAtribute("Name of Fk ", ColumnA.Name_of_FK, false); // columnAtributesListA.Add(cNameOfFk); // columnAtributesListB.Add(cNameOfFk); //} //if (diffNameOfPk) //{ // ObjectAtribute cNameOfPkA = new ObjectAtribute("Name of pk ", ColumnA.Name_of_PK, true); // columnAtributesListA.Add(cNameOfPkA); // ObjectAtribute cNameOfPkB = new ObjectAtribute("Name of pk ", ColumnB.Name_of_PK, true); // columnAtributesListB.Add(cNameOfPkB); //} //else //{ // ObjectAtribute cNameOfPk = new ObjectAtribute("Name of pk ", ColumnA.Name_of_PK, false); // columnAtributesListA.Add(cNameOfPk); // columnAtributesListB.Add(cNameOfPk); //} } else different = true; }
public abstract List<string> removeColumn(Tablee tabIn, Columnn colIn);
public abstract List<string> alterColumn(Tablee tabIn, Columnn colIn);
public override List<string> removeColumn(Tablee tabIn, Columnn colIn) { List<string> output = new List<string>(); output.Add("ALTER TABLE " + tabIn.NazovTabulky + " DROP COLUMN " + colIn.COULUMN_NAME1 ); return output; }
private void readColumnsForTab(Tablee tab) { SqlCommand com = pripojenie.CreateCommand(); com.CommandText = "select * from information_schema.columns where table_name=@param"; com.Parameters.Add("@param", SqlDbType.VarChar); com.Parameters["@param"].Value = tab.NazovTabulky; SqlDataReader red = com.ExecuteReader(); while (red.Read()) { Columnn st = new Columnn(); //st.NazovStlpca = red["COLUMN_NAME"].ToString(); st.COULUMN_DEFAULT1 = red["COLUMN_DEFAULT"].ToString(); // uprava coulumn default st.COULUMN_DEFAULT1 = removeParentesis(st.COULUMN_DEFAULT1); st.COULUMN_NAME1 = red["COLUMN_NAME"].ToString(); st.DATA_TYPE1 = red["DATA_TYPE"].ToString(); st.DATETIME_PRECISION1 = red["DATETIME_PRECISION"].ToString(); st.CHARACTER_MAXIMUM_LENGTH1 = red["CHARACTER_MAXIMUM_LENGTH"].ToString(); //st.CHARACTER_OCTET_LENGTH1 = red["CHARACTER_OCTET_LENGTH"].ToString(); //st.CHARACTER_SET_CATALOG1 = red["CHARACTER_SET_CATALOG"].ToString(); //st.CHARACTER_SET_NAME1 = red["CHARACTER_SET_NAME"].ToString(); //st.CHARACTER_SET_SCHEMA1 = red["CHARACTER_SET_SCHEMA"].ToString(); st.IS_NULLABLE1 = red["IS_NULLABLE"].ToString(); //st.NUMERIC_PRECISION_RADIX1 = red["NUMERIC_PRECISION_RADIX"].ToString(); st.NUMERIC_PRECISION1 = red["NUMERIC_PRECISION"].ToString(); st.NUMERIC_SCALE1 = red["NUMERIC_SCALE"].ToString(); tab.Stlpce.Add(st); } red.Close(); }
//private string addPrimaryKey(Columnn col) //{ // string output = ""; // if (col.Is_primaryKey()) output = " PRIMARY KEY " ; // return output; //} private string generateType(Columnn col) { string output= ""; int typeofgen = 0; switch (col.DATA_TYPE1) { case "bigint": typeofgen = 1; break; case "binary": typeofgen = 2; break; case "bit": typeofgen = 1; break; case "char": typeofgen = 2; break; case "date": typeofgen = 1; break; case "datetime2": typeofgen = 3; break; case "datetimeoffset": typeofgen = 3; break; case "decimal": typeofgen = 4; break; case "float": typeofgen = 1; break; case "geography": typeofgen = 1; break; case "geometry": typeofgen = 1; break; case "hierarchyid": typeofgen = 1; break; case "image": typeofgen = 1; break; case "int": typeofgen = 1; break; case "money": typeofgen = 1; break; case "nchar": typeofgen = 2; break; case "ntext": typeofgen = 1; break; case "numeric": typeofgen = 4; break; case "nvarchar": typeofgen = 2; break; case "real": typeofgen = 1; break; case "smalldatetime": typeofgen = 1; break; case "smallint": typeofgen = 1; break; case "smallmoney": typeofgen = 1; break; case "sql_variant": typeofgen = 1; break; case "text": typeofgen = 1; break; case "time": typeofgen = 3; break; case "tinyint": typeofgen = 1; break; case "uniqueidentifier": typeofgen = 1; break; case "varbinary": typeofgen = 2; break; case "varchar": typeofgen = 2; break; default: break; } if (typeofgen == 0) { output = col.DATA_TYPE1; } if (typeofgen == 1) { output = col.DATA_TYPE1; } if (typeofgen == 2) { output = col.DATA_TYPE1 + "(" + col.CHARACTER_MAXIMUM_LENGTH1 + ") "; } if (typeofgen == 3) { output = col.DATA_TYPE1 + "(" + col.DATETIME_PRECISION1 + ") "; } if (typeofgen == 4) { output = col.DATA_TYPE1 + "(" + col.NUMERIC_PRECISION1 +","+col.NUMERIC_SCALE1+ ") "; } return output; }
private string addDefault(Columnn col) { string output = ""; if (col.COULUMN_DEFAULT1.Length > 0) output = " DEFAULT " + col.COULUMN_DEFAULT1; return output; }
public override List<string> alterColumn(Tablee tabIn, Columnn colIn) { throw new NotImplementedException(); }