public OracleParameter(string name, System.Data.OracleClient.OracleType oracleType, int size, string srcColumn) : this()
 {
     this.ParameterName = name;
     this.OracleType    = oracleType;
     this.Size          = size;
     this.SourceColumn  = srcColumn;
 }
Exemplo n.º 2
0
 internal string GetString(NativeBuffer_RowBuffer buffer)
 {
     if (this.IsLob)
     {
         System.Data.OracleClient.OracleType oracleType = this._metaType.OracleType;
         if (((System.Data.OracleClient.OracleType.Clob != oracleType) && (System.Data.OracleClient.OracleType.NClob != oracleType)) && (System.Data.OracleClient.OracleType.BFile != oracleType))
         {
             throw System.Data.Common.ADP.InvalidCast();
         }
         if (this.IsDBNull(buffer))
         {
             throw System.Data.Common.ADP.DataReaderNoData();
         }
         using (OracleLob lob = new OracleLob(this._lobLocator))
         {
             return((string)lob.Value);
         }
     }
     if (typeof(string) != this._metaType.BaseType)
     {
         throw System.Data.Common.ADP.InvalidCast();
     }
     if (this.IsDBNull(buffer))
     {
         throw System.Data.Common.ADP.DataReaderNoData();
     }
     this.FixupLongValueLength(buffer);
     return(OracleString.MarshalToString(buffer, this._valueOffset, this._lengthOffset, this._metaType, this._connection, this._bindAsUTF16, false));
 }
Exemplo n.º 3
0
        /// <summary>
        /// 生成oracle参数
        /// </summary>
        /// <param name="ParamName">字段名</param>
        /// <param name="otype">数据类型</param>
        /// <param name="size">数据大小</param>
        /// <param name="Value">值</param>
        /// <returns></returns>
        public static OracleParameter MakeParam(string ParamName, System.Data.OracleClient.OracleType otype, int size, Object Value)
        {
            OracleParameter para = new OracleParameter(ParamName, Value);

            para.OracleType = otype;
            para.Size       = size;
            return(para);
        }
 internal static MetaType GetMetaTypeForType(System.Data.OracleClient.OracleType oracleType)
 {
     if ((oracleType < System.Data.OracleClient.OracleType.BFile) || ((oracleType - 1) > System.Data.OracleClient.OracleType.Double))
     {
         throw System.Data.Common.ADP.InvalidOracleType(oracleType);
     }
     return(oracleTypeMetaType[(int)oracleType]);
 }
 public OracleParameter(string name, System.Data.OracleClient.OracleType oracleType, int size, ParameterDirection direction, string sourceColumn, DataRowVersion sourceVersion, bool sourceColumnNullMapping, object value) : this()
 {
     this.ParameterName           = name;
     this.OracleType              = oracleType;
     this.Size                    = size;
     this.Direction               = direction;
     this.SourceColumn            = sourceColumn;
     this.SourceVersion           = sourceVersion;
     this.SourceColumnNullMapping = sourceColumnNullMapping;
     this.Value                   = value;
 }
 public OracleParameter(string name, System.Data.OracleClient.OracleType oracleType, int size, ParameterDirection direction, bool isNullable, byte precision, byte scale, string srcColumn, DataRowVersion srcVersion, object value) : this()
 {
     this.ParameterName     = name;
     this.OracleType        = oracleType;
     this.Size              = size;
     this.Direction         = direction;
     this.IsNullable        = isNullable;
     this.PrecisionInternal = precision;
     this.ScaleInternal     = scale;
     this.SourceColumn      = srcColumn;
     this.SourceVersion     = srcVersion;
     this.Value             = value;
 }
        public MetaType(System.Data.DbType dbType, System.Data.OracleClient.OracleType oracleType, OCI.DATATYPE ociType, string dataTypeName, Type convertToType, Type noConvertType, int bindSize, int maxBindSize, bool usesNationalCharacterSet)
        {
            this._dbType                   = dbType;
            this._oracleType               = oracleType;
            this._ociType                  = ociType;
            this._convertToType            = convertToType;
            this._noConvertType            = noConvertType;
            this._bindSize                 = bindSize;
            this._maxBindSize              = maxBindSize;
            this._dataTypeName             = dataTypeName;
            this._usesNationalCharacterSet = usesNationalCharacterSet;
            switch (oracleType)
            {
            case System.Data.OracleClient.OracleType.Char:
            case System.Data.OracleClient.OracleType.Clob:
            case System.Data.OracleClient.OracleType.LongVarChar:
            case System.Data.OracleClient.OracleType.NChar:
            case System.Data.OracleClient.OracleType.NClob:
            case System.Data.OracleClient.OracleType.NVarChar:
            case System.Data.OracleClient.OracleType.VarChar:
                this._isCharacterType = true;
                break;
            }
            switch (oracleType)
            {
            case System.Data.OracleClient.OracleType.LongRaw:
            case System.Data.OracleClient.OracleType.LongVarChar:
                this._isLong = true;
                break;
            }
            switch (oracleType)
            {
            case System.Data.OracleClient.OracleType.BFile:
            case System.Data.OracleClient.OracleType.Blob:
            case System.Data.OracleClient.OracleType.Clob:
            case System.Data.OracleClient.OracleType.NClob:
                this._isLob = true;
                break;

            case System.Data.OracleClient.OracleType.Char:
                break;

            default:
                return;
            }
        }
