OracleDbAccess

Implements IDbAccess for Oracle.

Namespace:
Inetdev.Data.Oracle
Type:
Class
Public:
Yes
Protected:
No
Sealed:
No
Abstract:
No
Inherits from:
Inetdev.Data.AbstractDbAccess

Constructors

OracleDbAccess

Default constructor

Signature:
public Void OracleDbAccess()

Properties

Catalog

Database SID or ServiceName.

Signature:
public String Catalog { get; set; }
Remarks

Catalog can be specified as: * SID:DatabaseSid * ServiceName:DatabaseServiceName * DatabaseSid (If no prefix, SID is used)

DefaultIndexSpace

Name of the default tablespace used to store indexes.

Signature:
public String DefaultIndexSpace { get; set; }

DefaultRole

Name of the default role used to grant privileges to.

Signature:
public String DefaultRole { get; set; }

DefaultTableSpace

Name of the default tablespace used to store tables.

Signature:
public String DefaultTableSpace { get; set; }

IsConnectionOpen

Gets whether a connection is currently open.

Signature:
public Boolean IsConnectionOpen { get; }

IsInTransaction

Gets whether a transaccion is in progress.

Signature:
public Boolean IsInTransaction { get; }

Password

Password of the user used to connect to the database.

Signature:
public String Password { set; }

ServiceName

Database ServiceName. This property sets Catalog = "ServiceName:value" only if Catalog is empty.

Signature:
public String ServiceName { get; set; }

Sid

Database SID. This property sets Catalog = "SID:value" only if Catalog is empty.

Signature:
public String Sid { get; set; }

UserName

User name to connecto to the database.

Signature:
public String UserName { set; }

Methods

AddParameter

Adds a parameter to the command.

Signature:
public Void AddParameter(command, name, type, direction, size, value)
Parameters
Name Type Summary
command IDbCommand The command where the parameter will be added.
name String The quoted parameter name.
type DbType The parameter data type.
direction ParameterDirection The parameter direction.
size Int32 The size of the data in the valueparameter.
value Object The value of the parameter.
Exceptions
Type Summary
DataAccessException Thrown when there are an error casting the parameter value.

BeginTransaction

Initiates a transaction.

Signature:
public IDbTransaction BeginTransaction()
Returns

An object representing the new transaction.

BeginTransaction

Initiates a transaction with the specified isolation level.

Signature:
public IDbTransaction BeginTransaction(iso)
Returns

An object representing the new transaction.

Parameters
Name Type Summary
iso IsolationLevel Isolation level for the transaction.

CloseConnection

Closes connection.

Signature:
public Void CloseConnection()

CommitTransaction

Commits a transaction.

Signature:
public Void CommitTransaction()

CreateCommand

Creates a new IDbCommand.

Signature:
public IDbCommand CreateCommand(commandType)
Parameters
Name Type Summary
commandType CommandType

Dispose

Performs applicarion-defined tasks associated with freeing, releasing, or reseting unmaneged resources.

Signature:
public Void Dispose()

ExecuteCommand

Executes the specified command against the database

Signature:
public Int32 ExecuteCommand(command, tbl)
Returns

Amount of records affected by the command

Remarks

If the command returns a set of records, the tbl parameter must contain an initialize DataTable, otherwise it must be null

Parameters
Name Type Summary
command IDbCommand Command to excecute.
tbl DataTable An initialized DataTable object or null.
Exceptions
Type Summary
DataAccessException Thrown when an unindentify error occurs
OpenConnectionException Thrown when a connection could not be openned.
DuplicatedPrimaryKeyException Thrown when a primary key or unique index constraint fails
ConstraintViolationException Thrown if a constraint is violated
DatabaseObjectNotFoundException Thrown when a database object, as a table, view, field, etc., does not exist.

ExecuteCommandAsync

Executes the specified command asyncronously againt the database.

Signature:
public Task<Int32> ExecuteCommandAsync(command, dataTable)
Remarks

If the command returns a set of records, the dataTable parameter must contain an initialized DataTable, otherwise it must be null.

Parameters
Name Type Summary
command IDbCommand Command to execute.
dataTable DataTable An initialized DataTable object or null.
Exceptions
Type Summary
DataAccessException Thrown when an unindentify error occurs.
DuplicatedPrimaryKeyException Thrown when a primary key or unique index constraint fails.
ConstraintViolationException Thrown if a constraint is violated.
DatabaseObjectNotFoundException Thrown when a database object, as a table, view, field, etc., does not exist.

