C# Class DSShared.DB_Access.Access_DBTable

Provides basic support for insert, update and delete operations. Properties of the extended class that are tagged with DBColumnAttributes will be reflected upon so that the system knows which properties map to what columns in your table Before creation of a an object that extends this class, make sure your type is registered with the DBTableTypeCache
Inheritance: IComparable
Afficher le fichier Open project: pmprog/OpenXCOM.Tools

Protected Properties

Свойство Type Description
myType DSShared.DB.DBTableType

Méthodes publiques

Méthode Description
Access_DBTable ( string tableName ) : System

Constructor for an access table

CompareTo ( object other ) : int

It is up to the implementing class to determine how this table compares to other tables

Delete ( ) : void

Opens a connection to the database and calls Delete(OleDbConnection conn,OleDbTransaction trans)

Delete ( System.Data.OleDb.OleDbConnection conn, System.Data.OleDb.OleDbTransaction trans ) : void

Deletes a row based on the AutoNumber property of the internal DBTableType. An exception will be thrown if your class does not have an autonumber attribute set and this method is not overridden

Delete ( System.Data.OleDb.OleDbConnection conn, System.Data.OleDb.OleDbTransaction trans, string table ) : void

Creates and performs a delete query

Equals ( object other ) : bool

It is up to the implementing class to determine how this table equals other tables

GetAll ( System.Data.OleDb.OleDbConnection conn, System.Data.OleDb.OleDbTransaction trans, string table, bool cache ) : ArrayList

Retrieves all rows from a single table according to the columns specified The order of items is based on the order retrieved from the query Generally, this method does a SELECT * FROM table

GetAll ( string table, bool cache ) : ArrayList

Calls GetAll(table,cache,null)

GetAllHash ( System.Data.OleDb.OleDbConnection conn, System.Data.OleDb.OleDbTransaction trans, string table, bool cache ) : Hashtable

Retrieves all rows from a single table according to the columns specified The keys of the hashtable are autonumber values which are retrieved from properties tagged with a DBColumn value of true for autoNumber

GetAllHash ( string table, bool cache ) : Hashtable

Opens a connection and transaction to the database and calls GetAllHash(OleDbConnection conn,OleDbTransaction trans,string table,bool cache,params WhereCol[] whereQuery) with it. Upon success, the transaction is committed and the connection closed

GetHashCode ( ) : int

It is up to the implementing class to determine the hash code of this table

Insert ( System.Data.OleDb.OleDbConnection conn, System.Data.OleDb.OleDbTransaction trans ) : void

Performs an insert operation. It is up to the user to ensure that this operation will not fail (ie: calling insert twice on the same object)

PrintTableInfo ( ) : void

Prints table information to the Console

Save ( ) : void

Opens a database connection and transaction and calls Save(Access_DBInterface.Instance.Connection,trans)

Save ( System.Data.OleDb.OleDbConnection conn, System.Data.OleDb.OleDbTransaction trans ) : void

It is up to the implementing class to determine how this table is saved, either with an Insert() or an Update()

Update ( System.Data.OleDb.OleDbConnection conn, System.Data.OleDb.OleDbTransaction trans ) : void

Updates a row based on the AutoNumber property

Méthodes protégées

Méthode Description
FinishGet ( System.Data.OleDb.OleDbConnection conn, System.Data.OleDb.OleDbTransaction trans ) : void

Once all the rows of a table have been retrieved with GetAll(), this method gets called to allow the table to perform any additional information retrieval necessary This is the time to link up fields in other tables that have been cached

Method Details

Access_DBTable() public méthode

Constructor for an access table
public Access_DBTable ( string tableName ) : System
tableName string Name of the table in the database this object represents
Résultat System

CompareTo() public abstract méthode

It is up to the implementing class to determine how this table compares to other tables
public abstract CompareTo ( object other ) : int
other object
Résultat int

Delete() public méthode

Opens a connection to the database and calls Delete(OleDbConnection conn,OleDbTransaction trans)
public Delete ( ) : void
Résultat void

Delete() public méthode

Deletes a row based on the AutoNumber property of the internal DBTableType. An exception will be thrown if your class does not have an autonumber attribute set and this method is not overridden
public Delete ( System.Data.OleDb.OleDbConnection conn, System.Data.OleDb.OleDbTransaction trans ) : void
conn System.Data.OleDb.OleDbConnection
trans System.Data.OleDb.OleDbTransaction
Résultat void

Delete() public static méthode

