public OracleDataCursor(IDbContext dbContext) { _dbContext = dbContext; _connection = null; _command = null; _reader = null; RowPreFetch = 5000; }
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); }
public void Close() { if (_reader != null) { _reader.Dispose(); _reader = null; } if (_command != null) { _command.Dispose(); _command = null; } if (_connection != null) { _connection.Dispose(); _connection = null; } }
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); }
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(); } } }