ExecuteReader

Executes the specified command against the database and returns a IDataReader.

Signature:
public IDataReader ExecuteReader(command)
Returns

A read only forward only IDataReader with the database data.

Parameters
Name Type Summary
command IDbCommand Command to execute.
Exceptions
Type Summary
InvalidOperationException Thrown the the connection is not open.
DataAccessException Thrown when an unindentify error occurs.
DatabaseObjectNotFoundException Thrown when a database object, as a table, view, field, etc., does not exist.

ExecuteReaderAsync

Executes the specified command against the database asyncronously and returns an IDataReader.

Signature:
public Task<IDataReader> ExecuteReaderAsync(command)
Parameters
Name Type Summary
command IDbCommand Command to execute.
Exceptions
Type Summary
InvalidOperationException Thrown when the database connection is not open.
DataAccessException Thrown when an unindentify error occurs.
DatabaseObjectNotFoundException Thrown when a database object, as a table, view, field, etc., does not exist.

ExecuteScalar

Executes the specified command against the database and returns the first fields of the first record retrieved

Signature:
public Object ExecuteScalar(command)
Returns

Value of the first field of the first record. If the CommandType is a Stored Procedure the value of the parameter with Direction equals to ReturnValue is returned.

Parameters
Name Type Summary
command IDbCommand Command to excecute.
Exceptions
Type Summary
DataAccessException Thrown when an unindentify error occurs.
OpenConnectionException Thrown when a connection could not be openned.
DatabaseObjectNotFoundException Thrown when a database object, as a table, view, field, etc., does not exist.

ExecuteScalarAsync

Executes the specified command againts the database asyncronously and returns the first field of the first record retrieved.

Signature:
public Task<Object> ExecuteScalarAsync(command)
Returns

Value of the first field of the first record. If the CommandType is a Stored Procedure the value of the parameter with Direction equals to ReturnValue is returned.

Parameters
Name Type Summary
command IDbCommand Command to execute.
Exceptions
Type Summary
DataAccessException Thrown when an unindentify error occurs.
OpenConnectionException Thrown when a connection could not be openned.
DatabaseObjectNotFoundException Thrown when a database object, as a table, view, field, etc., does not exist.

GetSchema

Ejecutes the underlaying connection GetSchema() method.

Signature:
public DataTable GetSchema()
Returns

A DataTable as obtained from the GetSchema() method.

Exceptions
Type Summary
DataAccessException Thrown when an unindentify error occurs.

GetSchema

Ejecutes the underlaying connection GetSchema() method.

Signature:
public DataTable GetSchema(collectionName)
Returns

A DataTable as obtained from the GetSchema() method.

Parameters
Name Type Summary
collectionName String The name of the collection to retrieve.
Exceptions
Type Summary
DataAccessException Thrown when an unindentify error occurs.

GetSchema

Ejecutes the underlaying connection GetSchema() method.

Signature:
public DataTable GetSchema(collectionName, restrictionValues)
Returns

A DataTable as obtained from the GetSchema() method.

Parameters
Name Type Summary
collectionName String The name of the collection to retrieve.
restrictionValues String[] A set of restriction values.
Exceptions
Type Summary
DataAccessException Thrown when an unindentify error occurs.

GetServerVersion

Gets the server version.

Signature:
public String GetServerVersion()
Returns

The server version.

Exceptions
Type Summary
SchemaManipulationException Thrown when there is an error accesing schema data.

OpenConnection

Opens a connection with the database server.

Signature:
public Void OpenConnection()
Exceptions
Type Summary
OpenConnectionException Thrown when an unindentify error occurs.
ServerUnavailableException Thrown when the database server is not found.
CatalogNotFoundException Thrown when the catalog is not found.
InvalidCredentialsException Thrown when credentials are invalid.
CredentialsExpiredException Thrown when the password has expired.

OpenConnectionAsync

Opens a connection with the database server asyncronously.

Signature:
public Task OpenConnectionAsync()
Exceptions
Type Summary
OpenConnectionException Thrown when an unindentify error occurs.
ServerUnavailableException Thrown when the database server is not found.
InvalidCredentialsException Thrown when credentials are invalid.

RollbackTransaction

Aborts the current transaction

Signature:
public Void RollbackTransaction()