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
파일 보기 프로젝트 열기: pmprog/OpenXCOM.Tools

보호된 프로퍼티들

프로퍼티 타입 설명
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