The following tables list the members exposed by DatabaseObjectSQL.
| Name | Description | |
|---|---|---|
![]() | DatabaseObjectSQL Constructor | Overloaded. DatabaseObjectSQL Default constructor for this class. Calls the parent class's contructor with same signature. |
| Name | Description | |
|---|---|---|
![]() | AffectedRecords | AffectedRecords Holds an Int32 value which can be used to hold the number of records that are either returned or affected by a query. This can be very useful in cases where a count of returned rows is needed. |
![]() | ConnectionString | ConnectionString Holds the value for connection String used to make a connection to the target database. This property is automatically initialized with the value from the application configuration settings. The value of ConnectionStringConfigName is used to look for the connection String from the application settings (AppSettings/Keys in Framework 1.1 and ConnectionSettings/Connections in Framework 2.0).. This property can also be manually set to point the library to a database other than the default. This will be useful if you need the library to connect to multiple database. |
![]() | ConnectionStringConfigName | ConnectionStringConfigName Set this property to change the name of the connection String. By default the library looks for a "database" connection String (AppSettings/Keys in Framework 1.1 and ConnectionStrings in Framework 2.0). This property should be modified before the database connection is initiated. (Inherited from DatabaseObject) |
![]() | DatabaseTypeConfigName | DatabaseTypeConfigName Set this property to change the name of the AppSettings key that contains the database type information. By default the library looks for a "database_type" AppSettings key. (Inherited from DatabaseObject) |
![]() | DBConnection | DBConnection Holds any IDbConnection object. This is autmatically created based on the DBType selection. If the DBType is set to SQL Server 2000 or SQL 2005, this property will be assigned a SqlConnection object, but if the DBType is set to Oracle 8i, 9i or 10g this property will be assigned an OracleConnection. If you like to manually set the connection you can do so as well as Int64 as the underlying database type remains the same as the value of DBType. Or NOTE: This property is not NonSerializable and it is also ignored during Xml Serialization. |
![]() | DBTransaction | DBTransaction Holds any IDbTransaction compatible object. This is autmatically created based on the value set in UseInTransaction property. If the UseInTransaction property is set to true, then at the time of creating a connection a new Transaction object will be created. If you like to manually set the transaction object you can do so, although it is better to let the library handle the transaction object creation along with the connection object creation. NOTE: This property is not NonSerializable and it is also ignored during Xml Serialization. |
![]() | DBType | DBType Specifies the uderlying database server that will be used by this library. (Inherited from DatabaseObject) |
![]() | ErrorString | ErrorString Holds a String value. This value is used to store the errors that were encountered while working with any of the database objects. |
![]() | FillSchema | FillSchema Value of FillSchema determines weather after running a SELECT statement if the FillSchema method will be called to fill the underlying schema into the dataset. NOTE: This is set to false by default. |
![]() | ParameterPrefix | ParameterPrefix - Returns the prefix that can be used to prefix the parameter names |
![]() | SessionEndCommand | SessionEndCommand Holds a SQL command String or the name of the stored procedure that is executed at the time database connection is closed/destroyed. Hence if the connection is shared by multiple objects, the command is only run once. |
![]() | SessionEndCommandType | SessionEndCommandType Holds a CommandType that indicates weather the SessionEndCommand is of type Text or Stored Procedure. TableDirect command type is not supported. |
![]() | SessionEndParameters | SessionEndParameters Holds either a Hashtable or an ArrayList of IDataParameters. If a Hashtable is assigned it should contain Key and Value pairs for parameters that the SessionStartCommand expects. Using a hashtable the stored procedure can not return any values and only inbound parameters can be used. If a ArrayList of parameter objects is used the ArrayList should contain an instance of parameter object for each parameter that SessionStartCommand expects. The parameter objects can be both inbound or outbound and may be of any data type that the underlying database supports. NOTE: To create an instance of the parameter of type that is suitable for your currently selected database type, call the GetNewParameterInstance method of this object. For example: IDataParameter param = databaseObjectSQL.GetNewParameterInstance(); By using the GetNewParameterInstance you are not hard coding the database specific parameter type, hence if you ever decide to move the underlying data store to a different data store (e.g. move from SQL Server to Oracle or vice versa), you will NOT need to recompile and the application will continue to work. |
![]() | SessionStartCommand | SessionStartCommand Holds a SQL command String or the name of a stored procedure that is executed at the time database connection is created. Hence if the connection is shared by multiple objects, the command is only run once. |
![]() | SessionStartCommandType | SessionStartCommandType Holds a CommandType that indicates weather the SessionStartCommand is of type Text or Stored Procedure. TableDirect command type is not supported. |
![]() | SessionStartParameters | SessionStartParameters Holds either a Hashtable or an ArrayList of IDataParameters. If a Hashtable is assigned it should contain Key and Value pairs for parameters that the SessionStartCommand expects. Using a hashtable the stored procedure can not return any values and only inbound parameters can be used. If a ArrayList of parameter objects is used the ArrayList should contain an instance of parameter object for each parameter that SessionStartCommand expects. The parameter objects can be both inbound or outbound and may be of any data type that the underlying database supports. NOTE: To create an instance of the parameter of type that is suitable for your currently selected database type, call the GetNewParameterInstance method of this object. For example: IDataParameter param = databaseObjectSQL.GetNewParameterInstance(); By using the GetNewParameterInstance you are not hard coding the database specific parameter type, hence if you ever decide to move the underlying data store to a different data store (e.g. move from SQL Server to Oracle or vice versa), you will NOT need to recompile and the application will continue to work. |
![]() | UseTransaction | UseTransaction Value of UseTransaction determines weather this object will create a Transaction at the time of creating database connection. If UseTransaction is set to true, and AssignConnection method is used to create joined objects, the connection, transaction are automatically shared by each business object. This allows multiple business objects to run various commands under the same transaction scope. NOTE: This property is set to false by default, and hence for the business object to run various commands in a transaction, this property must be explicitely set to true. |
| Name | Description | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
![]() | AssignConnection | AssignConnection If the current instance does not have an instance of database connection object, then this method calls CreateConnection method. After that the reference to the existing database connection object stored in DBConnection is passed to the passed in Object's DBConnection member variable. If the current instance's UseTransaction is set to true then this method also passes the reference to the existing transaction object stored in DBTransaction to the passed in Object's DBTransaction member variable. This method also assigns the SessionStartCommand and SessionEndCommands allowing any of the connected business objects to be able to run the SessionStartCommand and SessionEndCommand at the time of database connection opening and closing. Parameters:
| ||||||||||
![]() | CommitTransaction |
CommitTransaction
Commits the active SQL Transaction held in DBTransaction member variable, and then Disposes the transaction object, closes the connection object and sets it to null. NOTE: This however does not affect your ability to run more commands to the underlying database using the same instance of the database object instance as the database object creates a new connection when trying to run a new command after the earlier connection has been closed. | ||||||||||
![]() | CreateConnection | CreateConnection Creates a database connection and sets the DBConnection property. Depending on the DBType value either a SqlConnection object is created and stored in DBConnection property or an OracleConnection object is created and stored. If the DBConnection already has a connection object then this method does not create a new instance, instead it simply ensures that the connection is open. Also, if the UseTransaction property is set to true, then a new transaction object is created at the time of creating a connection. If there are any exceptions during connection or transaction object creation, the ErrorString property is populated with the exception message. | ||||||||||
![]() | Dispose |
Dispose
If the DBTransaction is not null, then this method permorms a RollBack on the active SQL Transaction held in DBTransaction member variable, and then Disposes the transaction object, closes the connection object and sets it to null. Effective version 3.x this method has been marked virtual and hence can be overridden by any of the inheriting classes. | ||||||||||
![]() | GetNewParameterInstance | GetNewParameterInstance Returns a new instance of parameter object that is suitable to be used with the currently selected DatabaseType. | ||||||||||
![]() | GetSQLExceptionAsString | GetSQLExceptionAsString Gets detailed error message and the source of the passed in Exception. Parameters:
| ||||||||||
![]() | RollBackTransaction | RollBackTransaction
Performs a RollBack on the active SQL Transaction held in DBTransaction member variable, and then Disposes the transaction object, closes the connection object and sets it to null. | ||||||||||
![]() | RunSessionEndCommand | RunSessionEndCommand Runs the command specified in the SessionEndCommand property. It is not necessary to call this method as the SessionEndCommand is automatically run when the database connection object is being disposed. This method is however provided for convenience in case you need to run this command several times in a session. All parameters assigned to the SessionEndParameters are also used to provide parameters to the command as well. | ||||||||||
![]() | RunSessionStartCommand | RunSessionStartCommand Runs the command specified in the SessionStartCommand property. It is not necessary to call this method as the SessionStartCommand is automatically run when the database connection is opened. This method is however provided for convenience in case you need to run this command several times in a session. All parameters assigned to the SessionStartParameters are also used to provide parameters to the command as well. | ||||||||||
![]() | RunSPReturnDataReader | RunSPReturnDataReader This method runs a Stored procedure and returns a data reader object Parameters:
Returns:
| ||||||||||
![]() | RunSPReturnDataset | Overloaded. RunSPReturnDataset This method runs a Stored procedure and returns a dataset. Parameters:
Returns:
| ||||||||||
![]() | RunSPWithNoReturn | Overloaded. RunSPWithNoReturn This method runs a Stored procedure and does not return any result set Parameters:
Returns:
| ||||||||||
![]() | RunSQLReturnDataset | Overloaded. RunSQLReturnDataset This method runs a SQL Command and returns a dataset. Parameters:
Returns:
| ||||||||||
![]() | RunSQLWithNoReturn | Overloaded. RunSQLWithNoReturn This method runs a SQL Command and returns the number of records affected. Parameters:
Returns:
| ||||||||||
![]() | SetDatabaseType | SetDatabaseType Takes a String as the parameter and sets the DBType property with the type of database to which this object will be connecting. Parameters:
| ||||||||||
![]() | SetSqlParamType | SetSqlParamType - This method can be used to set the appropriate DBType property of the parameter. |
| Name | Description | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|
![]() | EnsureConnectionString | EnsureConnectionString Checks the ConnectionString property and if it is nont set, it will try to get the Configuration / AppSettings / key (1.1 Framework) or Configuration / ConnectionStrings / key (2.0 Framework) that defines the database connection String. Calling this method is not needed in normal scenarios. This will be needed only if you are changing the ConnectionStringConfigName property through the code and would want to ensure that the new value is loaded from the configuration file and the ConnectionString property is updated accordingly. If you are calling EnsureDatabaseType method as well then you don't need to do that as EnsureDatabaseType is called by the EnsureConnectionString. (Inherited from DatabaseObject) | ||||||||
![]() | EnsureDatabaseType | EnsureDatabaseType Checks the DBType property and if it is set to None, it will try to get the Configuration / AppSettings / key that defines the DBType. Calling this method is not needed in normal scenarios. This will be needed only if you are changing the DatabaseTypeConfigName property through the code and would want to ensure that the new value is loaded from the configuration file and the DBType property is updated accordingly. If you are calling EnsureConnectionString method as well then you don't need to call EnsureDatabaseType as it is called by the EnsureConnectionString. (Inherited from DatabaseObject) | ||||||||
![]() | GetNewAdapterInstance | GetNewAdapterInstance GetNewAdapterInstance creates a new instance of IDbDataAdapter compatible data adapter depending on the type of connection object stored in DBConnection property. If the DBConnection property holds an OracleConnection then a OracleDataAdapter is created, however if the DBConnection property holds an SqlConnection then a SqlDataAdapter is created. The passed in command object is passed to the data adapter. The command object must match the connection type i.e. If the DBConnection is set to SqlConnection then an instance of SqlCommand must be passed. In normal scenarios there will not be a need to call this method, but it is provided for situations where a complex query has to be run which is not supported directly by this library. Parameters:
Returns:
|



