C# Class LightFramework.Data.OracleHelper

The OracleHelper class is intended to encapsulate high performance, scalable best practices for common uses of OracleClient.
Mostrar archivo Open project: xianrendzw/LightFramework.Net

Public Methods

Method Description
ExecuteDataset ( Oracle.DataAccess.Client.OracleConnection connection, CommandType commandType, string commandText ) : DataSet

Execute an OracleCommand (that returns a resultset and takes no parameters) against the provided OracleConnection.

e.g.: DataSet ds = ExecuteDataset(conn, CommandType.StoredProcedure, "GetOrders");

ExecuteDataset ( Oracle.DataAccess.Client.OracleConnection connection, string spName ) : DataSet

Execute a stored procedure via an OracleCommand (that returns a resultset) against the specified OracleConnection using the provided parameter values. This method will query the database to discover the parameters for the stored procedure (the first time each stored procedure is called), and assign the values based on parameter order.

This method provides no access to output parameters or the stored procedure's return value parameter. e.g.: DataSet ds = ExecuteDataset(conn, "GetOrders", 24, 36);

ExecuteDataset ( OracleTransaction transaction, CommandType commandType, string commandText ) : DataSet

Execute an OracleCommand (that returns a resultset and takes no parameters) against the provided OracleTransaction.

e.g.: DataSet ds = ExecuteDataset(trans, CommandType.StoredProcedure, "GetOrders");

ExecuteDataset ( OracleTransaction transaction, string spName ) : DataSet

Execute a stored procedure via an OracleCommand (that returns a resultset) against the specified OracleTransaction using the provided parameter values. This method will query the database to discover the parameters for the stored procedure (the first time each stored procedure is called), and assign the values based on parameter order.

This method provides no access to output parameters or the stored procedure's return value parameter. e.g.: DataSet ds = ExecuteDataset(trans, "GetOrders", 24, 36);

ExecuteDataset ( string connectionString, CommandType commandType, string commandText ) : DataSet

Execute an OracleCommand (that returns a resultset and takes no parameters) against the database specified in the connection string.

e.g.: DataSet ds = ExecuteDataset(connString, CommandType.StoredProcedure, "GetOrders");

ExecuteDataset ( string connectionString, string spName ) : DataSet

Execute a stored procedure via an OracleCommand (that returns a resultset) against the database specified in the conneciton string using the provided parameter values. This method will query the database to discover the parameters for the stored procedure (the first time each stored procedure is called), and assign the values based on parameter order.

This method provides no access to output parameters or the stored procedure's return value parameter. e.g.: DataSet ds = ExecuteDataset(connString, "GetOrders", 24, 36);

ExecuteNonQuery ( Oracle.DataAccess.Client.OracleConnection connection, CommandType commandType, string commandText ) : int

Execute an OracleCommand (that returns no resultset and takes no parameters) against the provided OracleConnection.

e.g.: int result = ExecuteNonQuery(conn, CommandType.StoredProcedure, "PublishOrders");

ExecuteNonQuery ( Oracle.DataAccess.Client.OracleConnection connection, string spName ) : int

Execute a stored procedure via an OracleCommand (that returns no resultset) against the specified OracleConnection using the provided parameter values. This method will query the database to discover the parameters for the stored procedure (the first time each stored procedure is called), and assign the values based on parameter order.

This method provides no access to output parameters or the stored procedure's return value parameter. e.g.: int result = ExecuteNonQuery(conn, "PublishOrders", 24, 36);

ExecuteNonQuery ( OracleTransaction transaction, CommandType commandType, string commandText ) : int

Execute an OracleCommand (that returns no resultset and takes no parameters) against the provided OracleTransaction.

e.g.: int result = ExecuteNonQuery(trans, CommandType.StoredProcedure, "PublishOrders");

ExecuteNonQuery ( OracleTransaction transaction, string spName ) : int

Execute a stored procedure via an OracleCommand (that returns no resultset) against the specified OracleTransaction using the provided parameter values. This method will query the database to discover the parameters for the stored procedure (the first time each stored procedure is called), and assign the values based on parameter order.

This method provides no access to output parameters or the stored procedure's return value parameter. e.g.: int result = ExecuteNonQuery(conn, trans, "PublishOrders", 24, 36);

