C# Класс 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
Наследование: IComparable
Показать файл Открыть проект

Защищенные свойства (Protected)

Свойство Тип Описание
myType DSShared.DB.DBTableType

Открытые методы

Метод Описание
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

Защищенные методы

Метод Описание
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

Описание методов

Access_DBTable() публичный Метод

Constructor for an access table
public Access_DBTable ( string tableName ) : System
tableName string Name of the table in the database this object represents
Результат System

CompareTo() публичный абстрактный Метод

It is up to the implementing class to determine how this table compares to other tables
public abstract CompareTo ( object other ) : int
other object
Результат int

Delete() публичный Метод

Opens a connection to the database and calls Delete(OleDbConnection conn,OleDbTransaction trans)
public Delete ( ) : void
Результат void

Delete() публичный Метод

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
Результат void

Delete() публичный статический Метод

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
Результат void

Equals() публичный абстрактный Метод

It is up to the implementing class to determine how this table equals other tables
public abstract Equals ( object other ) : bool
other object
Результат bool

FinishGet() защищенный Метод

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()
Результат void

GetAll() публичный статический Метод

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
Результат System.Collections.ArrayList

GetAll() публичный статический Метод

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
Результат System.Collections.ArrayList

GetAllHash() публичный статический Метод

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
Результат System.Collections.Hashtable

GetAllHash() публичный статический Метод

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
Результат System.Collections.Hashtable

GetHashCode() публичный абстрактный Метод

It is up to the implementing class to determine the hash code of this table
public abstract GetHashCode ( ) : int
Результат int

Insert() публичный Метод

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
Результат void

PrintTableInfo() публичный Метод

Prints table information to the Console
public PrintTableInfo ( ) : void
Результат void

Save() публичный Метод

Opens a database connection and transaction and calls Save(Access_DBInterface.Instance.Connection,trans)
public Save ( ) : void
Результат void

Save() публичный Метод

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
Результат void

Update() публичный Метод

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
Результат void

Описание свойств

myType защищенное свойство

The DBTableType that was setup upon initial table registration
protected DBTableType,DSShared.DB myType
Результат DSShared.DB.DBTableType