Esempio n. 1
0
 private void SafeDisposeHandle(OciStatementHandle h)
 {
     if (h != null && h != preparedStatement)
     {
         h.Dispose();
     }
 }
 internal static void SafeDispose(ref OciStatementHandle handle)
 {
     if (handle != null)
     {
         handle.Dispose();
     }
     handle = null;
 }
Esempio n. 3
0
        public override bool NextResult()
        {
            ValidateState();

            if (statement == null)
            {
                return(false);
            }

            statement.Dispose();
            statement = null;

            statement = command.GetNextResult();

            if (statement == null)
            {
                return(false);
            }

            return(true);
        }
 void Close()
 {
     if (!isClosed)
     {
         GetRecordsAffected();
         if (command != null)
         {
             command.CloseDataReader();
         }
     }
     if (statement != null)
     {
         statement.Dispose();
         statement = null;
     }
     //if (schemaTable != null) {
     //	schemaTable.Dispose ();
     //	schemaTable = null;
     //}
     isClosed = true;
 }
Esempio n. 5
0
        void Close()
        {
            if (!isClosed)
            {
                GetRecordsAffected();
                if (command != null)
                {
                    command.CloseDataReader();
                }
            }
            if (statement != null)
            {
                statement.Dispose();
                statement = null;
            }
#if NET_2_0
            if (schemaTable != null)
            {
                schemaTable.Dispose();
                schemaTable = null;
            }
#endif
            isClosed = true;
        }
Esempio n. 6
0
        OracleDataReader ExecuteReader(CommandBehavior behavior)
        {
            AssertConnectionIsOpen();
            AssertTransactionMatch();
            AssertCommandTextIsSet();

            moreResults = -1;

            bool hasRows = false;

            this.behavior = behavior;

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

            OciStatementHandle statement = GetStatementHandle();
            OracleDataReader   rd        = null;

            try
            {
                if (preparedStatement == null)
                {
                    PrepareStatement(statement);
                }
                else
                {
                    preparedStatement = null;   // OracleDataReader releases the statement handle
                }
                bool isNonQuery = IsNonQuery(statement);

                BindParameters(statement);

                if (isNonQuery)
                {
                    ExecuteNonQueryInternal(statement, false);
                }
                else
                {
                    if ((behavior & CommandBehavior.SchemaOnly) != 0)
                    {
                        statement.ExecuteQuery(true);
                    }
                    else
                    {
                        hasRows = statement.ExecuteQuery(false);
                    }

                    UpdateParameterValues();
                }

                if (Parameters.Count > 0)
                {
                    for (int p = 0; p < Parameters.Count; p++)
                    {
                        OracleParameter parm = Parameters[p];
                        if (parm.OracleType.Equals(OracleType.Cursor))
                        {
                            if (parm.Direction != ParameterDirection.Input)
                            {
                                rd = (OracleDataReader)parm.Value;
                                break;
                            }
                        }
                    }
                }

                if (rd == null)
                {
                    rd = new OracleDataReader(this, statement, hasRows, behavior);
                }
            }
            finally
            {
                if (statement != null && rd == null)
                {
                    statement.Dispose();
                }
            }

            return(rd);
        }