ExecuteNonQuery ( string connectionString, CommandType commandType, string commandText ) : int

Execute an OracleCommand (that returns no resultset and takes no parameters) against the database specified in the connection string.

e.g.: int result = ExecuteNonQuery(connString, CommandType.StoredProcedure, "PublishOrders");

ExecuteNonQuery ( string connectionString, string spName ) : int

Execute a stored procedure via an OracleCommand (that returns no resultset) against the database specified in the connection string using the provided parameter values. This method will query the database to discover the parameters for the stored procedure (the first time each stored procedure is called), and assign the values based on parameter order.

This method provides no access to output parameters or the stored procedure's return value parameter. e.g.: int result = ExecuteNonQuery(connString, "PublishOrders", 24, 36);

ExecuteReader ( Oracle.DataAccess.Client.OracleConnection connection, CommandType commandType, string commandText ) : OracleDataReader

Execute an OracleCommand (that returns a resultset and takes no parameters) against the provided OracleConnection.

e.g.: OracleDataReader dr = ExecuteReader(conn, CommandType.StoredProcedure, "GetOrders");

ExecuteReader ( Oracle.DataAccess.Client.OracleConnection connection, string spName ) : OracleDataReader

Execute a stored procedure via an OracleCommand (that returns a resultset) against the specified OracleConnection using the provided parameter values. This method will query the database to discover the parameters for the stored procedure (the first time each stored procedure is called), and assign the values based on parameter order.

This method provides no access to output parameters or the stored procedure's return value parameter. e.g.: OracleDataReader dr = ExecuteReader(conn, "GetOrders", 24, 36);

ExecuteReader ( OracleTransaction transaction, CommandType commandType, string commandText ) : OracleDataReader

Execute an OracleCommand (that returns a resultset and takes no parameters) against the provided OracleTransaction.

e.g.: OracleDataReader dr = ExecuteReader(trans, CommandType.StoredProcedure, "GetOrders");

ExecuteReader ( OracleTransaction transaction, string spName ) : OracleDataReader

Execute a stored procedure via an OracleCommand (that returns a resultset) against the specified OracleTransaction using the provided parameter values. This method will query the database to discover the parameters for the stored procedure (the first time each stored procedure is called), and assign the values based on parameter order.

This method provides no access to output parameters or the stored procedure's return value parameter. e.g.: OracleDataReader dr = ExecuteReader(trans, "GetOrders", 24, 36);

ExecuteReader ( string connectionString, CommandType commandType, string commandText ) : OracleDataReader

Execute an OracleCommand (that returns a resultset and takes no parameters) against the database specified in the connection string.

e.g.: OracleDataReader dr = ExecuteReader(connString, CommandType.StoredProcedure, "GetOrders");

ExecuteReader ( string connectionString, string spName ) : OracleDataReader

Execute a stored procedure via an OracleCommand (that returns a resultset) against the database specified in the connection string using the provided parameter values. This method will query the database to discover the parameters for the stored procedure (the first time each stored procedure is called), and assign the values based on parameter order.

This method provides no access to output parameters or the stored procedure's return value parameter. e.g.: OracleDataReader dr = ExecuteReader(connString, "GetOrders", 24, 36);

ExecuteScalar ( Oracle.DataAccess.Client.OracleConnection connection, CommandType commandType, string commandText ) : object

Execute an OracleCommand (that returns a 1x1 resultset and takes no parameters) against the provided OracleConnection.

e.g.: int orderCount = (int)ExecuteScalar(conn, CommandType.StoredProcedure, "GetOrderCount");

ExecuteScalar ( Oracle.DataAccess.Client.OracleConnection connection, string spName ) : object

Execute a stored procedure via an OracleCommand (that returns a 1x1 resultset) against the specified OracleConnection using the provided parameter values. This method will query the database to discover the parameters for the stored procedure (the first time each stored procedure is called), and assign the values based on parameter order.

This method provides no access to output parameters or the stored procedure's return value parameter. e.g.: int orderCount = (int)ExecuteScalar(conn, "GetOrderCount", 24, 36);

ExecuteScalar ( OracleTransaction transaction, CommandType commandType, string commandText ) : object

Execute an OracleCommand (that returns a 1x1 resultset and takes no parameters) against the provided OracleTransaction.

