Ejemplo n.º 1
0
 public OracleDataCursor(IDbContext dbContext)
 {
     _dbContext  = dbContext;
     _connection = null;
     _command    = null;
     _reader     = null;
     RowPreFetch = 5000;
 }
Ejemplo n.º 2
0
        public IDataReader ExecuteReader(string selectStatement, bool hasBlobColumn)
        {
            _connection = new InternalOracleConnection(_dbContext.ConnectionString);

            _command = new InternalOracleCommand(selectStatement, _connection);
            _reader  = _command.Command.ExecuteReader();
            if (_command.Command.RowSize > 0)
            {
                _reader.FetchSize = _command.Command.RowSize * RowPreFetch;
            }

            return(_reader);
        }
Ejemplo n.º 3
0
 public void Close()
 {
     if (_reader != null)
     {
         _reader.Dispose();
         _reader = null;
     }
     if (_command != null)
     {
         _command.Dispose();
         _command = null;
     }
     if (_connection != null)
     {
         _connection.Dispose();
         _connection = null;
     }
 }
Ejemplo n.º 4
0
        public override bool IsTable(string tableName)
        {
            bool tableExists;
            var  connection = new InternalOracleConnection(DbContext.ConnectionString);

            try
            {
                using (var command = new InternalOracleCommand("SELECT table_name FROM user_tables WHERE table_name = :tableName ", connection))
                {
                    command.Command.Parameters.Add(new OracleParameter("tableName", tableName.ToUpper()));
                    tableExists = command.Command.ExecuteScalar() != null;
                }
            }
            catch (Exception ex)
            {
                throw new ADatabaseException("ERROR with statement in IsTable", ex);
            }
            finally
            {
                connection.Dispose();
            }

            return(tableExists);
        }
Ejemplo n.º 5
0
        public object ExecuteScalar(string sql)
        {
            InternalOracleConnection connection = null;

            try
            {
                connection = new InternalOracleConnection(_dbContext.ConnectionString);
                using (InternalOracleCommand command = new InternalOracleCommand(sql, connection))
                {
                    return(command.Command.ExecuteScalar());
                }
            }
            catch (Exception ex)
            {
                throw new ADatabaseException("ERROR with statement: " + sql, ex);
            }
            finally
            {
                if (connection != null)
                {
                    connection.Dispose();
                }
            }
        }