GetTypeMap() public method

public GetTypeMap ( string columnName ) : tgTypeMap
columnName string
return tgTypeMap
Ejemplo n.º 1
0
        public static Dictionary<string, MySqlParameter> GetParameters(Guid dataID,
            tgProviderSpecificMetadata providerMetadata, tgColumnMetadataCollection 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 (tgColumnMetadata col in columns)
                    {
                        tgTypeMap 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];
        }
Ejemplo n.º 2
0
        public static Dictionary<string, SqlCeParameter> GetParameters(Guid dataID,
            tgProviderSpecificMetadata providerMetadata, tgColumnMetadataCollection 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 (tgColumnMetadata col in columns)
                    {
                        tgTypeMap 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];
        }
Ejemplo n.º 3
0
        public static Dictionary<string, VistaDBParameter> GetParameters(Guid dataID,
            tgProviderSpecificMetadata providerMetadata, tgColumnMetadataCollection 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 (tgColumnMetadata col in columns)
                    {
                        tgTypeMap 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];
        }