e.g.: int orderCount = (int)ExecuteScalar(trans, CommandType.StoredProcedure, "GetOrderCount");

ExecuteScalar ( OracleTransaction transaction, string spName ) : object

Execute a stored procedure via an OracleCommand (that returns a 1x1 resultset) against the specified OracleTransaction using the provided parameter values. This method will query the database to discover the parameters for the stored procedure (the first time each stored procedure is called), and assign the values based on parameter order.

This method provides no access to output parameters or the stored procedure's return value parameter. e.g.: int orderCount = (int)ExecuteScalar(trans, "GetOrderCount", 24, 36);

ExecuteScalar ( string connectionString, CommandType commandType, string commandText ) : object

Execute an OracleCommand (that returns a 1x1 resultset and takes no parameters) against the database specified in the connection string.

e.g.: int orderCount = (int)ExecuteScalar(connString, CommandType.StoredProcedure, "GetOrderCount");

ExecuteScalar ( string connectionString, string spName ) : object

Execute a stored procedure via an OracleCommand (that returns a 1x1 resultset) against the database specified in the conneciton string using the provided parameter values. This method will query the database to discover the parameters for the stored procedure (the first time each stored procedure is called), and assign the values based on parameter order.

This method provides no access to output parameters or the stored procedure's return value parameter. e.g.: int orderCount = (int)ExecuteScalar(connString, "GetOrderCount", 24, 36);

Private Methods

Method Description
AssignParameterValues ( OracleParameter commandParameters, object parameterValues ) : void

This method assigns an array of values to an array of OracleParameters.

AttachParameters ( OracleCommand command, OracleParameter commandParameters ) : void

This method is used to attach array's of OracleParameters to an OracleCommand. This method will assign a value of DbNull to any parameter with a direction of InputOutput and a value of null. This behavior will prevent default values from being used, but this will be the less common case than an intended pure output parameter (derived as InputOutput) where the user provided no input value.

ExecuteReader ( Oracle.DataAccess.Client.OracleConnection connection, OracleTransaction transaction, CommandType commandType, string commandText, OracleParameter commandParameters, OracleConnectionOwnership connectionOwnership ) : OracleDataReader

Create and prepare an OracleCommand, and call ExecuteReader with the appropriate CommandBehavior.

If we created and opened the connection, we want the connection to be closed when the DataReader is closed. If the caller provided the connection, we want to leave it to them to manage.

OracleHelper ( ) : System
PrepareCommand ( OracleCommand command, Oracle.DataAccess.Client.OracleConnection connection, OracleTransaction transaction, CommandType commandType, string commandText, OracleParameter commandParameters ) : void

This method opens (if necessary) and assigns a connection, transaction, command type and parameters to the provided command.

Method Details

ExecuteDataset() public static method

Execute an OracleCommand (that returns a resultset and takes no parameters) against the provided OracleConnection.
e.g.: DataSet ds = ExecuteDataset(conn, CommandType.StoredProcedure, "GetOrders");
public static ExecuteDataset ( Oracle.DataAccess.Client.OracleConnection connection, CommandType commandType, string commandText ) : DataSet
connection Oracle.DataAccess.Client.OracleConnection a valid OracleConnection
commandType CommandType the CommandType (stored procedure, text, etc.)
commandText string the stored procedure name or PL/SQL command
return System.Data.DataSet

ExecuteDataset() public static method

Execute a stored procedure via an OracleCommand (that returns a resultset) against the specified OracleConnection using the provided parameter values. This method will query the database to discover the parameters for the stored procedure (the first time each stored procedure is called), and assign the values based on parameter order.
This method provides no access to output parameters or the stored procedure's return value parameter. e.g.: DataSet ds = ExecuteDataset(conn, "GetOrders", 24, 36);
public static ExecuteDataset ( Oracle.DataAccess.Client.OracleConnection connection, string spName ) : DataSet
connection Oracle.DataAccess.Client.OracleConnection a valid OracleConnection
spName string the name of the stored procedure
return System.Data.DataSet

ExecuteDataset() public static method

