Beispiel #1
0
        //转换成oracle 相对应的类型.
        private object convertToOracleType(SimulatedOracleHelper oracleHelper, Type oracleDbType, System.Data.DbType dbType)
        {
            switch (dbType)
            {
            case System.Data.DbType.String:
                return(oracleHelper.GetOracleDbTypeValue(oracleDbType, "Varchar2"));

            //return OracleDbType.Varchar2;
            case System.Data.DbType.Decimal:
                return(oracleHelper.GetOracleDbTypeValue(oracleDbType, "Decimal"));

            //return OracleDbType.Decimal;
            case System.Data.DbType.Int16:
                return(oracleHelper.GetOracleDbTypeValue(oracleDbType, "Int16"));

            //return OracleDbType.Int16;
            case System.Data.DbType.Int32:
                return(oracleHelper.GetOracleDbTypeValue(oracleDbType, "Int32"));

            // return OracleDbType.Int32;
            case System.Data.DbType.Int64:
                return(oracleHelper.GetOracleDbTypeValue(oracleDbType, "Int64"));

            //return OracleDbType.Int64;
            case System.Data.DbType.Double:
                return(oracleHelper.GetOracleDbTypeValue(oracleDbType, "Double"));

            // return OracleDbType.Double;
            case System.Data.DbType.DateTime:
                return(oracleHelper.GetOracleDbTypeValue(oracleDbType, "Date"));

            //return OracleDbType.Date;
            case System.Data.DbType.Boolean:
                return(oracleHelper.GetOracleDbTypeValue(oracleDbType, "Char"));

            //return OracleDbType.Char;
            case System.Data.DbType.Binary:
                return(oracleHelper.GetOracleDbTypeValue(oracleDbType, "Blob"));

            //return OracleDbType.Blob;
            case System.Data.DbType.Byte:
                return(oracleHelper.GetOracleDbTypeValue(oracleDbType, "Byte"));

            // return OracleDbType.Byte;
            default:
                throw new MB.Util.APPException(string.Format("把DbType{0} 转换为OravleDbType 时出错,请检查相应的数据类型是否已经处理",
                                                             dbType.ToString()), MB.Util.APPMessageType.SysDatabaseInfo);
            }
            //return null;
        }
Beispiel #2
0
        internal static string getLanguajeStringType(System.Data.DbType nType, LanguajeType nLanguaje)
        {
            switch (nLanguaje)
            {
            case LanguajeType.VB:
                switch (nType)
                {
                case DbType.AnsiString:
                case DbType.AnsiStringFixedLength:
                case DbType.String:
                case DbType.StringFixedLength:
                case DbType.Xml:
                    return("String");

                case DbType.Binary:
                    return("Byte()");

                case DbType.Boolean:
                    return("Boolean");

                case DbType.Byte:
                    return("Byte");

                case DbType.Currency:
                    return("Double");

                case DbType.Time:
                case DbType.DateTime:
                case DbType.Date:
                case DbType.DateTime2:
                case DbType.DateTimeOffset:
                    return("DateTime");

                case DbType.Decimal:
                    return("Decimal");

                case DbType.Double:
                case DbType.VarNumeric:
                    return("Double");

                case DbType.Guid:
                    return("Guid");

                case DbType.Int16:
                    return("Short");

                case DbType.Int32:
                    return("Integer");

                case DbType.Int64:
                    return("Long");

                case DbType.Object:
                    return("Object");

                case DbType.SByte:
                    return("SByte");

                case DbType.Single:
                    return("Single");

                case DbType.UInt16:
                    return("UInt16");

                case DbType.UInt32:
                    return("UInt32");

                case DbType.UInt64:
                    return("UInt64");

                default:
                    throw new Exception("El tipo de dato " + nType.ToString() + " no se pudo mapear");
                }

            case LanguajeType.CSharp:
                switch (nType)
                {
                case DbType.AnsiString:
                case DbType.AnsiStringFixedLength:
                case DbType.String:
                case DbType.StringFixedLength:
                case DbType.Xml:
                    return("string");

                case DbType.Binary:
                    return("byte[]");

                case DbType.Boolean:
                    return("bool");

                case DbType.Byte:
                    return("byte");

                case DbType.Currency:
                    return("double");

                case DbType.Time:
                case DbType.DateTime:
                case DbType.Date:
                case DbType.DateTime2:
                case DbType.DateTimeOffset:
                    return("DateTime");

                case DbType.Decimal:
                    return("decimal");

                case DbType.Double:
                case DbType.VarNumeric:
                    return("double");

                case DbType.Guid:
                    return("Guid");

                case DbType.Int16:
                    return("short");

                case DbType.Int32:
                    return("int");

                case DbType.Int64:
                    return("long");

                case DbType.Object:
                    return("object");

                case DbType.SByte:
                    return("sbyte");

                case DbType.Single:
                    return("float");

                case DbType.UInt16:
                    return("UInt16");

                case DbType.UInt32:
                    return("UInt32");

                case DbType.UInt64:
                    return("UInt64");

                default:
                    throw new Exception("El tipo de dato " + nType.ToString() + " no se pudo mapear");
                }
            }

            return("");
        }