Example #1
0
        public override bool CanConnect(CancellationToken token)
        {
            bool canConnect;

            InternalOracleConnection connection = null;

            try
            {
                connection = new InternalOracleConnection(DbContext.ConnectionString);
                canConnect = true;
            }
            catch
            {
                canConnect = false;
            }
            finally
            {
                if (connection != null)
                {
                    connection.Dispose();
                }
            }

            return(canConnect);
        }
Example #2
0
 public OracleDataCursor(IDbContext dbContext)
 {
     _dbContext  = dbContext;
     _connection = null;
     _command    = null;
     _reader     = null;
     RowPreFetch = 5000;
 }
Example #3
0
 public InternalOracleCommand(string statement, InternalOracleConnection connection)
 {
     Command                      = new OracleCommand();
     Command.CommandText          = statement;
     Command.CommandType          = CommandType.Text;
     Command.AddToStatementCache  = false;
     Command.InitialLONGFetchSize = 4000;
     Command.InitialLOBFetchSize  = 4000;
     Command.Connection           = connection.Connection;
 }
Example #4
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);
        }
Example #5
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;
     }
 }
Example #6
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);
        }
Example #7
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();
                }
            }
        }