Execute an OracleCommand (that returns a resultset and takes no parameters) against the provided OracleTransaction.
e.g.: DataSet ds = ExecuteDataset(trans, CommandType.StoredProcedure, "GetOrders");
public static ExecuteDataset ( OracleTransaction transaction, CommandType commandType, string commandText ) : DataSet
transaction OracleTransaction a valid OracleTransaction
commandType CommandType the CommandType (stored procedure, text, etc.)
commandText string the stored procedure name or PL/SQL command
return System.Data.DataSet

ExecuteDataset() public static method

Execute a stored procedure via an OracleCommand (that returns a resultset) against the specified OracleTransaction using the provided parameter values. This method will query the database to discover the parameters for the stored procedure (the first time each stored procedure is called), and assign the values based on parameter order.
This method provides no access to output parameters or the stored procedure's return value parameter. e.g.: DataSet ds = ExecuteDataset(trans, "GetOrders", 24, 36);
public static ExecuteDataset ( OracleTransaction transaction, string spName ) : DataSet
transaction OracleTransaction a valid OracleTransaction
spName string the name of the stored procedure
return System.Data.DataSet

ExecuteDataset() public static method

Execute an OracleCommand (that returns a resultset and takes no parameters) against the database specified in the connection string.
e.g.: DataSet ds = ExecuteDataset(connString, CommandType.StoredProcedure, "GetOrders");
public static ExecuteDataset ( string connectionString, CommandType commandType, string commandText ) : DataSet
connectionString string a valid connection string for an OracleConnection
commandType CommandType the CommandType (stored procedure, text, etc.)
commandText string the stored procedure name or PL/SQL command
return System.Data.DataSet

ExecuteDataset() public static method

Execute a stored procedure via an OracleCommand (that returns a resultset) against the database specified in the conneciton string using the provided parameter values. This method will query the database to discover the parameters for the stored procedure (the first time each stored procedure is called), and assign the values based on parameter order.
This method provides no access to output parameters or the stored procedure's return value parameter. e.g.: DataSet ds = ExecuteDataset(connString, "GetOrders", 24, 36);
public static ExecuteDataset ( string connectionString, string spName ) : DataSet
connectionString string a valid connection string for an OracleConnection
spName string the name of the stored procedure
return System.Data.DataSet

ExecuteNonQuery() public static method

Execute an OracleCommand (that returns no resultset and takes no parameters) against the provided OracleConnection.
e.g.: int result = ExecuteNonQuery(conn, CommandType.StoredProcedure, "PublishOrders");
public static ExecuteNonQuery ( Oracle.DataAccess.Client.OracleConnection connection, CommandType commandType, string commandText ) : int
connection Oracle.DataAccess.Client.OracleConnection a valid OracleConnection
commandType CommandType the CommandType (stored procedure, text, etc.)
commandText string the stored procedure name or PL/SQL command
return int

ExecuteNonQuery() public static method

Execute a stored procedure via an OracleCommand (that returns no resultset) against the specified OracleConnection using the provided parameter values. This method will query the database to discover the parameters for the stored procedure (the first time each stored procedure is called), and assign the values based on parameter order.
This method provides no access to output parameters or the stored procedure's return value parameter. e.g.: int result = ExecuteNonQuery(conn, "PublishOrders", 24, 36);
public static ExecuteNonQuery ( Oracle.DataAccess.Client.OracleConnection connection, string spName ) : int
connection Oracle.DataAccess.Client.OracleConnection a valid OracleConnection
spName string the name of the stored procedure
return int

ExecuteNonQuery() public static method

Execute an OracleCommand (that returns no resultset and takes no parameters) against the provided OracleTransaction.
e.g.: int result = ExecuteNonQuery(trans, CommandType.StoredProcedure, "PublishOrders");
public static ExecuteNonQuery ( OracleTransaction transaction, CommandType commandType, string commandText ) : int
transaction OracleTransaction a valid OracleTransaction
commandType CommandType the CommandType (stored procedure, text, etc.)
commandText string the stored procedure name or PL/SQL command
return int

ExecuteNonQuery() public static method

Execute a stored procedure via an OracleCommand (that returns no resultset) against the specified OracleTransaction using the provided parameter values. This method will query the database to discover the parameters for the stored procedure (the first time each stored procedure is called), and assign the values based on parameter order.
This method provides no access to output parameters or the stored procedure's return value parameter. e.g.: int result = ExecuteNonQuery(conn, trans, "PublishOrders", 24, 36);
public static ExecuteNonQuery ( OracleTransaction transaction, string spName ) : int
transaction OracleTransaction a valid OracleTransaction
spName string the name of the stored procedure
return int

