protected override void Dispose(bool disposing)
 {
     if (disposing)
     {
         OracleLob lob = this._lob;
         if (lob != null)
         {
             lob.Close();
         }
     }
     this._lob = null;
     this._fileName = null;
     this._directoryAlias = null;
     base.Dispose(disposing);
 }
Esempio n. 2
0
        public override object GetValue(int i)
        {
            OciDefineHandle defineHandle = (OciDefineHandle)statement.Values [i];

            if (defineHandle.IsNull)
            {
                return(DBNull.Value);
            }

            switch (defineHandle.DataType)
            {
            case OciDataType.Blob:
            case OciDataType.Clob:
                OracleLob lob   = GetOracleLob(i);
                object    value = lob.Value;
                lob.Close();
                return(value);

            default:
                return(defineHandle.GetValue(command.Connection.SessionFormatProvider, command.Connection));
            }
        }
Esempio n. 3
0
        object GetValueByteArray(int i)
        {
            OciDefineHandle defineHandle = (OciDefineHandle)statement.Values[i];

            if (defineHandle.IsNull)
            {
                return(DBNull.Value);
            }

            switch (defineHandle.DataType)
            {
            case OciDataType.Blob:
            case OciDataType.Clob:
                OracleLob lob   = GetOracleLob(i);
                object    value = lob.Value;
                lob.Close();
                return(value);

            default:
                return(defineHandle.GetValueByteArray(command.Connection));
            }
        }
Esempio n. 4
0
        object ExecuteScalar()
        {
            moreResults = -1;
            object output = null;//if we find nothing we return this

            AssertConnectionIsOpen();
            AssertTransactionMatch();
            AssertCommandTextIsSet();

            if (Transaction != null)
            {
                Transaction.AttachToServiceContext();
            }

            OciStatementHandle statement = GetStatementHandle();

            try
            {
                if (preparedStatement == null)
                {
                    PrepareStatement(statement);
                }

                bool isNonQuery = IsNonQuery(statement);

                BindParameters(statement);

                if (isNonQuery == true)
                {
                    ExecuteNonQueryInternal(statement, false);
                }
                else
                {
                    statement.ExecuteQuery(false);

                    if (statement.Fetch())
                    {
                        OciDefineHandle defineHandle = (OciDefineHandle)statement.Values[0];
                        if (!defineHandle.IsNull)
                        {
                            switch (defineHandle.DataType)
                            {
                            case OciDataType.Blob:
                            case OciDataType.Clob:
                                OracleLob lob = (OracleLob)defineHandle.GetValue(
                                    Connection.SessionFormatProvider, Connection);
                                lob.connection = Connection;
                                output         = lob.Value;
                                lob.Close();
                                break;

                            default:
                                output = defineHandle.GetValue(
                                    Connection.SessionFormatProvider, Connection);
                                break;
                            }
                        }
                    }
                    UpdateParameterValues();
                }
            }
            finally
            {
                SafeDisposeHandle(statement);
            }

            return(output);
        }