Exemplo n.º 8
0
        public static void GetoType(string key, DataTable dt, out System.Data.OracleClient.OracleType otype, out int size)
        {
            DataView dv = dt.DefaultView;

            dv.RowFilter = "column_name='" + key + "'";
            string fType = dv[0]["data_type"].ToString().ToUpper();

            switch (fType)
            {
            case "DATE":
                otype = OracleType.DateTime;
                size  = int.Parse(dv[0]["data_length"].ToString());
                break;

            case "CHAR":
                otype = OracleType.Char;
                size  = int.Parse(dv[0]["data_length"].ToString());
                break;

            case "LONG":
                otype = OracleType.Double;
                size  = int.Parse(dv[0]["data_length"].ToString());
                break;

            case "NVARCHAR2":
                otype = OracleType.NVarChar;
                size  = int.Parse(dv[0]["data_length"].ToString());
                break;

            case "VARCHAR2":
                otype = OracleType.NVarChar;
                size  = int.Parse(dv[0]["data_length"].ToString());
                break;

            default:
                otype = OracleType.NVarChar;
                size  = 100;
                break;
            }
        }
 public OracleParameter(string name, System.Data.OracleClient.OracleType oracleType, int size) : this()
 {
     this.ParameterName = name;
     this.OracleType    = oracleType;
     this.Size          = size;
 }
        public MetaType(System.Data.DbType dbType, System.Data.OracleClient.OracleType oracleType, OCI.DATATYPE ociType, string dataTypeName, Type convertToType, Type noConvertType, int bindSize, int maxBindSize, bool usesNationalCharacterSet)
        {
            this._dbType = dbType;
            this._oracleType = oracleType;
            this._ociType = ociType;
            this._convertToType = convertToType;
            this._noConvertType = noConvertType;
            this._bindSize = bindSize;
            this._maxBindSize = maxBindSize;
            this._dataTypeName = dataTypeName;
            this._usesNationalCharacterSet = usesNationalCharacterSet;
            switch (oracleType)
            {
                case System.Data.OracleClient.OracleType.Char:
                case System.Data.OracleClient.OracleType.Clob:
                case System.Data.OracleClient.OracleType.LongVarChar:
                case System.Data.OracleClient.OracleType.NChar:
                case System.Data.OracleClient.OracleType.NClob:
                case System.Data.OracleClient.OracleType.NVarChar:
                case System.Data.OracleClient.OracleType.VarChar:
                    this._isCharacterType = true;
                    break;
            }
            switch (oracleType)
            {
                case System.Data.OracleClient.OracleType.LongRaw:
                case System.Data.OracleClient.OracleType.LongVarChar:
                    this._isLong = true;
                    break;
            }
            switch (oracleType)
            {
                case System.Data.OracleClient.OracleType.BFile:
                case System.Data.OracleClient.OracleType.Blob:
                case System.Data.OracleClient.OracleType.Clob:
                case System.Data.OracleClient.OracleType.NClob:
                    this._isLob = true;
                    break;

                case System.Data.OracleClient.OracleType.Char:
                    break;

                default:
                    return;
            }
        }