ExecuteNonQuery() public static method

Execute an OracleCommand (that returns no resultset and takes no parameters) against the database specified in the connection string.
e.g.: int result = ExecuteNonQuery(connString, CommandType.StoredProcedure, "PublishOrders");
public static ExecuteNonQuery ( string connectionString, CommandType commandType, string commandText ) : int
connectionString string a valid connection string for an OracleConnection
commandType CommandType the CommandType (stored procedure, text, etc.)
commandText string the stored procedure name or PL/SQL command
return int

ExecuteNonQuery() public static method

Execute a stored procedure via an OracleCommand (that returns no resultset) against the database specified in the connection string using the provided parameter values. This method will query the database to discover the parameters for the stored procedure (the first time each stored procedure is called), and assign the values based on parameter order.
This method provides no access to output parameters or the stored procedure's return value parameter. e.g.: int result = ExecuteNonQuery(connString, "PublishOrders", 24, 36);
public static ExecuteNonQuery ( string connectionString, string spName ) : int
connectionString string a valid connection string for an OracleConnection
spName string the name of the stored procedure
return int

ExecuteReader() public static method

Execute an OracleCommand (that returns a resultset and takes no parameters) against the provided OracleConnection.
e.g.: OracleDataReader dr = ExecuteReader(conn, CommandType.StoredProcedure, "GetOrders");
public static ExecuteReader ( Oracle.DataAccess.Client.OracleConnection connection, CommandType commandType, string commandText ) : OracleDataReader
connection Oracle.DataAccess.Client.OracleConnection a valid OracleConnection
commandType CommandType the CommandType (stored procedure, text, etc.)
commandText string the stored procedure name or PL/SQL command
return OracleDataReader

ExecuteReader() public static method

Execute a stored procedure via an OracleCommand (that returns a resultset) against the specified OracleConnection using the provided parameter values. This method will query the database to discover the parameters for the stored procedure (the first time each stored procedure is called), and assign the values based on parameter order.
This method provides no access to output parameters or the stored procedure's return value parameter. e.g.: OracleDataReader dr = ExecuteReader(conn, "GetOrders", 24, 36);
public static ExecuteReader ( Oracle.DataAccess.Client.OracleConnection connection, string spName ) : OracleDataReader
connection Oracle.DataAccess.Client.OracleConnection a valid OracleConnection
spName string the name of the stored procedure
return OracleDataReader

ExecuteReader() public static method

Execute an OracleCommand (that returns a resultset and takes no parameters) against the provided OracleTransaction.
e.g.: OracleDataReader dr = ExecuteReader(trans, CommandType.StoredProcedure, "GetOrders");
public static ExecuteReader ( OracleTransaction transaction, CommandType commandType, string commandText ) : OracleDataReader
transaction OracleTransaction a valid OracleTransaction
commandType CommandType the CommandType (stored procedure, text, etc.)
commandText string the stored procedure name or PL/SQL command
return OracleDataReader

ExecuteReader() public static method

Execute a stored procedure via an OracleCommand (that returns a resultset) against the specified OracleTransaction using the provided parameter values. This method will query the database to discover the parameters for the stored procedure (the first time each stored procedure is called), and assign the values based on parameter order.
This method provides no access to output parameters or the stored procedure's return value parameter. e.g.: OracleDataReader dr = ExecuteReader(trans, "GetOrders", 24, 36);
public static ExecuteReader ( OracleTransaction transaction, string spName ) : OracleDataReader
transaction OracleTransaction a valid OracleTransaction
spName string the name of the stored procedure
return OracleDataReader

ExecuteReader() public static method

Execute an OracleCommand (that returns a resultset and takes no parameters) against the database specified in the connection string.
e.g.: OracleDataReader dr = ExecuteReader(connString, CommandType.StoredProcedure, "GetOrders");
public static ExecuteReader ( string connectionString, CommandType commandType, string commandText ) : OracleDataReader
connectionString string a valid connection string for an OracleConnection
commandType CommandType the CommandType (stored procedure, text, etc.)
commandText string the stored procedure name or PL/SQL command
return OracleDataReader

