A wxDbTable instance provides re-usable access to rows of data in a table contained within the associated ODBC data source
Include files
<wx/dbtable.h>
<wx/db.h>
Members Helper classes and data structures
The following classes and structs are defined in dbtable.cpp/.h for use with the wxDbTable class.
class wxDbColDef : Bound column definitions for use by a wxDbTable instance class wxDbColDataPtr : Pointer to dynamic column definitions for use with a wxDbTable instance class wxDbIdxDef : Used in creation of non-primary indexesConstants
wxDB_DEFAULT_CURSOR Index number of the cursor that each table will use by default. wxDB_QUERY_ONLY Used to indicate whether a table that is opened is for query only, or if insert/update/deletes will be performed on the table. Less overhead (cursors and memory) are allocated for query only tables, plus read access times are faster with some datasources. wxDB_ROWID_LEN [Oracle specific] - Used when CanUpdateByRowID() is true. Optimizes updates so they are faster by updating on the Oracle-specific ROWID column rather than some other index. wxDB_DISABLE_VIEW Use to indicate when a database view should not be if a table is normally set up to use a view. [Currently unsupported.]Remarks
See also
Members
wxDbTable::wxDbTable
wxDbTable::wxDbTable
wxDbTable::BuildDeleteStmt
wxDbTable::BuildSelectStmt
wxDbTable::BuildUpdateStmt
wxDbTable::BuildWhereStmt
wxDbTable::CanSelectForUpdate
wxDbTable::CanUpdateByROWID
wxDbTable::ClearMemberVars
wxDbTable::CloseCursor
wxDbTable::Count
wxDbTable::CreateIndex
wxDbTable::CreateTable
wxDbTable::DB_STATUS
wxDbTable::IsColNull
wxDbTable::Delete
wxDbTable::DeleteCursor
wxDbTable::DeleteWhere
wxDbTable::DeleteMatching
wxDbTable::DropIndex
wxDbTable::DropTable
wxDbTable::GetColDefs
wxDbTable::GetCursor
wxDbTable::GetDb
wxDbTable::GetFirst
wxDbTable::GetFromClause
wxDbTable::GetLast
wxDbTable::GetNewCursor
wxDbTable::GetNext
wxDbTable::GetNumberOfColumns
wxDbTable::GetOrderByClause
wxDbTable::GetPrev
wxDbTable::GetQueryTableName
wxDbTable::GetRowNum
wxDbTable::GetTableName
wxDbTable::GetTablePath
wxDbTable::GetWhereClause
wxDbTable::Insert
wxDbTable::IsCursorClosedOnCommit
wxDbTable::IsQueryOnly
wxDbTable::Open
wxDbTable::Query
wxDbTable::QueryBySqlStmt
wxDbTable::QueryMatching
wxDbTable::QueryOnKeyFields
wxDbTable::Refresh
wxDbTable::SetColDefs
wxDbTable::SetCursor
wxDbTable::SetFromClause
wxDbTable::SetNull
wxDbTable::SetOrderByClause
wxDbTable::SetQueryTimeout
wxDbTable::SetWhereClause
wxDbTable::Update
wxDbTable::UpdateWhere
wxDbTable::operator ++
wxDbTable::operator --
wxDbTable(wxDb *pwxDb, const char *tblName, const int nCols,const char *qryTblName = 0, boolqryOnly = !wxDB_QUERY_ONLY,const char *tblPath=NULL)
Default constructor.
Parameters
pSqlStmt
virtual ~wxDbTable()
Virtual default destructor.
void BuildSelectStmt(char *pSqlStmt, int typeOfDel, const char *pWhereClause=0)
Parameters
pSqlStmt
void BuildSelectStmt(char *pSqlStmt, int typeOfSelect, bool distinct)
Parameters
pSqlStmt
void BuildSelectStmt(char *pSqlStmt, int typeOfUpd, const char *pWhereClause=0)
Parameters
pSqlStmt
void BuildSelectStmt(char *pWhereClause, int typeOfWhere, const char *qualTableName=0, const char *useLikeComparison=FALSE)
Parameters
pWhereClause
bool CanSelectForUpdate()
Remarks
bool CanUpdateByROWID()
Remarks
void ClearMemberVars()
Remarks
bool CloseCursor(HSTMTcursor)
Parameters
cursor
Remarks
ULONG Count(const char *args="*")
Parameters
args
Remarks
bool CreateIndex(const char *idxName, boolunique, int noIdxCols, wxDbIdxDef *pIdxDefs, bool attemptDrop=TRUE)
Parameters
idxName
Remarks
bool CreateTable(bool attemptDrop=TRUE)
Parameters
attemptDrop
Remarks
bool DB_STATUS()
Accessor function for the private member variable DB_STATUS.
bool IsColNull(int colNo)
Parameters
colNo
Remarks
bool Delete()
Remarks
bool DeleteCursor(HSTMT hstmtDel)
Parameters
hstmtDel
Remarks
bool DeleteWhere(const char *pWhereClause)
Parameters
pWhereClause
Remarks
bool DeleteMatching()
Remarks
bool DropIndex(const char *idxName)
Parameters
idxName
Remarks
bool DropTable()
Remarks
wxDbColDef * GetColDefs()
Remarks
HSTMT GetCursor()
Remarks
wxDb * GetDb()
Accessor function for the private member variable pDb which is a pointer to the datasource connection that this wxDbTable instance uses.
Remarks
bool GetFirst()
Remarks
This function can only be used if the datasource connection used by the wxDbTable instance was created with FwdOnlyCursors set to FALSE. If the connection does not allow backward scrolling cursors, this function will return FALSE, and the data contained in the bound columns will be undefined.
See also
const char * GetFromClause()
Accessor function that returns the current FROM setting assigned with the wxDbTable::SetFromClause.
bool GetLast()
Remarks
This function can only be used if the datasource connection used by the wxDbTable instance was created with FwdOnlyCursors set to FALSE. If the connection does not allow backward scrolling cursors, this function will return FALSE, and the data contained in the bound columns will be undefined.
See also
HSTMT * GetNewCursor(bool setCursor=FALSE, bool bindColumns=TRUE)
Parameters
setCursor
Remarks
bool GetNext()
Remarks
bool GetNumberOfColumns()
Accessor function that returns the number of columns that are statically bound for access by the wxDbTable instance.
const char * GetOrderByClause()
Accessor function that returns the current ORDER BY setting assigned with the wxDbTable::SetOrderByClause.
bool GetPrev()
Remarks
This function can only be used if the datasource connection used by the wxDbTable instance was created with FwdOnlyCursors set to FALSE. If the connection does not allow backward scrolling cursors, this function will return FALSE, and the data contained in the bound columns will be undefined.
See also
const char * GetQueryTableName()
Remarks
UWORD GetRowNum()
Remarks
const char * GetTableName()
Remarks
const char * GetTablePath()
Remarks
const char * GetWhereClause()
Accessor function that returns the current WHERE setting assigned with the wxDbTable::SetWhereClause
int Insert()
Remarks
bool IsCursorClosedOnCommit()
Remarks
bool IsQueryOnly()
Accessor function that returns a value indicating if this wxDbTable instance was created to allow only queries to be performed on the bound columns. If this function returns TRUE, then no actions may be performed using this wxDbTable instance that would modify (insert/delete/update) the table's data.
bool Open()
Remarks
virtual bool Query(boolforUpdate=FALSE, booldistinct=FALSE)
Parameters
forUpdate
Remarks
bool QueryBySqlStmt(const char *pSqlStmt)
Parameters
pSqlStmt
Remarks
virtual bool QueryMatching(boolforUpdate=FALSE, booldistinct=FALSE)
Parameters
forUpdate
Remarks
bool QueryOnKeyFields(boolforUpdate=FALSE, booldistinct=FALSE)
Parameters
forUpdate
Remarks
bool Refresh()
Remarks
void SetColDefs(int index, const char *fieldName, int dataType, void *pData, int cType, int size, bool keyField = FALSE, bool upd = TRUE, bool insAllow = TRUE, bool derivedCol = FALSE)
wxDbColDataPtr * SetColDefs(wxDbColInf *colInfs, ULONG numCols)
Parameters
index
colInfs
Remarks
bool Open(HSTMT *hstmtActivate = (void **) wxDB_DEFAULT_CURSOR)
Parameters
hstmtActivate
Remarks
void SetFromClause(const wxString&From)
Parameters
From
bool SetNull(int colNo)
bool SetNull(const char *colName)
Parameters
colNo
Remarks
void SetOrderByClause(const wxString&OrderBy)
Parameters
OrderBy
bool SetQueryTimeout(UDWORD nSeconds)
Parameters
nSeconds
Remarks
void SetWhereClause(const wxString&Where)
Parameters
Where
bool Update()
bool Update(const char *pSqlStmt)
Parameters
pSqlStmt
Remarks
bool UpdateWhere(const char *pWhereClause)
Parameters
pWhereClause
Remarks
bool operator ++()
Same as wxDbTable::GetNext
See also
bool operator --()
Same as wxDbTable::GetPrev
See also