Exemplo n.º 11
0
        internal long GetChars(NativeBuffer_RowBuffer buffer, long fieldOffset, char[] destinationBuffer, int destinationOffset, int length)
        {
            int num;

            if (length < 0)
            {
                throw System.Data.Common.ADP.InvalidDataLength((long)length);
            }
            if ((destinationOffset < 0) || ((destinationBuffer != null) && (destinationOffset >= destinationBuffer.Length)))
            {
                throw System.Data.Common.ADP.InvalidDestinationBufferIndex(destinationBuffer.Length, destinationOffset, "bufferoffset");
            }
            if ((0L > fieldOffset) || (0xffffffffL < fieldOffset))
            {
                throw System.Data.Common.ADP.InvalidSourceOffset("fieldOffset", 0L, 0xffffffffL);
            }
            if (this.IsLob)
            {
                System.Data.OracleClient.OracleType oracleType = this._metaType.OracleType;
                if (((System.Data.OracleClient.OracleType.Clob != oracleType) && (System.Data.OracleClient.OracleType.NClob != oracleType)) && (System.Data.OracleClient.OracleType.BFile != oracleType))
                {
                    throw System.Data.Common.ADP.InvalidCast();
                }
                if (this.IsDBNull(buffer))
                {
                    throw System.Data.Common.ADP.DataReaderNoData();
                }
                using (OracleLob lob = new OracleLob(this._lobLocator))
                {
                    string str        = (string)lob.Value;
                    int    maxLen     = str.Length;
                    int    startIndex = (int)fieldOffset;
                    if (startIndex < 0)
                    {
                        throw System.Data.Common.ADP.InvalidSourceBufferIndex(maxLen, (long)startIndex, "fieldOffset");
                    }
                    num = maxLen - startIndex;
                    if (destinationBuffer != null)
                    {
                        num = Math.Min(num, length);
                        if (0 < num)
                        {
                            Buffer.BlockCopy(str.ToCharArray(startIndex, num), 0, destinationBuffer, destinationOffset, num);
                        }
                    }
                    goto Label_0198;
                }
            }
            if ((((System.Data.OracleClient.OracleType.Char != this.OracleType) && (System.Data.OracleClient.OracleType.VarChar != this.OracleType)) && ((System.Data.OracleClient.OracleType.LongVarChar != this.OracleType) && (System.Data.OracleClient.OracleType.NChar != this.OracleType))) && (System.Data.OracleClient.OracleType.NVarChar != this.OracleType))
            {
                throw System.Data.Common.ADP.InvalidCast();
            }
            if (this.IsDBNull(buffer))
            {
                throw System.Data.Common.ADP.DataReaderNoData();
            }
            this.FixupLongValueLength(buffer);
            int num5         = OracleString.GetLength(buffer, this._lengthOffset, this._metaType);
            int sourceOffset = (int)fieldOffset;

            num = num5 - sourceOffset;
            if (destinationBuffer != null)
            {
                num = Math.Min(num, length);
                if (0 < num)
                {
                    OracleString.GetChars(buffer, this._valueOffset, this._lengthOffset, this._metaType, this._connection, this._bindAsUTF16, sourceOffset, destinationBuffer, destinationOffset, num);
                }
            }
Label_0198:
            return((long)Math.Max(0, num));
        }
Exemplo n.º 12
0
        internal long GetBytes(NativeBuffer_RowBuffer buffer, long fieldOffset, byte[] destinationBuffer, int destinationOffset, int length)
        {
            int num;

            if (length < 0)
            {
                throw System.Data.Common.ADP.InvalidDataLength((long)length);
            }
            if ((destinationOffset < 0) || ((destinationBuffer != null) && (destinationOffset >= destinationBuffer.Length)))
            {
                throw System.Data.Common.ADP.InvalidDestinationBufferIndex(destinationBuffer.Length, destinationOffset, "bufferoffset");
            }
            if ((0L > fieldOffset) || (0xffffffffL < fieldOffset))
            {
                throw System.Data.Common.ADP.InvalidSourceOffset("fieldOffset", 0L, 0xffffffffL);
            }
            if (this.IsLob)
            {
                System.Data.OracleClient.OracleType oracleType = this._metaType.OracleType;
                if ((System.Data.OracleClient.OracleType.Blob != oracleType) && (System.Data.OracleClient.OracleType.BFile != oracleType))
                {
                    throw System.Data.Common.ADP.InvalidCast();
                }
                if (this.IsDBNull(buffer))
                {
                    throw System.Data.Common.ADP.DataReaderNoData();
                }
                using (OracleLob lob = new OracleLob(this._lobLocator))
                {
                    uint num3 = (uint)lob.Length;
                    uint num2 = (uint)fieldOffset;
                    if (num2 > num3)
                    {
                        throw System.Data.Common.ADP.InvalidSourceBufferIndex((int)num3, (long)num2, "fieldOffset");
                    }
                    num = (int)(num3 - num2);
                    if (destinationBuffer != null)
                    {
                        num = Math.Min(num, length);
                        if (0 < num)
                        {
                            lob.Seek((long)num2, SeekOrigin.Begin);
                            lob.Read(destinationBuffer, destinationOffset, num);
                        }
                    }
                    goto Label_0155;
                }
            }
            if ((System.Data.OracleClient.OracleType.Raw != this.OracleType) && (System.Data.OracleClient.OracleType.LongRaw != this.OracleType))
            {
                throw System.Data.Common.ADP.InvalidCast();
            }
            if (this.IsDBNull(buffer))
            {
                throw System.Data.Common.ADP.DataReaderNoData();
            }
            this.FixupLongValueLength(buffer);
            int num5         = OracleBinary.GetLength(buffer, this._lengthOffset, this._metaType);
            int sourceOffset = (int)fieldOffset;

            num = num5 - sourceOffset;
            if (destinationBuffer != null)
            {
                num = Math.Min(num, length);
                if (0 < num)
                {
                    OracleBinary.GetBytes(buffer, this._valueOffset, this._metaType, sourceOffset, destinationBuffer, destinationOffset, num);
                }
            }
Label_0155:
            return((long)Math.Max(0, num));
        }