internal BindDeclaration(Field field) : this(field, null) { }
internal BindDeclaration(Field field, IDictionary extendedProperties) : base(extendedProperties) { this.field = field; ParsePattern(); }
internal BindInstance(Field field) : this(field, null) { }
internal BindInstance(Field field, IDictionary extendedProperties) : base(extendedProperties) { this.field = field; ParsePattern(); }
private static void SetOledbType(Field field, object[] rowdata) { string tname = (string)rowdata[SCHEMA_COLUMN_NAME]; OleDbType type = (OleDbType)rowdata[SCHEMA_DATA_TYPE]; switch(type) { case OleDbType.BigInt: field.Type = Pattern.GetDBType("BIGINT"); break; case OleDbType.SmallInt: field.Type = Pattern.GetDBType("SMALLINT"); break; case OleDbType.Integer: field.Type = Pattern.GetDBType("INT"); break; case OleDbType.Char: long charLen = (long)rowdata[SCHEMA_CHARACTER_MAXIMUM_LENGTH]; if(charLen < 51) { field.Type = Pattern.GetDBType("CHAR"); } else if (charLen < 256) { field.Type = Pattern.GetDBType("VARCHAR"); } else { field.Type = Pattern.GetDBType("TEXT"); } field.CharLength = charLen; break; case OleDbType.Numeric: int precision = (int)rowdata[SCHEMA_NUMERIC_PRECISION]; short scale = (short)rowdata[SCHEMA_NUMERIC_SCALE]; field.Type = Pattern.GetDBType("DECIMAL"); field.NumericPrecision = precision; field.NumericScale = scale; break; case OleDbType.DBDate: case OleDbType.DBTime: case OleDbType.DBTimeStamp: field.Type = Pattern.GetDBType("DATETIME"); break; default: break; } }
public static FieldArray GetTableFields_old(string tablename) { using(SqlConnection cnn = new SqlConnection(Configuracion.valor("DSNBD"))) { SqlCommand comm = new SqlCommand(); DataTable dtt; comm.CommandText = "SELECT TOP 0 * FROM " + tablename + " FOR XML AUTO, XMLDATA"; comm.Connection = cnn; comm.CommandType = CommandType.Text; cnn.Open(); XmlReader xr = comm.ExecuteXmlReader(); DataSet ds = new DataSet(); ds.ReadXml(xr); dtt = ds.Tables[0]; FieldArray ret = new FieldArray(); foreach(DataColumn dtc in dtt.Columns) { TypeEntry te = Pattern.GetBaseType(dtc.DataType.Name); if(te != null) { Field fld = new Field(); fld.Name = dtc.ColumnName; fld.Type = te; ret.Add(fld); } } cnn.Close(); return ret; } }
public static FieldArray GetTableFields(string tablename) { using(OleDbConnection cnn = new OleDbConnection("Provider=SQLOLEDB;" + Configuracion.valor("DSNBD"))) { string[] strcnn = Configuracion.valor("DSNBD").Split(';'); string catalog = null; foreach(string str in strcnn) { string[] subs = str.Split('='); if(subs[0].ToLower() == "initial catalog") { catalog = subs[1]; break; } } FieldArray ret = new FieldArray(); cnn.Open(); DataTable tbl = cnn.GetOleDbSchemaTable(OleDbSchemaGuid.Columns,new object[]{ catalog, "dbo", tablename }); foreach(DataRow row in tbl.Rows) { Field fld = new Field(); SetOledbType(fld, row.ItemArray); if(fld.Type != null) { fld.Name = (string)row.ItemArray[SCHEMA_COLUMN_NAME]; fld.Nullable = (bool)row.ItemArray[SCHEMA_IS_NULLABLE]; ret.Add(fld); } } cnn.Close(); return ret; } }
internal BindProperty(Field field) : this(field, null) { }
public int Add(Field item) { return base.Add(item); }