The Database type exposes the following members.
Constructors
Name | Description | |
---|---|---|
Database(IDbConnection, Database..::..ConnectionType) |
Initializes the Database instance with the database connection to utilise.
The connection is not opened until it is required.
The supplied connection should not be opened.
|
|
Database(String, Database..::..ConnectionType) |
Creates a new Database instance specifying the database to connect to and SQL
syntax to use with the database. Each function call of the Database class opens
and closes a connection. Therefore, connection pooling should be enabled
for optimal performance.
|
Methods
Name | Description | |
---|---|---|
Equals | (Inherited from Object.) | |
Finalize |
Allows an Object to attempt to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection.
(Inherited from Object.) |
|
GetHashCode |
Serves as a hash function for a particular type.
(Inherited from Object.) |
|
GetType |
Gets the Type of the current instance.
(Inherited from Object.) |
|
MemberwiseClone |
Creates a shallow copy of the current Object.
(Inherited from Object.) |
|
Object |
Returns an instance of an object from the collection using a distinct value (see
IDatabaseObjects.DistinctFieldName). If the collection has implemented the
IDatabaseObjects.Subset function then the objDistinctValue need only be unique
within the collection's subset, not the entire database table.
|
|
ObjectByKey |
Returns an object from the collection using a unique key value.
The key must be unique within the collection. If the collection's
IDatabaseObjects.Subset has been implemented then the key need only be unique
within the subset specified, not the entire database table.
|
|
ObjectByKeyIfExists |
Returns an object from the collection using a unique key value.
The key must be unique within the collection. If the collection's
IDatabaseObjects.Subset has been implemented then the key need only be unique
within the subset specified, not the entire database table.
Returns Nothing/null if the object does exist with the specified key.
This feature is what differentiates Database.ObjectByKey() from Database.ObjectByKeyExists().
|
|
ObjectByOrdinalFirst |
ObjectByOrdinalFirst returns the first object in the collection respectively
filtered and sorted by the collection's IDatabaseObjects.Subset and
IDatabaseObjects.OrderBy values. It differs from ObjectByOrdinal in that it only
loads the first record from the database table not the entire table.
|
|
ObjectByOrdinalLast |
Returns the last object in the collection respectively
filtered and sorted by the collection's IDatabaseObjects.Subset and
IDatabaseObjects.OrderBy values. It differs from ObjectByOrdinal in that it only
loads the first record from the database table not the entire table.
|
|
ObjectDelete |
Deletes an object's database record. If the collection's IDatabaseObjects.Subset
has been implemented then the object must exist within the subset, otherwise the
object will not be deleted. If the object has not been saved to the database the
function will exit without executing an SQL DELETE command. After deleting the
database record the object is set to Nothing. The calling function should receive
the object ByRef for this to have any affect. Setting the object to Nothing
minimises the possibility of the deleted object being used in code after
ObjectDelete has been called.
|
|
ObjectExists |
Returns whether the key exists within the collection. If the collection's
IDatabaseObjects.Subset has been set then only the subset is searched not the
entire table.
|
|
ObjectExistsByDistinctValue |
Returns whether an object exists for the specified distinct value in the collection.
|
|
ObjectFieldValues |
Returns the database fields for an object from the collection using a distinct value
(see IDatabaseObjects.DistinctFieldName). If the collection has implemented the
IDatabaseObjects.Subset function then the objDistinctValue need only be unique
within the collection's subset, not the entire database table.
This is typically used to interogate the database fields before loading the
object with a call to ObjectFromFieldValues.
This function is rarely used and generally the Object function suffices.
|
|
ObjectFromDataReader |
Creates and initializes an object from the current record of an IDataReader object.
|
|
ObjectFromDataRow |
Creates and initializes an object from the current record of a DataRow object.
|
|
ObjectFromFieldValues |
Creates and initializes an object from the values contained in an SQLFieldValues object.
This function is generally used from within an IDatabaseObject.Load function when
the IDatabaseObjects.TableJoins function has been implemented.
|
|
ObjectGetFieldValue(DatabaseObject, String) |
Gets and returns the field value from the database record associated with the
object and collection.
|
|
ObjectGetFieldValue(IDatabaseObjects, IDatabaseObject, String) |
Gets and returns the field value from the database record associated with the
object and collection.
|
|
ObjectIfExists |
Returns an instance of an object from the collection using a distinct value (see
IDatabaseObjects.DistinctFieldName). If the collection has implemented the
IDatabaseObjects.Subset function then the objDistinctValue need only be unique
within the collection's subset, not the entire database table.
Returns Nothing/null if the distinct value does not exist in the database.
This feature is what differentiates Database.Object() from Database.ObjectIfExists().
|
|
ObjectLoad(DatabaseObject, SQLFieldValues) |
Initializes an existing object with values from a set of database fields.
Specifically, sets the IDatbaseObject.IsSaved property to true,
sets the IDatbaseObject.DistinctValue using the provided data and
calls IDatbaseObject.LoadFields().
|
|
ObjectLoad(DatabaseObject, IDataReader) |
Initializes an existing object with values from a set of database fields.
Specifically, sets the IDatbaseObject.IsSaved property to true,
sets the IDatbaseObject.DistinctValue using the provided data and
calls IDatbaseObject.LoadFields().
|
|
ObjectLoad(IDatabaseObjects, IDatabaseObject, SQLFieldValues) |
Initializes an existing object with values from a set of database fields.
Specifically, sets the IDatbaseObject.IsSaved property to true,
sets the IDatbaseObject.DistinctValue using the provided data and
calls IDatbaseObject.LoadFields().
|
|
ObjectLoad(IDatabaseObjects, IDatabaseObject, IDataReader) |
Initializes an existing object with values from a set of database fields.
Specifically, sets the IDatbaseObject.IsSaved property to true,
sets the IDatbaseObject.DistinctValue using the provided data and
calls IDatbaseObject.LoadFields().
|
|
ObjectLockRecord |
Locks the database record associated with this object by selecting and locking
the row in the database. Supported in Microsoft SQLServer, Pervasive and MySQL.
The record lock is released when the transaction is committed or rolled back.
Throws an exception if not in transaction mode.
Returns the field values from the record that has been locked.
|
|
ObjectsArray |
Returns an array of IDatabaseObject objects contained within this collection.
|
|
ObjectSave |
Extracts the fields to save to the database from the objItem.SaveFields function.
The fields are then written to the database using either an SQL INSERT or UPDATE
depending on whether the object has already been saved. If the collection has
implemented IDatabaseObjects.KeyFieldName then objItem's key is also validated to
ensure it is not null and unique within the collection. If objCollection has
implemented IDatabaseObjects.Subset then objItem should exist within objCollection.
If not, a duplicate key error may occur if the obItem's key is being used in
another subset in the same table. If a record is being amended
(IDatabaseObject.IsSaved returns true) then the function will "AND" the collection's
IDatabaseObjects.Subset conditions and the objItem's IDatabaseObject.DistinctValue
value to create the WHERE clause in the UPDATE statement. Therefore, the
combination of the IDatabaseObjects.Subset and IDatabaseObject.DistinctValue
conditions MUST identify only one record in the table. Otherwise multiple records
will be updated with the same data. If data is only inserted and not amended
(usually a rare occurance) then this requirement is unnecessary.
|
|
ObjectsCount |
Returns the number of items in the collection. If the collection's
IDatabaseObjects.Subset has been implemented then this function returns the
number of records within the subset, not the entire table.
Also utilises the table joins so that any filters specified on the subset
can be used.
|
|
ObjectsDeleteAll |
Deletes all of the objects in the collection. If IDatabaseObjects.Subset
has been implemented then only the objects within the subset are deleted, not
the table's entire contents.
|
|
ObjectsDictionary |
Returns an IDictionary object. Each key/value pair contains a key and
the object associated with the key.
|
|
ObjectsDictionaryByDistinctValue |
Returns an IDictionary object. Each key/value pair contains a distinct
value and the object associated with the distinct value.
|
|
ObjectSetFieldValue(DatabaseObject, String, Object) |
Sets the field value for the database record associated with the object and
collection.
|
|
ObjectSetFieldValue(IDatabaseObjects, IDatabaseObject, String, Object) |
Sets the field value for the database record associated with the object and
collection.
|
|
ObjectsList |
Returns an IList object containing all of the collection's associated child
objects. This function is useful when loading a set of objects for a subset or
for use with the IEnumerable interface.
|
|
ObjectsSearch |
Returns a collection of objects that match the specified search criteria.
This function utilises any subsets, ordering or table joins specified in the
collection. To add a set of conditions to the objSearchCriteria object with
higher precendance use the "Add(SQLConditions)" overloaded function as this will
wrap the conditions within parentheses.
|
|
ToString | (Inherited from Object.) |
Properties
Name | Description | |
---|---|---|
Connection | ||
Transactions |