static public Dictionary <string, MySqlParameter> GetParameters(Guid dataID, esProviderSpecificMetadata providerMetadata, esColumnMetadataCollection columns) { lock (parameterCache) { if (!parameterCache.ContainsKey(dataID)) { // The Parameters for this Table haven't been cached yet, this is a one time operation Dictionary <string, MySqlParameter> types = new Dictionary <string, MySqlParameter>(); MySqlParameter param1; foreach (esColumnMetadata col in columns) { esTypeMap typeMap = providerMetadata.GetTypeMap(col.PropertyName); if (typeMap != null) { string nativeType = typeMap.NativeType; MySqlDbType dbType = Cache.NativeTypeToDbType(nativeType); param1 = new MySqlParameter(Delimiters.Param + col.PropertyName, dbType, 0, col.Name); param1.SourceColumn = col.Name; switch (dbType) { case MySqlDbType.Decimal: case MySqlDbType.NewDecimal: case MySqlDbType.Double: case MySqlDbType.Float: case MySqlDbType.Int16: case MySqlDbType.Int24: case MySqlDbType.Int32: case MySqlDbType.Int64: case MySqlDbType.UInt16: case MySqlDbType.UInt24: case MySqlDbType.UInt32: case MySqlDbType.UInt64: param1.Size = (int)col.CharacterMaxLength; param1.Precision = (byte)col.NumericPrecision; param1.Scale = (byte)col.NumericScale; break; case MySqlDbType.String: case MySqlDbType.VarString: case MySqlDbType.VarChar: param1.Size = (int)col.CharacterMaxLength; break; } types[col.Name] = param1; } } parameterCache[dataID] = types; } } return(parameterCache[dataID]); }
static public Dictionary <string, SqlCeParameter> GetParameters(Guid dataID, esProviderSpecificMetadata providerMetadata, esColumnMetadataCollection columns) { lock (parameterCache) { if (!parameterCache.ContainsKey(dataID)) { // The Parameters for this Table haven't been cached yet, this is a one time operation Dictionary <string, SqlCeParameter> types = new Dictionary <string, SqlCeParameter>(); SqlCeParameter param1; foreach (esColumnMetadata col in columns) { esTypeMap typeMap = providerMetadata.GetTypeMap(col.PropertyName); if (typeMap != null) { string nativeType = typeMap.NativeType; SqlDbType dbType = Cache.NativeTypeToDbType(nativeType); param1 = new SqlCeParameter(Delimiters.Param + col.PropertyName, dbType, 0, col.Name); param1.SourceColumn = col.Name; switch (dbType) { case SqlDbType.Decimal: param1.Precision = (byte)col.NumericPrecision; param1.Scale = (byte)col.NumericScale; break; case SqlDbType.DateTime: param1.Precision = 23; param1.Scale = 3; break; case SqlDbType.SmallDateTime: param1.Precision = 16; break; } types[col.Name] = param1; } } parameterCache[dataID] = types; } } return(parameterCache[dataID]); }
public void WriteMetadata() { esProviderSpecificMetadata spec = this.Meta.GetProviderMetadata("esDefault"); foreach (esColumnMetadata col in this.Meta.Columns) { Console.WriteLine("PropertyName: " + col.PropertyName); Console.WriteLine("ColumnName : " + col.Name); Console.WriteLine("CharLength : " + col.CharacterMaxLength.ToString()); esTypeMap map = spec.GetTypeMap(col.Name); Console.WriteLine("Native Type : " + map.NativeType); Console.WriteLine("System Type : " + map.SystemType); Console.WriteLine("---------------------------------"); } }
static public Dictionary <string, VistaDBParameter> GetParameters(Guid dataID, esProviderSpecificMetadata providerMetadata, esColumnMetadataCollection columns) { lock (parameterCache) { if (!parameterCache.ContainsKey(dataID)) { // The Parameters for this Table haven't been cached yet, this is a one time operation Dictionary <string, VistaDBParameter> types = new Dictionary <string, VistaDBParameter>(); VistaDBParameter param1; foreach (esColumnMetadata col in columns) { esTypeMap typeMap = providerMetadata.GetTypeMap(col.PropertyName); if (typeMap != null) { string nativeType = typeMap.NativeType; VistaDBType dbType = Cache.NativeTypeToDbType(nativeType); param1 = new VistaDBParameter(Delimiters.Param + col.PropertyName, dbType, 0, col.Name); param1.SourceColumn = col.Name; switch (dbType) { case VistaDBType.BigInt: case VistaDBType.Int: case VistaDBType.SmallInt: case VistaDBType.Decimal: case VistaDBType.Float: case VistaDBType.Money: case VistaDBType.SmallMoney: param1.Size = (int)col.CharacterMaxLength; break; } types[col.Name] = param1; } } parameterCache[dataID] = types; } } return(parameterCache[dataID]); }
static public Dictionary <string, EfzParameter> GetParameters(Guid dataID, esProviderSpecificMetadata providerMetadata, esColumnMetadataCollection columns) { lock (parameterCache) { if (!parameterCache.ContainsKey(dataID)) { // The Parameters for this Table haven't been cached yet, this is a one time operation Dictionary <string, EfzParameter> types = new Dictionary <string, EfzParameter>(); EfzParameter param1; foreach (esColumnMetadata col in columns) { esTypeMap typeMap = providerMetadata.GetTypeMap(col.PropertyName); if (typeMap != null) { string nativeType = typeMap.NativeType; EfzType dbType = Cache.NativeTypeToDbType(nativeType); param1 = new EfzParameter(Delimiters.Param + col.PropertyName, dbType, col.PropertyName); param1.SourceColumn = col.Name; switch (dbType) { // TODO: //case SqlDbType.BigInt: //case SqlDbType.Decimal: //case SqlDbType.Float: //case SqlDbType.Int: //case SqlDbType.Money: //case SqlDbType.Real: //case SqlDbType.SmallMoney: //case SqlDbType.TinyInt: //case SqlDbType.SmallInt: // param1.Size = (int)col.CharacterMaxLength; // param1.Precision = (byte)col.NumericPrecision; // param1.Scale = (byte)col.NumericScale; // break; //case SqlDbType.DateTime: // param1.Precision = 23; // param1.Scale = 3; // break; //case SqlDbType.SmallDateTime: // param1.Precision = 16; // break; //case SqlDbType.Udt: // SetUdtTypeNameToAvoidMonoError(param1, typeMap); // break; } types[col.Name] = param1; } } parameterCache[dataID] = types; } } return(parameterCache[dataID]); }