Creates and performs a delete query
public static Delete ( System.Data.OleDb.OleDbConnection conn, System.Data.OleDb.OleDbTransaction trans, string table ) : void
conn System.Data.OleDb.OleDbConnection Connection to use for the delete
trans System.Data.OleDb.OleDbTransaction Transaction to use for the delete
table string Name of the table to delete
Résultat void

Equals() public abstract méthode

It is up to the implementing class to determine how this table equals other tables
public abstract Equals ( object other ) : bool
other object
Résultat bool

FinishGet() protected méthode

Once all the rows of a table have been retrieved with GetAll(), this method gets called to allow the table to perform any additional information retrieval necessary This is the time to link up fields in other tables that have been cached
protected FinishGet ( System.Data.OleDb.OleDbConnection conn, System.Data.OleDb.OleDbTransaction trans ) : void
conn System.Data.OleDb.OleDbConnection Connection that was used for the GetAll()
trans System.Data.OleDb.OleDbTransaction Transaction used for the GetAll()
Résultat void

GetAll() public static méthode

Retrieves all rows from a single table according to the columns specified The order of items is based on the order retrieved from the query Generally, this method does a SELECT * FROM table
public static GetAll ( System.Data.OleDb.OleDbConnection conn, System.Data.OleDb.OleDbTransaction trans, string table, bool cache ) : ArrayList
conn System.Data.OleDb.OleDbConnection Connection to use
trans System.Data.OleDb.OleDbTransaction Transaction to use
table string Table name
cache bool If true, cache'ing will be used
Résultat System.Collections.ArrayList

GetAll() public static méthode

Calls GetAll(table,cache,null)
public static GetAll ( string table, bool cache ) : ArrayList
table string Table name
cache bool If true, cache'ing will be used
Résultat System.Collections.ArrayList

GetAllHash() public static méthode

Retrieves all rows from a single table according to the columns specified The keys of the hashtable are autonumber values which are retrieved from properties tagged with a DBColumn value of true for autoNumber
public static GetAllHash ( System.Data.OleDb.OleDbConnection conn, System.Data.OleDb.OleDbTransaction trans, string table, bool cache ) : Hashtable
conn System.Data.OleDb.OleDbConnection Connection to the database
trans System.Data.OleDb.OleDbTransaction Transaction object that is open and paired with the connection
table string Name of the table to get all the rows from
cache bool If true, values will be retrieved from the cache if available
Résultat System.Collections.Hashtable

GetAllHash() public static méthode

Opens a connection and transaction to the database and calls GetAllHash(OleDbConnection conn,OleDbTransaction trans,string table,bool cache,params WhereCol[] whereQuery) with it. Upon success, the transaction is committed and the connection closed
public static GetAllHash ( string table, bool cache ) : Hashtable
table string table name
cache bool if the table does not change frequently, you should set this to true
Résultat System.Collections.Hashtable

GetHashCode() public abstract méthode

It is up to the implementing class to determine the hash code of this table
public abstract GetHashCode ( ) : int
Résultat int

Insert() public méthode

Performs an insert operation. It is up to the user to ensure that this operation will not fail (ie: calling insert twice on the same object)
public Insert ( System.Data.OleDb.OleDbConnection conn, System.Data.OleDb.OleDbTransaction trans ) : void
conn System.Data.OleDb.OleDbConnection
trans System.Data.OleDb.OleDbTransaction
Résultat void

PrintTableInfo() public méthode

Prints table information to the Console
public PrintTableInfo ( ) : void
Résultat void

Save() public méthode

Opens a database connection and transaction and calls Save(Access_DBInterface.Instance.Connection,trans)
public Save ( ) : void
Résultat void

Save() public méthode

It is up to the implementing class to determine how this table is saved, either with an Insert() or an Update()
public Save ( System.Data.OleDb.OleDbConnection conn, System.Data.OleDb.OleDbTransaction trans ) : void
conn System.Data.OleDb.OleDbConnection Connection to use for the save
trans System.Data.OleDb.OleDbTransaction Transaction to use for the save
Résultat void

Update() public méthode

Updates a row based on the AutoNumber property
public Update ( System.Data.OleDb.OleDbConnection conn, System.Data.OleDb.OleDbTransaction trans ) : void
conn System.Data.OleDb.OleDbConnection Connection to use
trans System.Data.OleDb.OleDbTransaction Transaction to use
Résultat void

Property Details

myType protected_oe property

The DBTableType that was setup upon initial table registration
protected DBTableType,DSShared.DB myType
Résultat DSShared.DB.DBTableType