.\" This is a wxWidgets manpage page generated from the XML docs .TH wxDb 3wx 2005-02-15 "wxWidgets" "wxWidgets class documentation" .SH NAME wxDb \- .SH DESCRIPTION TODO convert other information from TeX to XML .SH "PARENTS" .SH "INCLUDE FILES" .SH MEMBERS .SS wxDb () Default constructor. .SS wxDb (const HENV &aHenvbool FwdOnlyCursors = (bool)wxODBC\_FWD\_ONLY\_CURSORS) Constructor, used to create an ODBC connection to a datasource. .SS bool Catalog (wxChar * userIDconst wxString &fileName = SQL\_CATALOG\_FILENAME) Allows a data "dictionary" of the datasource to be created, dumping pertinent information about all data tables to which the user specified in userID has access. .SS void Close () Closes the database connection. .SS bool CommitTrans () Permanently "commits" changes (insertions/deletions/updates) to the database. .SS bool CreateView (const wxString & viewNameconst wxString & colListconst wxString &pSqlStmt) Creates a SQL VIEW of one or more tables in a single datasource. Note that this function will only work against databases which support views (currently only Oracle as of November 21 2000). .SS wxDBMS Dbms () .SS bool DispAllErrors (HENV aHenvHDBC aHdbc = SQL\_NULL\_HDBCHSTMT aHstmt = SQL\_NULL\_HSTMT) .SS void DispNextError () .SS bool DropView (const wxString &viewName) Drops the data table view named in 'viewName'. .SS bool ExecSql (const wxString &pSqlStmt) .SS bool ExecSql (const wxString &pSqlStmtwxDbColInf **columnsshort &numcols) .SS bool IsFwdOnlyCursors () Older form (pre-2.3/2.4 of wxWidgets) of the wxDb::IsFwdOnlyCursors . This method is provided for backward compatibility only. The method wxDb::IsFwdOnlyCursors should be used in place of this method. .SS wxDbInf * GetCatalog (const wxChar *userID) .SS wxDbInf * GetCatalog (const wxChar *userID) Returns a wxDbInf pointer that points to the catalog (datasource) name, schema, number of tables accessible to the current user, and a wxDbTableInf pointer to all data pertaining to all tables in the users catalog. userID == NULL ... UserID is ignored (DEFAULT) userID == "" ... UserID set equal to 'this->uid' userID != "" ... UserID set equal to 'userID' .SS int GetColumnCount (const wxString &tableNameconst wxChar *userID) userID == NULL ... UserID is ignored (DEFAULT) userID == "" ... UserID set equal to 'this->uid' userID != "" ... UserID set equal to 'userID' .SS wxDbColInf * GetColumns (const wxString &tableNameUWORD *numColsconst wxChar *userID = NULL) .SS wxDbColInf * GetColumns (wxChar *tableName[]const wxChar *userID) userID == NULL ... UserID is ignored (DEFAULT) userID == "" ... UserID set equal to 'this->uid' userID != "" ... UserID set equal to 'userID' .SS bool GetData (UWORD colNumberSWORD cTypePTR pDataSDWORD maxLenSDWORD FAR * cbReturned) .SS const wxChar * GetDatabaseName () Returns the name of the database engine. .SS const wxString & GetDatasourceName () Returns the ODBC datasource name. .SS HDBC GetHDBC () Returns the ODBC handle to the database connection. .SS HENV GetHENV () Returns the ODBC environment handle. .SS HSTMT GetHSTMT () Returns the ODBC statement handle associated with this database connection. .SS int GetKeyFields (const wxString &tableNamewxDbColInf *colInfUWORD numColumns) .SS bool GetNext () .SS bool GetNextError (HENV aHenvHDBC aHdbc = SQL\_NULL\_HDBCHSTMT aHstmt = SQL\_NULL\_HSTMT) .SS const wxString & GetPassword () Returns the password used to establish this connection to the datasource. .SS int GetTableCount () Returns the number of wxDbTable() instances currently using this datasource connection. .SS const wxString & GetUsername () Returns the user name (uid) used to establish this connection to the datasource. .SS bool Grant (int privilegesconst wxString &tableNameconst wxString &userList = "PUBLIC") Use this member function to GRANT privileges to users for accessing tables in the datasource. DB_GRANT_SELECT = 1 DB_GRANT_INSERT = 2 DB_GRANT_UPDATE = 4 DB_GRANT_DELETE = 8 DB_GRANT_ALL = DB_GRANT_SELECT | DB_GRANT_INSERT | DB_GRANT_UPDATE | DB_GRANT_DELETE .SS bool IsFwdOnlyCursors () .SS bool IsOpen () Indicates whether the database connection to the datasource is currently opened. .SS void LogError (const wxString &errMsgconst wxString &SQLState = "") .SS void ModifyColumn (const wxString &tableNameconst wxString &ColumnNameint dataTypeULONG columnLength = 0const wxString &optionalParam = "") Used to change certain properties of a column such as the length, or whether a column allows NULLs or not. .SS bool Open (const wxString &Dsnconst wxString &Uidconst wxString &AuthStrbool failOnDataTypeUnsupported) .SS bool Open (const wxString &inConnectStrbool failOnDataTypeUnsupported) .SS bool Open (wxDbConnectInf *dbConnectInfbool failOnDataTypeUnsupported) .SS bool Open (wxDb *copyDb) Opens a connection to the datasource, sets certain behaviors of the datasource to confirm to the accepted behaviors (e.g. cursor position maintained on commits), and queries the datasource for its representations of the basic datatypes to determine the form in which the data going to/from columns in the data tables are to be handled. The second form of this function, which accepts a "wxDb *" as a parameter, can be used to avoid the overhead (execution time, database load, network traffic) which are needed to determine the data types and representations of data that are necessary for cross-datasource support by these classes. Normally the first form of the wxDb::Open() function will open the connection and then send a series of queries to the datasource asking it for its representation of data types, and all the features it supports. If one connection to the datasource has already been made previously, the information gathered when that connection was created can just be copied to any new connections to the same datasource by passing a pointer to the first connection in as a parameter to the wxDb::Open() function. Note that this new connection created from the first connections information will use the same Dsn/Uid/AuthStr as the first connection used. .SS bool RollbackTrans () Function to "undo" changes made to the database. After an insert/update/delete, the operation may be "undone" by issuing this command any time before a wxDb::CommitTrans is called on the database connection. .SS void SetDebugErrorMessages (bool state) .SS bool SetSqlLogging (wxDbSqlLogState stateconst wxString &filename = SQL\_LOG\_FILENAMEbool append = false) .SS const wxString SQLColumnName (const char * colName) Returns the column name in a form ready for use in SQL statements. In most cases, the column name is returned verbatim. But some databases (e.g. MS Access, SQL Server, MSDE) allow for spaces in column names, which must be specially quoted. For example, if the datasource allows spaces in the column name, the returned string will have the correct enclosing marks around the name to allow it to be properly included in a SQL statement for the DBMS that is currently connected to with this connection. .SS const wxString SQLTableName (const char * tableName) Returns the table name in a form ready for use in SQL statements. In most cases, the table name is returned verbatim. But some databases (e.g. MS Access, SQL Server, MSDE) allow for spaces in table names, which must be specially quoted. For example, if the datasource allows spaces in the table name, the returned string will have the correct enclosing marks around the name to allow it to be properly included in a SQL statement for the data source that is currently connected to with this connection. .SS bool TableExists (const wxString &tableNameconst wxChar *userID = NULLconst wxString &path = "") Checks the ODBC datasource for the existence of a table. If a userID is specified, then the table must be accessible by that user (user must have at least minimal privileges to the table). userID == NULL ... UserID is ignored (DEFAULT) userID == "" ... UserID set equal to 'this->uid' userID != "" ... UserID set equal to 'userID' .SS bool TablePrivileges (const wxString &tableNameconst wxString &privconst wxChar *userID = NULLconst wxChar *schema = NULLconst wxString &path = "") Checks the ODBC datasource for the existence of a table. If a userID is specified, then the table must be accessible by that user (user must have at least minimal privileges to the table). SELECT : The connected user is permitted to retrieve data for one or more columns of the table. INSERT : The connected user is permitted to insert new rows containing data for one or more columns into the table. UPDATE : The connected user is permitted to update the data in one or more columns of the table. DELETE : The connected user is permitted to delete rows of data from the table. REFERENCES : Is the connected user permitted to refer to one or more columns of the table within a constraint (for example, a unique, referential, or table check constraint). userID == NULL ... NOT ALLOWED! userID == "" ... UserID set equal to 'this->uid' userID != "" ... UserID set equal to 'userID' schema == NULL ... Any owner (DEFAULT) schema == "" ... Owned by 'this->uid' schema != "" ... Owned by userID specified in 'schema' .SS int TranslateSqlState (const wxString &SQLState) Converts an ODBC sqlstate to an internal error code. .SS bool WriteSqlLog (const wxString &logMsg) .SH "SEE ALSO" .SH "AUTHORS" Documentation content by Julian Smart, Robert Roebling, Vadim Zeitlin, Robin Dunn, et al Conversion to manpage format by Arnout Engelen (http://bzzt.net), bugreports welcome.