ExecuteReader() public static method

Execute a stored procedure via an OracleCommand (that returns a resultset) against the database specified in the connection string using the provided parameter values. This method will query the database to discover the parameters for the stored procedure (the first time each stored procedure is called), and assign the values based on parameter order.
This method provides no access to output parameters or the stored procedure's return value parameter. e.g.: OracleDataReader dr = ExecuteReader(connString, "GetOrders", 24, 36);
public static ExecuteReader ( string connectionString, string spName ) : OracleDataReader
connectionString string a valid connection string for an OracleConnection
spName string the name of the stored procedure
return OracleDataReader

ExecuteScalar() public static method

Execute an OracleCommand (that returns a 1x1 resultset and takes no parameters) against the provided OracleConnection.
e.g.: int orderCount = (int)ExecuteScalar(conn, CommandType.StoredProcedure, "GetOrderCount");
public static ExecuteScalar ( Oracle.DataAccess.Client.OracleConnection connection, CommandType commandType, string commandText ) : object
connection Oracle.DataAccess.Client.OracleConnection a valid OracleConnection
commandType CommandType the CommandType (stored procedure, text, etc.)
commandText string the stored procedure name or T-Oracle command
return object

ExecuteScalar() public static method

Execute a stored procedure via an OracleCommand (that returns a 1x1 resultset) against the specified OracleConnection using the provided parameter values. This method will query the database to discover the parameters for the stored procedure (the first time each stored procedure is called), and assign the values based on parameter order.
This method provides no access to output parameters or the stored procedure's return value parameter. e.g.: int orderCount = (int)ExecuteScalar(conn, "GetOrderCount", 24, 36);
public static ExecuteScalar ( Oracle.DataAccess.Client.OracleConnection connection, string spName ) : object
connection Oracle.DataAccess.Client.OracleConnection a valid OracleConnection
spName string the name of the stored procedure
return object

ExecuteScalar() public static method

Execute an OracleCommand (that returns a 1x1 resultset and takes no parameters) against the provided OracleTransaction.
e.g.: int orderCount = (int)ExecuteScalar(trans, CommandType.StoredProcedure, "GetOrderCount");
public static ExecuteScalar ( OracleTransaction transaction, CommandType commandType, string commandText ) : object
transaction OracleTransaction a valid OracleTransaction
commandType CommandType the CommandType (stored procedure, text, etc.)
commandText string the stored procedure name or T-OleDb command
return object

ExecuteScalar() public static method

Execute a stored procedure via an OracleCommand (that returns a 1x1 resultset) against the specified OracleTransaction using the provided parameter values. This method will query the database to discover the parameters for the stored procedure (the first time each stored procedure is called), and assign the values based on parameter order.
This method provides no access to output parameters or the stored procedure's return value parameter. e.g.: int orderCount = (int)ExecuteScalar(trans, "GetOrderCount", 24, 36);
public static ExecuteScalar ( OracleTransaction transaction, string spName ) : object
transaction OracleTransaction a valid OracleTransaction
spName string the name of the stored procedure
return object

ExecuteScalar() public static method

Execute an OracleCommand (that returns a 1x1 resultset and takes no parameters) against the database specified in the connection string.
e.g.: int orderCount = (int)ExecuteScalar(connString, CommandType.StoredProcedure, "GetOrderCount");
public static ExecuteScalar ( string connectionString, CommandType commandType, string commandText ) : object
connectionString string a valid connection string for an OracleConnection
commandType CommandType the CommandType (stored procedure, text, etc.)
commandText string the stored procedure name or T-Oracle command
return object

ExecuteScalar() public static method

Execute a stored procedure via an OracleCommand (that returns a 1x1 resultset) against the database specified in the conneciton string using the provided parameter values. This method will query the database to discover the parameters for the stored procedure (the first time each stored procedure is called), and assign the values based on parameter order.
This method provides no access to output parameters or the stored procedure's return value parameter. e.g.: int orderCount = (int)ExecuteScalar(connString, "GetOrderCount", 24, 36);
public static ExecuteScalar ( string connectionString, string spName ) : object
connectionString string a valid connection string for an OracleConnection
spName string the name of the stored procedure
return object