X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/55842641bb8da2bf946af1466b4e00e245444af1..afbe906abdf9aa69a56571b8b20b095351dd8f34:/docs/latex/wx/db.tex?ds=inline diff --git a/docs/latex/wx/db.tex b/docs/latex/wx/db.tex index edfc8ef422..65d6f3e267 100644 --- a/docs/latex/wx/db.tex +++ b/docs/latex/wx/db.tex @@ -6,12 +6,10 @@ database connection allows function to be performed directly on the datasource, as well as allowing access to any tables/views defined in the datasource to which the user has sufficient privileges. - \wxheading{Include files} - \wxheading{Helper classes and data structures} The following classes and structs are defined in db.cpp/.h for use with the wxDb class. @@ -23,13 +21,11 @@ The following classes and structs are defined in db.cpp/.h for use with the wxDb \item \helpref{wxDbInf}{wxdbinf} \end{itemize} - \wxheading{Constants} -NOTE: In a future release, all ODBC class constants will be prefaced with 'wx' +NOTE: In a future release, all ODBC class constants will be prefaced with 'wx'. \begin{verbatim} - wxDB_PATH_MAX Maximum path length allowed to be passed to the ODBC driver to indicate where the data file(s) are located. @@ -57,8 +53,8 @@ NOTE: In a future release, all ODBC class constants will be prefaced with 'wx' data type \end{verbatim} - \subsection{Enumerated types}\label{wxdbenumeratedtypes} + \wxheading{Enumerated types} \docparam{enum {\bf wxDbSqlLogState}}{sqlLogOFF, sqlLogON} @@ -196,16 +192,16 @@ functions (e.g. have been added for ease of use.} \begin{verbatim} - char dbmsName[40] - Name of the dbms product - char dbmsVer[64] - Version # of the dbms product - char driverName[40] - Driver name - char odbcVer[60] - ODBC version of the driver - char drvMgrOdbcVer[60] - ODBC version of the driver manager - char driverVer[60] - Driver version - char serverName[80] - Server Name, typically a connect string - char databaseName[128] - Database filename - char outerJoins[2] - Does datasource support outer joins - char procedureSupport[2] - Does datasource support stored + wxChar dbmsName[40] - Name of the dbms product + wxChar dbmsVer[64] - Version # of the dbms product + wxChar driverName[40] - Driver name + wxChar odbcVer[60] - ODBC version of the driver + wxChar drvMgrOdbcVer[60] - ODBC version of the driver manager + wxChar driverVer[60] - Driver version + wxChar serverName[80] - Server Name, typically a connect string + wxChar databaseName[128] - Database filename + wxChar outerJoins[2] - Does datasource support outer joins + wxChar procedureSupport[2] - Does datasource support stored procedures UWORD maxConnections - Maximum # of connections datasource supports @@ -218,7 +214,7 @@ have been added for ease of use.} rollback UWORD supportNotNullClause - Does datasource support NOT NULL clause - char supportIEF[2] - Integrity Enhancement Facility (Ref. + wxChar supportIEF[2] - Integrity Enhancement Facility (Ref. Integrity) UDWORD txnIsolation - Transaction isolation level supported by driver @@ -240,17 +236,22 @@ have been added for ease of use.} request \end{verbatim} -\docparam{char {\bf wxDb::errorList}[DB_MAX_ERROR_HISTORY][DB_MAX_ERROR_MSG_LEN]}{The last n ODBC errors that have occurred on this database connection.} +\docparam{wxChar {\bf wxDb::errorList}[DB\_MAX\_ERROR\_HISTORY][DB\_MAX\_ERROR\_MSG\_LEN]}{The last n ODBC errors that have occurred on this database connection.} -\docparam{char {\bf wxDb::errorMsg}[SQL_MAX_MESSAGE_LENGTH]}{This member variable is populated as a result of calling \helpref{wxDb::GetNextError}{wxdbgetnexterror}. It contains the ODBC error message text.} +\docparam{wxChar {\bf wxDb::errorMsg}[SQL\_MAX\_MESSAGE\_LENGTH]}{This member variable is populated as a result of calling \helpref{wxDb::GetNextError}{wxdbgetnexterror}. It contains the ODBC error message text.} -\docparam{SDWORD {\bf wxDb::nativeError}}{Set by wxDb::DispAllErrors, wxDb::GetNextError, and wxDb::DispNextError. It contains the datasource-specific error code returned by the datasource to the ODBC driver. Used for reporting ODBC errors.} +\docparam{SDWORD {\bf wxDb::nativeError}}{Set by wxDb::DispAllErrors, +wxDb::GetNextError, and wxDb::DispNextError. It contains the +datasource-specific error code returned by the datasource to the ODBC driver. +Used for reporting ODBC errors.} -\docparam{wxChar {\bf wxDb::sqlState}[20]}{Set by wxDb::TranslateSqlState(). Indicates the error state after a failed ODBC operation. Used for reporting ODBC errors.} +\docparam{wxChar {\bf wxDb::sqlState}[20]}{Set by wxDb::TranslateSqlState(). +Indicates the error state after a failed ODBC operation. Used for reporting +ODBC errors.} \wxheading{Remarks} -Default cursor scrolling is defined by wxODBC_FWD_ONLY_CURSORS in setup.h +Default cursor scrolling is defined by wxODBC\_FWD\_ONLY\_CURSORS in setup.h when the wxWindows library is built. This behavior can be overridden when an instance of a wxDb is created (see \helpref{wxDb constructor}{wxdbconstr}). Default setting of this value TRUE, as not all databases/drivers support @@ -258,13 +259,58 @@ both types of cursors. \wxheading{See also} -\helpref{wxDbColFor}{wxdbcolfor}, \helpref{wxDbColInf}{wxdbcolinf}, \helpref{wxDbTable}{wxdbtable}, \helpref{wxDbTableInf}{wxdbtableinf}, \helpref{wxDbInf}{wxdbinf} +\helpref{wxDbColFor}{wxdbcolfor}, \helpref{wxDbColInf}{wxdbcolinf}, +\helpref{wxDbTable}{wxdbtable}, \helpref{wxDbTableInf}{wxdbtableinf}, +\helpref{wxDbInf}{wxdbinf} \subsection{Associated non-class functions}\label{wxdbfunctions} The following functions are used in conjunction with the wxDb class. -\func{wxDb *}{wxDbGetConnection}{\param{wxDbConnectInf *}{pDbConfig}, \param{bool }{FwdOnlyCursors=(bool)wxODBC_FWD_ONLY_CURSORS}} + +\func{void}{wxDbCloseConnections}{\void} + +\wxheading{Remarks} + +Closes all cached connections that have been made through use of the +\helpref{wxDbGetConnection}{wxdbfunctions} function. + +NOTE: These connections are closed regardless of whether they are in use +or not. This function should only be called after the program has +finished using the connections and all wxDbTable instances that use any of +the connections have been closed. + +This function performs a \helpref{wxDb::CommitTrans}{wxdbcommittrans} +on the connection before closing it to commit any changes that are still +pending, as well as to avoid any function sequence errors upon closing +each connection. + + +\func{int }{wxDbConnectionsInUse}{\void} + +\wxheading{Remarks} + +Returns a count of how many database connections are currently free ( not +being used) that have been cached through use of the \helpref{wxDbGetConnection}{wxdbfunctions} +function. + + +\func{bool}{wxDbFreeConnection}{\param{wxDb *}{pDb}} + +\wxheading{Remarks} + +Searches the list of cached database connections connection for one matching +the passed in wxDb instance. If found, that cached connection is freed. + +Freeing a connection means that it is marked as available (free) in the +cache of connections, so that a call to \helpref{wxDbGetConnection}{wxdbfunctions} +is able to return a pointer to the wxDb instance for use. Freeing a +connection does NOT close the connection, it only makes the connection +available again. + + +\func{wxDb *}{wxDbGetConnection}{\param{wxDbConnectInf *}{pDbConfig}, +\param{bool }{FwdOnlyCursors=(bool)wxODBC\_FWD\_ONLY\_CURSORS}} \wxheading{Remarks} @@ -296,7 +342,7 @@ other connection(s) for that same datasource. This cuts down greatly on network traffic, database load, and connection creation time. When the program is done using a connection created through a call to -wxDbGetConnection(), the program shoudl call wxDbFreeConnection() to release +wxDbGetConnection(), the program should call wxDbFreeConnection() to release the wxDb instance back to the cache. DO NOT DELETE THE wxDb INSTANCE! Deleting the wxDb instance returned can cause a crash/memory corruption later in the program when the cache is cleaned up. @@ -305,55 +351,20 @@ When exiting the program, call wxDbCloseConnections() to close all the cached connections created by calls to wxDbGetConnection(). -\func{bool}{wxDbFreeConnection}{\param{wxDb *}{pDb}} - -\wxheading{Remarks} - -Searches the list of cached database connections connection for one matching -the passed in wxDb instance. If found, that cached connection is freed. - -Freeing a connection means that it is marked as available (free) in the -cache of connections, so that a call to \helpref{wxDbGetConnection}{wxdbfunctions} -is able to return a pointer to the wxDb instance for use. Freeing a -connection does NOT close the connection, it only makes the connection -available again. - - -\func{void}{wxDbCloseConnections}{\void} - -\wxheading{Remarks} - -Closes all cached connections that have been made through use of the -\helpref{wxDbGetConnection}{wxdbfunctions} function. - -NOTE: These connections are closed regardless of whether they are in use -or not. This function should only be called after the program has -finished using the connections and all wxDbTable instances that use any of -the connections have been closed. - -This function performs a \helpref{wxDb::CommitTrans}{wxdbcommittrans} -on the connection before closing it to commit any changes that are still -pending, as well as to avoid any function sequence errors upon closing -each connection. - - -\func{int }{wxDbConnectionsInUse}{\void} - -\wxheading{Remarks} +\func{const wxChar *}{wxDbLogExtendedErrorMsg}{\param{const wxChar *}{userText}, \param{wxDb *}{pDb}, \param{wxChar *}{ErrFile}, \param{int }{ErrLine}} -Returns a count of how many database connections are currently free ( not -being used) that have been cached through use of the \helpref{wxDbGetConnection}{wxdbfunctions} -function. +Writes a message to the wxLog window (stdout usually) when an internal +error situation occurs. This function only works in DEBUG builds -\func{bool}{wxDbSqlLog}{\param{wxDbSqlLogState }{state}, \param{const wxChar *}{filename = SQL_LOG_FILENAME}} +\func{bool}{wxDbSqlLog}{\param{wxDbSqlLogState }{state}, \param{const wxString &}{filename = SQL\_LOG\_FILENAME}} \wxheading{Remarks} This function sets the sql log state for all open wxDb objects -\func{bool}{wxDbGetDataSource}{\param{HENV }{henv}, \param{char *}{Dsn}, \param{SWORD }{DsnMax}, \param{char *}{DsDesc}, \param{SWORD }{DsDescMax}, \param{UWORD }{direction = SQL_FETCH_NEXT}} +\func{bool}{wxDbGetDataSource}{\param{HENV }{henv}, \param{wxChar *}{Dsn}, \param{SWORD }{DsnMax}, \param{wxChar *}{DsDesc}, \param{SWORD }{DsDescMax}, \param{UWORD }{direction = SQL\_FETCH\_NEXT}} \wxheading{Remarks} @@ -363,7 +374,7 @@ available through the ODBC driver manager on the current workstation. wxStringList strList; - while (wxDbGetDataSource(DbConnectInf.Henv, Dsn, SQL_MAX_DSN_LENGTH+1, DsDesc, 255)) + while (wxDbGetDataSource(DbConnectInf.GetHenv(), Dsn, SQL\_MAX\_DSN\_LENGTH+1, DsDesc, 255)) strList.Add(Dsn); @@ -375,15 +386,17 @@ available through the ODBC driver manager on the current workstation. Default constructor. -\func{}{wxDb}{\param{HENV &}{aHenv}, \param{bool }{FwdOnlyCursors=(bool)wxODBC_FWD_ONLY_CURSORS}} +\func{}{wxDb}{\param{const HENV &}{aHenv}, \param{bool }{FwdOnlyCursors=(bool)wxODBC\_FWD\_ONLY\_CURSORS}} Constructor, used to create an ODBC connection to a datasource. \wxheading{Parameters} -\docparam{aHenv}{Environment handle used for this connection.} +\docparam{aHenv}{Environment handle used for this connection. See +\helpref{wxDConnectInf::AllocHenv}{wxdbconnectinfallochenv}} -\docparam{FwdOnlyCursors}{Will cursors created for use with this datasource connection only allow forward scrolling cursors.} +\docparam{FwdOnlyCursors}{Will cursors created for use with this datasource +connection only allow forward scrolling cursors.} \wxheading{Remarks} @@ -396,8 +409,9 @@ be created and opened before any database activity can occur. wxDbConnectInf ConnectInf; ....Set values for member variables of ConnectInf here - wxDb sampleDB(ConnectInf.Henv); - if (!sampleDB.Open(ConnectInf.Dsn, ConnectInf.Uid, ConnectInf.AuthStr)) + wxDb sampleDB(ConnectInf.GetHenv()); + if (!sampleDB.Open(ConnectInf.GetDsn(), ConnectInf.GetUserID(), + ConnectInf.GetPassword())) { // Error opening datasource } @@ -410,16 +424,20 @@ be created and opened before any database activity can occur. \membersection{wxDb::Catalog}\label{wxdbcatalog} -\func{bool}{Catalog}{\param{char *}{ userID}, \param{char *}{fileName = SQL_CATALOG_FILENAME}} +\func{bool}{Catalog}{\param{wxChar *}{ userID}, \param{const 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. +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. \wxheading{Parameters} -\docparam{userID}{Database user name to use in accessing the database. All tables to which this user has rights will be evaluated in the catalog.} +\docparam{userID}{Database user name to use in accessing the database. All +tables to which this user has rights will be evaluated in the catalog.} \docparam{fileName}{{\it OPTIONAL}. Name of the text file to create and write -the DB catalog to. Default is SQL_CATALOG_FILENAME.} +the DB catalog to. Default is SQL\_CATALOG\_FILENAME.} \wxheading{Return value} @@ -448,9 +466,12 @@ Closes the database connection. \wxheading{Remarks} -At the end of your program, when you have finished all of your database work, you must close the ODBC connection to the datasource. There are actually four steps involved in doing this as illustrated in the example. +At the end of your program, when you have finished all of your database work, +you must close the ODBC connection to the datasource. There are actually +four steps involved in doing this as illustrated in the example. -Any wxDbTable instances which use this connection must be deleted before closing the database connection. +Any wxDbTable instances which use this connection must be deleted before +closing the database connection. \wxheading{Example} @@ -463,19 +484,6 @@ Any wxDbTable instances which use this connection must be deleted before closing // Close the wxDb connection when finished with it sampleDB.Close(); - - // Free Environment Handle that ODBC uses - // - // Be certain that no wxDb instances still exist - // that were created using this handle! If you - // use wxDbGetConnection() to get all the wxDb - // instances, you can use wxDbConnectionsInUse() - // to find out if any connections have not been - // closed before calling this - if (SQLFreeEnv(Db.Henv) != SQL_SUCCESS) - { - // Error freeing environment handle - } \end{verbatim} @@ -499,7 +507,7 @@ them by calling this function. Calling this member function commits ALL open transactions on this ODBC connection. For example, if three different wxDbTable instances used the -same connection to the datasource, commiting changes made on one of those +same connection to the datasource, committing changes made on one of those wxDbTable instances commits any pending transactions on all three wxDbTable instances. @@ -509,27 +517,30 @@ to see any changes made to the row(s) that have been inserted/modified/deleted. \wxheading{Special Note : {\it Cursors} } -\normalbox{It is important to understand that different database/ODBC driver combinations handle -transactions differently. One thing in particular that you must pay attention to is -cursors, in regard to transactions. Cursors are what allow you to scroll through -records forward and backward and to manipulate records as you scroll through them. -When you issue a query, a cursor is created behind the scenes. The cursor keeps track -of the query and keeps track of the current record pointer. After you commit or -rollback a transaction, the cursor may be closed automatically. This is database +\normalbox{It is important to understand that different database/ODBC driver +combinations handle transactions differently. One thing in particular that +you must pay attention to is cursors, in regard to transactions. Cursors are +what allow you to scroll through records forward and backward and to +manipulate records as you scroll through them. When you issue a query, a +cursor is created behind the scenes. The cursor keeps track of the query and +keeps track of the current record pointer. After you commit or rollback a +transaction, the cursor may be closed automatically. This is database dependent, and with some databases this behavior can be controlled through -management functions. This means you would need to -requery the datasource before you can perform any additional work using this -cursor. This is only necessary however if the datasource closes the cursor after a -commit or rollback. Use the \helpref{wxDbTable::IsCursorClosedOnCommit}{wxdbtableiscursorclosedoncommit} member function to -determine the datasource's transaction behavior. Note, in many situations -it is very inefficient to assume the cursor is closed and always requery. This could put -a significant, unnecessary load on datasources that leave the cursors open after a -transaction.} +management functions. This means you would need to requery the datasource +before you can perform any additional work using this cursor. This is only +necessary however if the datasource closes the cursor after a commit or +rollback. Use the +\helpref{wxDbTable::IsCursorClosedOnCommit}{wxdbtableiscursorclosedoncommit} +member function to determine the datasource's transaction behavior. Note, in +many situations it is very inefficient to assume the cursor is closed and +always requery. This could put a significant, unnecessary load on datasources +that leave the cursors open after a transaction.} \membersection{wxDb::CreateView}\label{wxdbcreateviews} -\func{bool}{CreateView}{\param{char *}{ viewName}, \param{char *}{ colList}, \param{char *}{pSqlStmt}} +\func{bool}{CreateView}{\param{const wxString &}{ viewName}, +\param{const wxString &}{ colList}, \param{const 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 @@ -537,20 +548,24 @@ only Oracle as of November 21 2000). \wxheading{Parameters} -\docparam{viewName}{The name of the view. e.g. PARTS_V} +\docparam{viewName}{The name of the view. e.g. PARTS\_V} \docparam{colList}{{\it OPTIONAL} Pass in a comma delimited list of column names if you wish to explicitly name each column in the result set. If not desired, pass in an empty string and the column names from the associated table(s) will be used.} -\docparam{pSqlStmt}{Pointer to the select statement portion of the CREATE VIEW statement. Must be a complete, valid SQL SELECT statement.} +\docparam{pSqlStmt}{Pointer to the select statement portion of the CREATE +VIEW statement. Must be a complete, valid SQL SELECT statement.} \wxheading{Remarks} -A 'view' is a logical table that derives columns from one or more other tables or views. Once the view is created, it can be queried exactly like any other table in the database. +A 'view' is a logical table that derives columns from one or more other +tables or views. Once the view is created, it can be queried exactly like +any other table in the database. -NOTE: Views are not available with all datasources. Oracle is one example of a datasource which does support views. +NOTE: Views are not available with all datasources. Oracle is one example +of a datasource which does support views. \wxheading{Example} @@ -594,7 +609,8 @@ datasource is not recognized, a value of 'dbmsUNIDENTIFIED' is returned. \membersection{wxDb::DispAllErrors}\label{wxdbdispallerrors} -\func{bool}{DispAllErrors}{\param{HENV}{ aHenv}, {\param}{HDBC}{ aHdbc = SQL_NULL_HDBC}, {\param}{HSTMT}{ aHstmt = SQL_NULL_HSTMT}} +\func{bool}{DispAllErrors}{\param{HENV}{ aHenv}, {\param}{HDBC} +{ aHdbc = SQL\_NULL\_HDBC}, {\param}{HSTMT}{ aHstmt = SQL\_NULL\_HSTMT}} Used to log all database errors that occurred as a result of an executed database command. This logging is automatic and also includes debug logging @@ -606,9 +622,11 @@ entry is also logged to the defined log file. \docparam{aHenv}{Handle to the ODBC environment.} -\docparam{aHdbc}{Handle to the ODBC connection. Pass this in if the ODBC function call that erred required a hdbc or hstmt argument.} +\docparam{aHdbc}{Handle to the ODBC connection. Pass this in if the ODBC +function call that erred required a hdbc or hstmt argument.} -\docparam{aHstmt}{Handle to the ODBC statement being executed against. Pass this in if the ODBC function call that erred out required a hstmt argument.} +\docparam{aHstmt}{Handle to the ODBC statement being executed against. Pass +this in if the ODBC function call that erred out required a hstmt argument.} \wxheading{Remarks} @@ -665,7 +683,7 @@ one in context and displaying the ones you choose. // Check for sqlState = S0002, "Table or view not found". // Ignore this error, bomb out on any other error. pDb->GetNextError(henv, hdbc, hstmt); - if (strcmp(pDb->sqlState, "S0002")) + if (wxStrcmp(pDb->sqlState, "S0002")) { pDb->DispNextError(); // Displayed error retrieved pDb->DispAllErrors(henv, hdbc, hstmt); // Display all other errors, if any @@ -679,7 +697,7 @@ one in context and displaying the ones you choose. \membersection{wxDb::DropView}\label{wxdbdropview} -\func{bool}{DropView}{\param{const char *}{viewName}} +\func{bool}{DropView}{\param{const wxString &}{viewName}} Drops the data table view named in 'viewName'. @@ -693,7 +711,8 @@ If the view does not exist, this function will return TRUE. Note that views are \membersection{wxDb::ExecSql}\label{wxdbexecsql} -\func{bool}{ExecSql}{\param{char *}{pSqlStmt}} + +\func{bool}{ExecSql}{\param{const wxString &}{pSqlStmt}} Allows a native SQL command to be executed directly against the datasource. In addition to being able to run any standard SQL command, use of this function allows a user to (potentially) utilize features specific to the datasource they are connected to that may not be available through ODBC. The ODBC driver will pass the specified command directly to the datasource. @@ -713,9 +732,22 @@ of processing. \helpref{wxDb::GetData}{wxdbgetdata}, \helpref{wxDb::GetNext}{wxdbgetnext} +\membersection{wxDb::FwdOnlyCursors}\label{wxdbfwdonlycursors} + +\func{bool}{IsFwdOnlyCursors}{\void} + +Older form (pre-2.3/2.4 of wxWindows) of the +\helpref{wxDb::IsFwdOnlyCursors}{wxdbisfwdonlycursors}. This method is +provided for backward compatability only. The method +\helpref{wxDb::IsFwdOnlyCursors}{wxdbisfwdonlycursors} should be +used in place of this method. + + +\func{wxDbInf *}{GetCatalog}{\param{const wxChar *}{userID}} + \membersection{wxDb::GetCatalog}\label{wxdbgetcatalog} -\func{wxDbInf *}{GetCatalog}{\param{char *}{userID}} +\func{wxDbInf *}{GetCatalog}{\param{const wxChar *}{userID}} Returns a \helpref{wxDbInf}{wxdbinf} pointer that points to the catalog (datasource) name, schema, number of tables accessible to the current user, @@ -738,13 +770,16 @@ The returned catalog will only contain catalog entries for tables to which the u \membersection{wxDb::GetColumnCount}\label{wxdbgetcolumncount} -\func{int }{GetColumnCount}{\param{char *}{tableName}, \param{const char *}{userID}} +\func{int }{GetColumnCount}{\param{const wxString &}{tableName}, \param{const wxChar *}{userID}} \wxheading{Parameters} \docparam{tableName}{The table name you wish to obtain column information about.} -\docparam{userID}{Name of the user that owns the table(s) (also referred to as schema). Required for some datasources for situations where there may be multiple tables with the same name in the datasource, but owned by different users. {\it userID} is evaluated in the following manner:} +\docparam{userID}{Name of the user that owns the table(s) (also referred to as schema). +Required for some datasources for situations where there may be multiple tables with the +same name in the datasource, but owned by different users. {\it userID } is +evaluated in the following manner:} \begin{verbatim} userID == NULL ... UserID is ignored (DEFAULT) @@ -759,14 +794,14 @@ occurs retrieving the number of columns, this function will return a -1. \membersection{wxDb::GetColumns}\label{wxdbgetcolumns} -\func{wxDbColInf *}{GetColumns}{\param{char *}{tableName}, \param{int *}{numCols}, \param{const char *}{userID=NULL}} +\func{wxDbColInf *}{GetColumns}{\param{const wxString &}{tableName}, \param{UWORD *}{numCols}, \param{const wxChar *}{userID=NULL}} -\func{wxDbColInf *}{GetColumns}{\param{char *}{tableName[]}, \param{const char *}{userID}} +\func{wxDbColInf *}{GetColumns}{\param{wxChar *}{tableName[]}, \param{const wxChar *}{userID}} \wxheading{Parameters} \docparam{tableName}{The table name you wish to obtain column information about.} -\docparam{numCols}{Pointer to an integer which will hold a count of the number of columns returned by this function} +\docparam{numCols}{Pointer to a UWORD which will hold a count of the number of columns returned by this function} \docparam{tableName[]}{An array of pointers to table names you wish to obtain column information about. The last element of this array must be a NULL string.} \docparam{userID}{Name of the user that owns the table(s) (also referred to as schema). Required for some datasources for situations where there may be multiple tables with the same name in the datasource, but owned by different users. {\it userID} is evaluated in the following manner:} @@ -798,7 +833,7 @@ to avoid undesired unbinding of columns.} \wxheading{Example} \begin{verbatim} - char *tableList[] = {"PARTS", 0}; + wxChar *tableList[] = {"PARTS", 0}; wxDbColInf *colInf = pDb->GetColumns(tableList); if (colInf) { @@ -812,17 +847,27 @@ to avoid undesired unbinding of columns.} \membersection{wxDb::GetData}\label{wxdbgetdata} -\func{bool}{GetData}{\param{UWORD}{ colNo}, \param{SWORD}{ cType}, \param{PTR}{ pData}, \param{SDWORD}{ maxLen}, \param{SDWORD FAR *}{ cbReturned} } +\func{bool}{GetData}{\param{UWORD}{ colNo}, \param{SWORD}{ cType}, +\param{PTR}{ pData}, \param{SDWORD}{ maxLen}, \param{SDWORD FAR *}{ cbReturned} } -Used to retrieve result set data without binding column values to memory variables (i.e. not using a wxDbTable instance to access table data). +Used to retrieve result set data without binding column values to memory +variables (i.e. not using a wxDbTable instance to access table data). \wxheading{Parameters} -\docparam{colNo}{Ordinal number of the desired column in the result set to be returned.} -\docparam{cType}{The C data type that is to be returned. See a partial list in \helpref{wxDbTable::SetColDefs}{wxdbtablesetcoldefs}} -\docparam{pData}{Memory buffer which will hold the data returned by the call to this function.} -\docparam{maxLen}{Maximum size of the buffer {\it 'pData'} in characters. NOTE: Not UNICODE safe. If this is a numeric field, a value of 0 may be passed for this parameter, as the API knows the size of the expected return value.} -\docparam{cbReturned}{Pointer to the buffer containing the length of the actual data returned. If this value comes back as SQL_NULL_DATA, then the wxDb::GetData() call has failed.} +\docparam{colNo}{Ordinal number of the desired column in the result set to be +returned.} +\docparam{cType}{The C data type that is to be returned. See a partial list +in \helpref{wxDbTable::SetColDefs}{wxdbtablesetcoldefs}} +\docparam{pData}{Memory buffer which will hold the data returned by the call +to this function.} +\docparam{maxLen}{Maximum size of the buffer {\it 'pData'} in characters. +NOTE: Not UNICODE safe. If this is a numeric field, a value of 0 may be +passed for this parameter, as the API knows the size of the expected return +value.} +\docparam{cbReturned}{Pointer to the buffer containing the length of the +actual data returned. If this value comes back as SQL\_NULL\_DATA, then the +\helpref{wxDb::GetData}{wxdbgetdata} call has failed.} \wxheading{See also} @@ -872,13 +917,13 @@ sequence (1,2,3 or 1,3 or 2,3). \membersection{wxDb::GetDatabaseName}\label{wxdbgetdatabasename} -\func{const char *}{GetDatabaseName}{\void} +\func{const wxChar *}{GetDatabaseName}{\void} Returns the name of the database engine. \membersection{wxDb::GetDatasourceName}\label{wxdbgetdatasourcename} -\func{const char *}{GetDatasourceName}{\void} +\func{const wxString &}{GetDatasourceName}{\void} Returns the ODBC datasource name. @@ -902,7 +947,7 @@ Returns the ODBC statement handle associated with this database connection. \membersection{wxDb::GetKeyFields}\label{wxdbgetkeyfields} -\func{int }{GetKeyFields}{\param{char *}{tableName}, \param{wxDbColInf *}{colInf}, \param{int }{nocols}} +\func{int }{GetKeyFields}{\param{const wxString &}{tableName}, \param{wxDbColInf *}{colInf}, \param{UWORD }{nocols}} Used to determine which columns are members of primary or non-primary indexes on the specified table. If a column is a member of a foreign key for some other table, that information is detected also. @@ -935,19 +980,17 @@ in the result set after the current position of the cursor. \membersection{wxDb::GetNextError}\label{wxdbgetnexterror} -\func{bool}{GetNextError}{\param{HENV}{ aHenv}, \param{HDBC}{ aHdbc = SQL_NULL_HDBC}, \param{HSTMT}{ aHstmt = SQL_NULL_HSTMT}} +\func{bool}{GetNextError}{\param{HENV}{ aHenv}, +\param{HDBC}{ aHdbc = SQL\_NULL\_HDBC}, \param{HSTMT}{ aHstmt = SQL\_NULL\_HSTMT}} \wxheading{Parameters} \docparam{aHenv}{A handle to the ODBC environment.} -\docparam{aHdbc}{{\it OPTIONAL.} A handle to the ODBC connection. Pass this in if the ODBC function call that -erred out required a hdbc or hstmt argument.} -\docparam{AHstmt}{{\it OPTIONAL.}A handle to the ODBC statement being executed against. Pass this in if the -ODBC function call that erred out requires a hstmt argument.} - -\wxheading{See also} - -\helpref{wxDb::DispNextError}{wxdbdispnexterror}, \helpref{wxDb::DispAllErrors}{wxdbdispallerrors} +\docparam{aHdbc}{{\it OPTIONAL.} A handle to the ODBC connection. Pass this +in if the ODBC function call that erred out required a hdbc or hstmt argument.} +\docparam{AHstmt}{{\it OPTIONAL.}A handle to the ODBC statement being executed +against. Pass this in if the ODBC function call that erred out requires a +hstmt argument.} \wxheading{Example} @@ -959,10 +1002,15 @@ ODBC function call that erred out requires a hstmt argument.} } \end{verbatim} +\wxheading{See also} + +\helpref{wxDb::DispNextError}{wxdbdispnexterror}, +\helpref{wxDb::DispAllErrors}{wxdbdispallerrors} + \membersection{wxDb::GetPassword}\label{wxdbgetpassword} -\func{const char *}{GetPassword}{\void} +\func{const wxString &}{GetPassword}{\void} Returns the password used to establish this connection to the datasource. @@ -971,25 +1019,31 @@ Returns the password used to establish this connection to the datasource. \func{int }{GetTableCount}{\void} -Returns the number of wxDbTable() instances currently using this datasource connection. +Returns the number of wxDbTable() instances currently using this datasource +connection. \membersection{wxDb::GetUsername}\label{wxdbgetusername} -\func{const char *}{GetUsername}{\void} +\func{const wxString &}{GetUsername}{\void} -Returns the user name (uid) used to establish this connection to the datasource. +Returns the user name (uid) used to establish this connection to the +datasource. \membersection{wxDb::Grant}\label{wxdbgrant} -\func{bool}{Grant}{\param{int }{privileges}, \param{char *}{tableName}, \param{char *}{userList = "PUBLIC"}} +\func{bool}{Grant}{\param{int }{privileges}, \param{const wxString &}{tableName}, +\param{const wxString &}{userList = "PUBLIC"}} -Use this member function to GRANT privileges to users for accessing tables in the datasource. +Use this member function to GRANT privileges to users for accessing tables in +the datasource. \wxheading{Parameters} -\docparam{privileges}{Use this argument to select which privileges you want to grant. Pass DB_GRANT_ALL to grant all privileges. To grant individual privileges pass one or more of the following OR'd together:} +\docparam{privileges}{Use this argument to select which privileges you want to +grant. Pass DB\_GRANT\_ALL to grant all privileges. To grant individual +privileges pass one or more of the following OR'd together:} \begin{verbatim} DB_GRANT_SELECT = 1 @@ -1035,7 +1089,7 @@ to use forward scrolling cursors. The default setting of whether a wxDb connection to a database allows forward-only or also backward scrolling cursors is defined in setup.h by the -value of wxODBC_FWD_ONLY_CURSORS. This default setting can be overridden +value of wxODBC\_FWD\_ONLY\_CURSORS. This default setting can be overridden when the wxDb connection is initially created (see \helpref{wxDb constructor}{wxdbconstr} and \helpref{wxDbGetConnection}{wxdbfunctions}). @@ -1083,7 +1137,7 @@ partial failures to open a connection instance. \membersection{wxDb::LogError}\label{wxdblogerror} -\func{void}{LogError}{\param{const char *}{errMsg} \param{const char *}{SQLState=NULL}} +\func{void}{LogError}{\param{const wxString &}{errMsg} \param{const wxString &}{SQLState=""}} \docparam{errMsg}{Free-form text to display describing the error/text to be logged.} \docparam{SQLState}{{\it OPTIONAL.} Native SQL state error. Default is 0.} @@ -1102,9 +1156,47 @@ text into the SQL log file. \helpref{wxDb::WriteSqlLog}{wxdbwritesqllog} +\membersection{wxDb::ModifyColumn}\label{wxdbmodifycolumn} + +\func{void}{ModifyColumn}{\param{const wxString &}{tableName} \param{const wxString &}{ColumnName} +\param{int }{dataType} \param{ULONG }{columnLength=0} \param{const wxString &}{optionalParam=""}} + +Used to change certain properties of a column such as the length, or whether a column +allows NULLs or not. + +\docparam{tableName}{Name of the table that the column to be modified is in.} +\docparam{columnName}{Name of the column to be modified. NOTE: Name of column cannot +be changed with this function.} +\docparam{dataType}{Any one of DB\_DATA\_TYPE\_VARCHAR, DB\_DATA\_TYPE\_INTEGER, +DB\_DATA\_TYPE\_FLOAT, DB\_DATA\_TYPE\_DATE.} +\docparam{columnLength}{New size of the column. Valid only for DB\_DATA\_TYPE\_VARCHAR +dataType fields. Default is 0.} +\docparam{optionalParam}{Default is "".} + +\wxheading{Remarks} + +Cannot be used to modify the precision of a numeric column, therefore 'columnLength' +is ignored unless the dataType is DB\_DATA\_TYPE\_VARCHAR. + +Some datasources do not allow certain properties of a column to be changed if any rows +currently have data stored in that column. Those datasources that do allow columns +to be changed with data in the rows many handle truncation and/or expansion in +different ways. Please refer to the reference material for the datasource being +used for behavioral descriptions. + +\wxheading{Example} + +\begin{verbatim} + ok = pDb->ModifyColumn("CONTACTS", "ADDRESS2", + DB_, colDefs[j].SzDataObj, + wxT("NOT NULL")); +\end{verbatim} + + \membersection{wxDb::Open}\label{wxdbopen} -\func{bool}{Open}{\param{char *}{Dsn}, \param{char *}{Uid}, \param{char *}{AuthStr}} +\func{bool}{Open}{\param{const wxString &}{Dsn}, \param{const wxString &}{Uid}, +\param{const wxString &}{AuthStr}} \func{bool}{Open}{\param{wxDb *}{copyDb}} @@ -1177,7 +1269,7 @@ must maintain the memory for these three strings for the life of the wxDb instan \wxheading{Example} \begin{verbatim} - wxDb sampleDB(Db.Henv); + wxDb sampleDB(DbConnectInf.GetHenv()); if (!sampleDB.Open("Oracle 7.1 HP/UX", "gtasker", "myPassword")) { if (sampleDb.IsOpen()) @@ -1221,7 +1313,7 @@ use this connection.} \func{void}{SetDebugErrorMessages}{\param{bool }{state}} \docparam{state}{Either TRUE (debug messages are logged) or FALSE (debug -messages are not logged.} +messages are not logged).} \wxheading{Remarks} @@ -1239,24 +1331,70 @@ When compiled in release mode (FINAL=1), this setting has no affect. \membersection{wxDb::SetSqlLogging}\label{wxdbsetsqllogging} -\func{bool}{SetSqlLogging}{\param{wxDbSqlLogState}{ state}, \param{const wxChar *}{filename = SQL_LOG_FILENAME}, \param{bool }{ append = FALSE}} +\func{bool}{SetSqlLogging}{\param{wxDbSqlLogState}{ state}, \param{const wxString &}{filename = SQL\_LOG\_FILENAME}, \param{bool }{ append = FALSE}} \wxheading{Parameters} \docparam{state}{Either sqlLogOFF or sqlLogON (see \helpref{enum wxDbSqlLogState}{wxdbcolfor}). Turns logging of SQL commands sent to the datasource OFF or ON.} -\docparam{filename}{{\it OPTIONAL}. Name of the file to which the log text is to be written. Default is SQL_LOG_FILENAME.} +\docparam{filename}{{\it OPTIONAL}. Name of the file to which the log text is to be written. Default is SQL\_LOG\_FILENAME.} \docparam{append}{{\it OPTIONAL}. Whether the file is appended to or overwritten. Default is FALSE.} \wxheading{Remarks} -When called with {\it sqlLogON}, all commands sent to the datasource engine are logged to the file specified by {\it filename}. Logging is done by embedded riteSqlLog() calls in the database member functions, or may be manually logged by adding calls to \helpref{wxDb::WriteSqlLog}{wxdbwritesqllog} in your own source code. +When called with {\it sqlLogON}, all commands sent to the datasource engine are logged to the file specified by {\it filename}. Logging is done by embedded \helpref{wxDb::WriteSqlLog}{wxdbwritesqllog} calls in the database member functions, or may be manually logged by adding calls to \helpref{wxDb::WriteSqlLog}{wxdbwritesqllog} in your own source code. When called with {\it sqlLogOFF}, the logging file is closed, and any calls to \helpref{wxDb::WriteSqlLog}{wxdbwritesqllog} are ignored. +\membersection{wxDb::SQLColumnName}\label{wxdbsqlcolumnname} + +\func{const wxString}{SQLColumnName}{\param{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. + +\wxheading{Parameters} + +\docparam{colName}{Native name of the column in the table that is to be +evaluated to determine if any special quoting marks needed to be added to it +before including the column name in a SQL statement} + +\wxheading{See also} + +\helpref{wxDb::SQLTableName}{wxdbsqltablename} + + +\membersection{wxDb::SQLTableName}\label{wxdbsqltablename} + +\func{const wxString}{SQLTableName}{\param{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. + +\wxheading{Parameters} + +\docparam{tableName}{Native name of the table that is to be evaluated to +determine if any special quoting marks needed to be added to it +before including the table name in a SQL statement} + +\wxheading{See also} + +\helpref{wxDb::SQLColumnName}{wxdbsqlcolumnname} + + \membersection{wxDb::TableExists}\label{wxdbtableexists} -\func{bool}{TableExists}{\param{const char *}{tableName}, \param{const char *}{userID=NULL}, \param{const char *}{path=NULL}} +\func{bool}{TableExists}{\param{const wxString &}{tableName}, \param{const wxChar *}{userID=NULL}, \param{const wxString &}{path=""}} Checks the ODBC datasource for the existence of a table. If a {\it userID} is specified, then the table must be accessible by that user (user must have @@ -1288,7 +1426,9 @@ This function does not indicate whether or not the user has privileges to query \membersection{wxDb::TablePrivileges}\label{wxdbtableprivileges} -\func{bool}{TablePrivileges}{\param{const char *}{tableName}, \param{const char *}{priv}, \param{const char *}{userID=""}, \param{const char *}{schema=NULL}, \param{const char *}{path=""}} +\func{bool}{TablePrivileges}{\param{const wxString &}{tableName}, \param{const wxString &}{priv}, +\param{const wxChar *}{userID=NULL}, \param{const wxChar *}{schema=NULL}, +\param{const wxString &}{path=""}} Checks the ODBC datasource for the existence of a table. If a {\it userID} is specified, then the table must be accessible by that user (user must have @@ -1362,7 +1502,7 @@ seconds of time difference. \membersection{wxDb::TranslateSqlState}\label{wxdbtranslatesqlstate} -\func{int }{TranslateSqlState}{\param{const wxChar *}{SQLState}} +\func{int }{TranslateSqlState}{\param{const wxString &}{SQLState}} Converts an ODBC sqlstate to an internal error code. @@ -1372,12 +1512,12 @@ Converts an ODBC sqlstate to an internal error code. \wxheading{Return value} -Returns the internal class DB_ERR code. See \helpref{wxDb::DB_STATUS}{wxdb} definition. +Returns the internal class DB\_ERR code. See \helpref{wxDb::DB\_STATUS}{wxdb} definition. \membersection{wxDb::WriteSqlLog}\label{wxdbwritesqllog} -\func{bool}{WriteSqlLog}{\param{const wxChar *}{logMsg}} +\func{bool}{WriteSqlLog}{\param{const wxString &}{logMsg}} \wxheading{Parameters} @@ -1409,7 +1549,7 @@ Currently there are no member functions for this class. \begin{verbatim} void *PtrDataObj; int SzDataObj; - int SqlCtype; + SWORD SqlCtype; \end{verbatim} @@ -1429,16 +1569,17 @@ maintained by the wxDbTable class (and can be retrieved using the To access the nth column definition of your wxDbTable object, just reference wxDbColDefs element [n - 1]. -Currently there are no member functions for this class. - Typically, \helpref{wxDbTable::SetColDefs}{wxdbtablesetcoldefs} is used to populate an array of these data structures for the wxDbTable instance. +Currently there are no accessor functions for this class, so all members are +public. + \begin{verbatim} - char ColName[DB_MAX_COLUMN_NAME_LEN+1]; // Column Name + wxChar ColName[DB_MAX_COLUMN_NAME_LEN+1]; // Column Name int DbDataType; - Logical Data Type; e.g. DB_DATA_TYPE_INTEGER - int SqlCtype; - C data type; e.g. SQL_C_LONG + SWORD SqlCtype; - C data type; e.g. SQL_C_LONG void *PtrDataObj; - Address of the data object int SzDataObj; - Size, in bytes, of the data object bool KeyField; - Is column part of the PRIMARY KEY for the @@ -1457,23 +1598,75 @@ populate an array of these data structures for the wxDbTable instance. \helpref{wxDbTable::GetColDefs}{wxdbtablegetcoldefs}, \helpref{wxDb constructor}{wxdbconstr} +\membersection{wxDbColDef::Initialize}\label{wxdbcoldefinitialize} + +Simply initializes all member variables to a cleared state. Called by +the constructor automatically. + + +\section{\class{wxDbColFor}}\label{wxdbcolfor} + +Beginning support for handling international formatting specifically on dates +and floats. + +\begin{verbatim} + wxString s_Field; // Formated String for Output + wxString s_Format[7]; // Formated Objects - TIMESTAMP has + the biggest (7) + wxString s_Amount[7]; // Formated Objects - amount of + things that can be formatted + int i_Amount[7]; // Formated Objects - + TT MM YYYY HH MM SS m + int i_Nation; // 0 = timestamp + 1 = EU + 2 = UK + 3 = International + 4 = US + int i_dbDataType; // conversion of the 'sqlDataType' + to the generic data type used by + these classes + SWORD i_sqlDataType; +\end{verbatim} + +The constructor for this class initializes all the values to zero or NULL. + +The destructor does nothing at this time. + +Only one function is provided with this class currently: + + +\membersection{wxDbColFor::Format}\label{wxdbcolforformat} + +\func{int }{Format}{\param{int }{Nation}, \param{int }{dbDataType}, +\param{SWORD }{sqlDataType}, \param{short }{columnSize}, +\param{short }{decimalDigits}}\label{wxdbcolforformat} + +Work in progress, and should be inter-related with wxLocale eventually. + + +\membersection{wxDbColFor::Initialize}\label{wxdbcolforinitialize} + +Simply initializes all member variables to a cleared state. Called by +the constructor automatically. + + \section{\class{wxDbColInf}}\label{wxdbcolinf} Used with the \helpref{wxDb::GetColumns}{wxdbgetcolumns} functions for obtaining all retrievable information about a column's definition. \begin{verbatim} - char catalog[128+1]; - char schema[128+1]; - char tableName[DB_MAX_TABLE_NAME_LEN+1]; - char colName[DB_MAX_COLUMN_NAME_LEN+1]; + wxChar catalog[128+1]; + wxChar schema[128+1]; + wxChar tableName[DB_MAX_TABLE_NAME_LEN+1]; + wxChar colName[DB_MAX_COLUMN_NAME_LEN+1]; SWORD sqlDataType; - char typeName[128+1]; + wxChar typeName[128+1]; SWORD columnSize; SWORD bufferLength; short decimalDigits; short numPrecRadix; short nullable; - char remarks[254+1]; + wxChar remarks[254+1]; int dbDataType; // conversion of the 'sqlDataType' // to the generic data type used by // these classes @@ -1481,57 +1674,307 @@ Used with the \helpref{wxDb::GetColumns}{wxdbgetcolumns} functions for obtaining 0 = No 1 = First Key 2 = Second Key, etc... - char PkTableName[DB_MAX_TABLE_NAME_LEN+1]; + wxChar PkTableName[DB_MAX_TABLE_NAME_LEN+1]; // Tables that use this PKey as a FKey int FkCol; // Foreign key column 0 = No 1 = First Key 2 = Second Key, etc... - char FkTableName[DB_MAX_TABLE_NAME_LEN+1]; + wxChar FkTableName[DB_MAX_TABLE_NAME_LEN+1]; // Foreign key table name wxDbColFor *pColFor; // How should this column be formatted \end{verbatim} -The constructor for this class initializes all the values to zero or NULL. +The constructor for this class initializes all the values to zero, "", or NULL. The destructor for this class takes care of deleting the pColFor member if it is non-NULL. -\section{\class{wxDbColFor}}\label{wxdbcolfor} +\membersection{wxDbColInf::Initialize}\label{wxdbcolinfinitialize} + +Simply initializes all member variables to a cleared state. Called by +the constructor automatically. + + + +\section{\class{wxDbConnectInf}}\label{wxdbconnectinf} -Beginning support for handling international formatting specifically on dates and floats. +This class is used for holding the data necessary for connecting to the ODBC +datasource. That information includes: SQL environment handle, datasource +name, user ID, password and default directory path (used with dBase). Other +optional fields held in this class are and file type, both for future +functions planned to be added for creating/manipulating datasource definitions. + +\func{}{wxDbConnectInf}{\void} + +Default constructor. + +\func{}{wxDb}{\param{HENV }{henv}, \param{const wxString &}{dsn}, +\param{const wxString &}{userID=""}, \param{const wxString &}{password}, +\param{const wxString &}{defaultDir=""}, \param{const wxString &}{description=""}, +\param{const wxString &}{fileType=""}} + +Constructor which allows initial settings of all the classes member variables. + +See the special not below on the henv parameter for forcing this constructor +to create a SQL environment handle automatically, rather than needing to pass +one in to the function. + +\wxheading{Parameters} + +\docparam{henv}{Environment handle used for this connection. See +\helpref{wxDConnectInf::AllocHenv}{wxdbconnectinfallochenv} for how to create +an SQL environment handle. NOTE: Passing in a NULL for this parameter will +inform the constructor that it should create its own SQL environment handle. +If NULL is passed for this parameter, the constructor will call +\helpref{wxDConnectInf::AllocHenv}{wxdbconnectinfallochenv} internally. A +flag is set internally also to indicate that the HENV was created by the +constructor so that when the default class destructor is called, the +destructor will call \helpref{wxDConnectInf::FreeHenv}{wxdbconnectinffreehenv} +to free the environment handle automatically.} +\docparam{dsn}{Name of the datasource to be used in creating wxDb instances +for creating connection(s) to a datasource.} +\docparam{userID}{{\it OPTIONAL} Many datasources allow (or even require) +use of a username to determine privileges that connecting user is allowed +to have when accessing the datasource or the data tables. Default is "".} +\docparam{password}{{\it OPTIONAL} Password to be associated with the user +ID specified in 'userID'. Default is "".} +\docparam{defaultDir}{{\it OPTIONAL} Used for datasources which require the +path to where the data file is stored to be specified. dBase is one example +of the type of datasource which requires this information. Default is "".} +\docparam{description}{{\it OPTIONAL} {\bf FUTURE USE} Default is "".} +\docparam{fileType}{{\it OPTIONAL} {\bf FUTURE USE} Default is "".} + +\wxheading{Remarks} + +It is strongly recommended that programs use the longer form of the +constructor and allow the constructor to create the SQL environment handle +automatically, and manage the destruction of the handle. + +\wxheading{Example} \begin{verbatim} - wxString s_Field; // Formated String for Output - wxString s_Format[7]; // Formated Objects - TIMESTAMP has - the biggest (7) - wxString s_Amount[7]; // Formated Objects - amount of - things that can be formatted - int i_Amount[7]; // Formated Objects - - TT MM YYYY HH MM SS m - int i_Nation; // 0 = timestamp - 1 = EU - 2 = UK - 3 = International - 4 = US - int i_dbDataType; // conversion of the 'sqlDataType' - to the generic data type used by - these classes - SWORD i_sqlDataType; + wxDbConnectInf *DbConnectInf; + + DbConnectInf = new wxDbConnectInf(0,"MY_DSN", "MY_USER", "MY_PASSWORD"); + + ....the rest of the program + + delete DbConnectInf; \end{verbatim} -The constructor for this class initializes all the values to zero or NULL. +\wxheading{See also} -The destructor does nothing at this time. +\helpref{wxDConnectInf::AllocHenv}{wxdbconnectinfallochenv}, +\helpref{wxDConnectInf::FreeHenv}{wxdbconnectinffreehenv} -Only one function is provided with this class currently: -\membersection{wxDbColFor::Format}\label{wxdbcolforformat} +\membersection{wxDbConnectInf::\destruct{wxDbConnectInf}}\label{wxdbconnectinfdestr} -\func{int }{Format}{\param{int }{Nation}, \param{int }{dbDataType}, \param{SWORD }{sqlDataType}, \param{short }{columnSize}, \param{short }{decimalDigits}}\label{wxdbcolforformat} +\func{}{\destruct{wxDbConnectInf}}{} + +Handles the default destruction of the instance of the class. If the long form +of the \helpref{wxDConnectInf}{wxdbconnectinf} was used, then this destructor +also takes care of calling +\helpref{wxDConnectInf::FreeHenv}{wxdbconnectinffreehenv} to free the +SQL environment handle. + + +\membersection{wxDbConnectInf::AllocHenv}\label{wxdbconnectinfallochenv} + +\func{bool }{AllocHenv}{\void} + +Allocates a SQL environment handle that will be used to interface with +an ODBC datasource. + +\wxheading{Remarks} + +This function can be automatically called by the long from of the +\helpref{wxDbConnectInf}{wxdbconnectinf} constructor. + + +\membersection{wxDbConnectInf::FreeHenv}\label{wxdbconnectinffreehenv} + +\func{void}{FreeHenv}{\void} + +Frees the SQL environment handle being managed by the instance of this class. + +\wxheading{Remarks} + +If the SQL environment handle was created using the long form of the +\helpref{wxDbConnectInf}{wxdbconnectinf} constructor, then the flag indicating +that the HENV should be destroyed when the classes destructor is called +is reset to be FALSE, so that any future handles created using the +\helpref{wxDbConnectInf::AllocHenv}{wxdbconnectinfallochenv} function +must be manually released with a call to this function. + + +\membersection{wxDbConnectInf::Initialize}\label{wxdbconnectinfinitialize} + +Simply initializes all member variables to a cleared state. Called by +the constructor automatically. + + +\membersection{wxDbConnectInf::GetAuthStr}\label{wxdbconnectinfgetauthstr} + +\func{const wxChar *}{GetAuthStr}{\void} + +Accessor function to return the password assigned for this class +instance that will be used with the user ID. + +Synonymous with \helpref{wxDbConnectInf::GetPassword}{wxdbconnectinfgetpassword} + + +\membersection{wxDbConnectInf::GetDefaultDir}\label{wxdbconnectinfgetdefaultdir} + +\func{const wxChar *}{GetDefaultDir}{\void} + +Accessor function to return the default directory in which the datasource's data +table is stored. This directory is only used for file based datasources like +dBase. MS-Access does not require this to be set, as the path is set in the +ODBC Administrator for MS-Access. + + +\membersection{wxDbConnectInf::GetDescription}\label{wxdbconnectinfgetdescription} + +\func{const wxChar *}{GetDescription}{\void} + +Accessor function to return the description assigned for this class +instance. + +NOTE: Description is a FUTURE USE item and is unused currently. + + +\membersection{wxDbConnectInf::GetDsn}\label{wxdbconnectinfgetdsn} + +\func{const wxChar *}{GetDsn}{\void} + +Accessor function to return the datasource name assigned for this class +instance. + + +\membersection{wxDbConnectInf::GetFileType}\label{wxdbconnectinfgetfiletype} + +\func{const wxChar *}{GetFileType}{\void} + +Accessor function to return the filetype of the ODBC datasource assigned for +this class instance. + +NOTE: FileType is a FUTURE USE item and is unused currently. + + +\membersection{wxDbConnectInf::GetHenv}\label{wxdbconnectinfgethenv} + +\func{const HENV}{GetHenv}{\void} + +Accessor function to return the SQL environment handle being managed +by this class instance. + + +\membersection{wxDbConnectInf::GetPassword}\label{wxdbconnectinfgetpassword} + +\func{const wxChar *}{GetPassword}{\void} + +Accessor function to return the password assigned for this class +instance that will be used with the user ID. + +Synonymous with \helpref{wxDbConnectInf::GetAuthStr}{wxdbconnectinfgetauthstr} + + +\membersection{wxDbConnectInf::GetUid}\label{wxdbconnectinfgetuid} + +\func{const wxChar *}{GetUid}{\void} + +Accessor function to return the user ID assigned for this class +instance. + + +\membersection{wxDbConnectInf::GetUserID}\label{wxdbconnectinfgetuserid} + +\func{const wxChar *}{GetUserID}{\void} + +Accessor function to return the user ID assigned for this class +instance. + + +\membersection{wxDbConnectInf::SetAuthStr}\label{wxdbconnectinfsetauthstr} + +\func{\void}{SetAuthStr}{const wxString &authstr} + +Accessor function to assign the password for this class +instance that will be used with the user ID. + +Synonymous with \helpref{wxDbConnectInf::SetPassword}{wxdbconnectinfsetpassword} + + +\membersection{wxDbConnectInf::SetDefaultDir}\label{wxdbconnectinfsetdefaultdir} + +\func{\void}{SetDefaultDir}{const wxString &defDir} + +Accessor function to assign the default directory in which the datasource's data +table is stored. This directory is only used for file based datasources like +dBase. MS-Access does not require this to be set, as the path is set in the +ODBC Administrator for MS-Access. + + +\membersection{wxDbConnectInf::SetDescription}\label{wxdbconnectinfsetdescription} + +\func{\void}{SetDescription}{const wxString &desc} + +Accessor function to assign the description assigned for this class +instance. + +NOTE: Description is a FUTURE USE item and is unused currently. + + +\membersection{wxDbConnectInf::SetDsn}\label{wxdbconnectinfsetdsn} + +\func{\void}{SetDsn}{const wxString &dsn} + +Accessor function to assign the datasource name for this class instance. + + +\membersection{wxDbConnectInf::SetFileType}\label{wxdbconnectinfsetfiletype} + +\func{\void}{SetFileType}{const wxString &} + +Accessor function to return the filetype of the ODBC datasource assigned for +this class instance. + +NOTE: FileType is a FUTURE USE item and is unused currently. + + +\membersection{wxDbConnectInf::SetHenv}\label{wxdbconnectinfsethenv} + +\func{void}{SetHenv}{\param{const HENV }{henv}} + +Accessor function to set the SQL environment handle for this class instance. + + +\membersection{wxDbConnectInf::SetPassword}\label{wxdbconnectinfsetpassword} + +\func{\void}{SetPassword}{const wxString &password} + +Accessor function to assign the password for this class +instance that will be used with the user ID. + +Synonymous with \helpref{wxDbConnectInf::SetAuthStr}{wxdbconnectinfsetauthstr} + + +\membersection{wxDbConnectInf::SetUid}\label{wxdbconnectinfsetuid} + +\func{\void}{SetUid}{const wxString &uid} + +Accessor function to set the user ID for this class instance. + + +\membersection{wxDbConnectInf::SetUserID}\label{wxdbconnectinfsetuserid} + +\func{\void}{SetUserID}{const wxString &userID} + +Accessor function to assign the user ID for this class instance. -Work in progress, and should be inter-related with wxLocale eventually. \section{\class{wxDbIdxDef}}\label{wxdbidxdef} @@ -1540,7 +1983,7 @@ Used in creation of non-primary indexes. Currently there are no member functions for this class. \begin{verbatim} - char ColName[DB_MAX_COLUMN_NAME_LEN+1] + wxChar ColName[DB_MAX_COLUMN_NAME_LEN+1] // Name of column bool Ascending // Is index maintained in ASCENDING sequence? @@ -1560,19 +2003,24 @@ information in one memory structure. Primarily, this class is used internally by the wxWindows ODBC classes. \begin{verbatim} - char catalog[128+1]; - char schema[128+1]; // typically means owner of table(s) + wxChar catalog[128+1]; + wxChar schema[128+1]; // typically means owner of table(s) int numTables; // How many tables does this datasource have wxDbTableInf *pTableInf; // Equals a new wxDbTableInf[numTables]; \end{verbatim} -The constructor for this class initializes all the values to zero or NULL. +The constructor for this class initializes all the values to zero, "", or NULL. The destructor for this class takes care of deleting the pTableInf member if it is non-NULL. +\membersection{wxDbInf::Initialize}\label{wxdbinfinitialize} + +Simply initializes all member variables to a cleared state. Called by +the constructor automatically. + \section{\class{wxDbTable}}\label{wxdbtable} @@ -1587,7 +2035,8 @@ a table contained within the associated ODBC datasource \latexignore{\rtfignore{\wxheading{Members}}} \wxheading{Helper classes and data structures} -The following classes and structs are defined in dbtable.cpp/.h for use with the wxDbTable class. +The following classes and structs are defined in dbtable.cpp/.h for use +with the wxDbTable class. \begin{itemize}\itemsep=0pt \item \helpref{wxDbColDef}{wxdbcoldef} @@ -1625,7 +2074,9 @@ The following classes and structs are defined in dbtable.cpp/.h for use with the \membersection{wxDbTable::wxDbTable}\label{wxdbtableconstr} -\func{}{wxDbTable}{\param{wxDb *}{pwxDb}, \param{const char *}{tblName}, \param{const int }{nCols}, \param{const char *}{qryTblName = NULL}, \param{bool }{qryOnly = !wxDB_QUERY_ONLY}, \param{const char *}{tblPath=NULL}} +\func{}{wxDbTable}{\param{wxDb *}{pwxDb}, \param{const wxString &}{tblName}, + \param{const UWORD }{numColumns}, \param{const wxString &}{qryTblName = ""}, + \param{bool }{qryOnly = !wxDB\_QUERY\_ONLY}, \param{const wxString &}{tblPath = ""}} Default constructor. @@ -1634,7 +2085,7 @@ Default constructor. \docparam{pwxDb}{Pointer to the wxDb instance to be used by this wxDbTable instance.} \docparam{tblName}{The name of the table in the RDBMS.} -\docparam{nCols}{The number of columns in the table. (Do NOT include the ROWID +\docparam{numColumns}{The number of columns in the table. (Do NOT include the ROWID column in the count if using Oracle).} \docparam{qryTblName}{{\it OPTIONAL}. The name of the table or view to base your queries on. This argument allows you to specify a table/view other than @@ -1642,13 +2093,13 @@ the base table for this object to base your queries on. This allows you to query on a view for example, but all of the INSERT, UPDATE and DELETES will still be performed on the base table for this wxDbTable object. Basing your queries on a view can provide a substantial performance increase in cases where -your queries involve many tables with multiple joins. Default is NULL.} +your queries involve many tables with multiple joins. Default is "".} \docparam{qryOnly}{{\it OPTIONAL}. Indicates whether the table will be accessible for query purposes only, or should the table create the necessary cursors to be able to insert, update, and delete data from the table. -Default is !wxDB_QUERY_ONLY.} +Default is !wxDB\_QUERY\_ONLY.} \docparam{tblPath}{{\it OPTIONAL}. Some datasources (such as dBase) -require a path to where the table is stored on the system. Default is NULL.} +require a path to where the table is stored on the system. Default is "".} \membersection{wxDbTable::wxDbTable}\label{wxdbtabledestr} @@ -1659,7 +2110,8 @@ Virtual default destructor. \membersection{wxDbTable::BuildDeleteStmt}\label{wxdbtablebuilddeletestmt} -\func{void}{BuildDeleteStmt}{\param{char *}{pSqlStmt}, \param{int }{typeOfDel}, \param{const char *}{pWhereClause=NULL}} +\func{void}{BuildDeleteStmt}{\param{wxString &}{pSqlStmt}, +\param{int }{typeOfDel}, \param{const wxString &}{pWhereClause=""}} Constructs the full SQL statement that can be used to delete all rows matching the criteria in the pWhereClause. @@ -1668,12 +2120,12 @@ the criteria in the pWhereClause. \docparam{pSqlStmt}{Pointer to buffer for the SQL statement retrieved. To be sure you have adequate space allocated for the SQL statement, allocate -DB_MAX_STATEMENT_LEN bytes.} +DB\_MAX\_STATEMENT\_LEN bytes.} \docparam{typeOfDel}{The type of delete statement being performed. Can be one -of three values: DB_DEL_KEYFIELDS, DB_DEL_WHERE or DB_DEL_MATCHING} -\docparam{pWhereClause}{{\it OPTIONAL}. If the typeOfDel is DB_DEL_WHERE, +of three values: DB\_DEL\_KEYFIELDS, DB\_DEL\_WHERE or DB\_DEL\_MATCHING} +\docparam{pWhereClause}{{\it OPTIONAL}. If the typeOfDel is DB\_DEL\_WHERE, then you must also pass in a SQL WHERE clause in this argument. Default -is NULL.} +is "".} \wxheading{Remarks} @@ -1687,11 +2139,12 @@ this function. \membersection{wxDbTable::BuildSelectStmt}\label{wxdbtablebuildselectstmt} -\func{void}{BuildSelectStmt}{\param{char *}{pSqlStmt}, \param{int }{typeOfSelect}, \param{bool }{distinct}} +\func{void}{BuildSelectStmt}{\param{wxString &}{pSqlStmt}, +\param{int }{typeOfSelect}, \param{bool }{distinct}} Constructs the full SQL statement that can be used to select all rows matching the criteria in the pWhereClause. This function is called internally in the -wxDbTable class whenever the function \helpref{wxDbTable::Query}{wxdbtablequery} +wxDbTable class whenever the function \helpref{wxDbTable::Query}{wxdbtablequery} is called. NOTE: Only the columns specified in \helpref{wxDbTable::SetColDefs}{wxdbtablesetcoldefs} @@ -1702,10 +2155,10 @@ created by a call to this function. \docparam{pSqlStmt}{Pointer to storage for the SQL statement retrieved. To be sure you have adequate space allocated for the SQL statement, allocate -DB_MAX_STATEMENT_LEN bytes.} +DB\_MAX\_STATEMENT\_LEN bytes.} \docparam{typeOfSelect}{The type of select statement being performed. Can be -one of four values: DB_SELECT_KEYFIELDS, DB_SELECT_WHERE, DB_SELECT_MATCHING -or DB_SELECT_STATEMENT.} +one of four values: DB\_SELECT\_KEYFIELDS, DB\_SELECT\_WHERE, DB\_SELECT\_MATCHING +or DB\_SELECT\_STATEMENT.} \docparam{distinct}{Whether to select distinct records only.} \wxheading{Remarks} @@ -1713,19 +2166,21 @@ or DB_SELECT_STATEMENT.} This member function constructs a SQL SELECT statement. This can be used for debugging purposes if you are having problems executing your SQL statement. -WHERE and FROM clauses specified using \helpref{wxDbTable::SetWhereClause}{wxdbtablesetwhereclause} +WHERE and FROM clauses specified using +\helpref{wxDbTable::SetWhereClause}{wxdbtablesetwhereclause} and \helpref{wxDbTable::SetFromClause}{wxdbtablesetfromclause} are ignored by this function. \membersection{wxDbTable::BuildUpdateStmt}\label{wxdbtablebuildupdatestmt} -\func{void}{BuildSelectStmt}{\param{char *}{pSqlStmt}, \param{int }{typeOfUpd}, \param{const char *}{pWhereClause=NULL}} +\func{void}{BuildUpdateStmt}{\param{wxString &}{pSqlStmt}, \param{int }{typeOfUpd}, +\param{const wxString &}{pWhereClause=""}} Constructs the full SQL statement that can be used to update all rows matching the criteria in the pWhereClause. -If typeOfUpd is DB_UPD_KEYFIELDS, then the current values in the bound columns +If typeOfUpd is DB\_UPD\_KEYFIELDS, then the current values in the bound columns are used to determine which row(s) in the table are to be updated. The exception to this is when a datasource supports ROW IDs (Oracle). The ROW ID column is used for efficiency purposes when available. @@ -1740,12 +2195,11 @@ by this function. \docparam{pSqlStmt}{Pointer to storage for the SQL statement retrieved. To be sure you have adequate space allocated for the SQL statement, allocate -DB_MAX_STATEMENT_LEN bytes.} +DB\_MAX\_STATEMENT\_LEN bytes.} \docparam{typeOfUpd}{The type of update statement being performed. Can be one -of two values: DB_UPD_KEYFIELDS or DB_UPD_WHERE.} -\docparam{pWhereClause}{{\it OPTIONAL}. If the typeOfUpd is DB_UPD_WHERE, -then you must also pass in a SQL WHERE clause in this argument. Default -is NULL.} +of two values: DB\_UPD\_KEYFIELDS or DB\_UPD\_WHERE.} +\docparam{pWhereClause}{{\it OPTIONAL}. If the typeOfUpd is DB\_UPD\_WHERE, +then you must also pass in a SQL WHERE clause in this argument. Default is "".} \wxheading{Remarks} @@ -1760,7 +2214,9 @@ this function. \membersection{wxDbTable::BuildWhereStmt}\label{wxdbtablebuildwherestmt} -\func{void}{BuildSelectStmt}{\param{char *}{pWhereClause}, \param{int }{typeOfWhere}, \param{const char *}{qualTableName=NULL}, \param{const char *}{useLikeComparison=FALSE}} +\func{void}{BuildSelectStmt}{\param{wxString &}{pWhereClause}, +\param{int }{typeOfWhere}, \param{const wxString &}{qualTableName=""}, +\param{bool }{useLikeComparison=FALSE}} Constructs the portion of a SQL statement which would follow the word 'WHERE' in a SQL statement to be passed to the datasource. The returned string @@ -1770,13 +2226,13 @@ does NOT include the word 'WHERE'. \docparam{pWhereClause}{Pointer to storage for the SQL statement retrieved. To be sure you have adequate space allocated for the SQL statement, allocate -DB_MAX_STATEMENT_LEN bytes.} +DB\_MAX\_STATEMENT\_LEN bytes.} \docparam{typeOfWhere}{The type of where clause to generate. Can be one of -two values: DB_WHERE_KEYFIELDS or DB_WHERE_MATCHING.} +two values: DB\_WHERE\_KEYFIELDS or DB\_WHERE\_MATCHING.} \docparam{qualTableName}{{\it OPTIONAL}. Prepended to all base table column names. For use when a FROM clause has been specified with the \helpref{wxDbTable::SetFromClause}{wxdbtablesetfromclause}, -to clarify which table a column name reference belongs to. Default is NULL.} +to clarify which table a column name reference belongs to. Default is "".} \docparam{useLikeComparison}{{\it OPTIONAL}. Should the constructed WHERE clause utilize the LIKE comparison operator. If FALSE, then the '=' operator is used. Default is FALSE.} @@ -1787,7 +2243,7 @@ This member function allows you to see what the SQL WHERE clause looks like that the ODBC class library builds. This can be used for debugging purposes if you are having problems executing your own SQL statements. -If using 'typeOfWhere' set to DB_WHERE_MATCHING, any bound columns currently +If using 'typeOfWhere' set to DB\_WHERE\_MATCHING, any bound columns currently containing a NULL value are not included in the WHERE clause's list of columns to use in the comparison. @@ -1808,7 +2264,7 @@ Not all datasources support the "FOR UPDATE" clause, so you must use this member function to determine if the datasource currently connected to supports this behavior or not before trying to select using "FOR UPDATE". -If the wxDbTable instance was created with the parameter wxDB_QUERY_ONLY, then +If the wxDbTable instance was created with the parameter wxDB\_QUERY\_ONLY, then this function will return FALSE. For all known databases which do not support the FOR UPDATE clause, this function will return FALSE also. @@ -1853,20 +2309,25 @@ to an Oracle datasource or not. sqlStmt = "SELECT PART_NO, PART_DESC, ROWID" FROM PARTS"; } else - sqlStmt = "SELECT PART_NO, PART_DESC" FROM PARTS"; + sqlStmt = "SELECT PART_NO, PART_DESC FROM PARTS"; \end{verbatim} \membersection{wxDbTable::ClearMemberVar}\label{wxdbtableclearmembervar} -\func{void}{ClearMemberVar}{\param{int }{colNo}, \param{bool }{setToNull=FALSE}} +\func{void}{ClearMemberVar}{\param{UWORD }{colNo}, \param{bool }{setToNull=FALSE}} Same as \helpref{wxDbTable::ClearMemberVars}{wxdbtableclearmembervars} except that this function clears only the specified column of its values, and optionally sets the column to be a NULL column. -\docparam{colNo}{Column number that is to be cleared. This number (between 0 and (noCols-1)) is the index of the column definition created using the \helpref{wxDbTable::SetColDefs}{wxdbtablesetcoldefs} function.} -\docparam{setToNull}{{\it OPTIONAL}. Indicates whether the column should be flagged as being a NULL value stored in the bound memory variable. If TRUE, then any value stored in the bound member variable is cleared. Default is FALSE.} +\docparam{colNo}{Column number that is to be cleared. This number (between 0 +and (noCols-1)) is the index of the column definition created using the +\helpref{wxDbTable::SetColDefs}{wxdbtablesetcoldefs} function.} +\docparam{setToNull}{{\it OPTIONAL}. Indicates whether the column should be +flagged as being a NULL value stored in the bound memory variable. If TRUE, +then any value stored in the bound member variable is cleared. Default is +FALSE.} \membersection{wxDbTable::ClearMemberVars}\label{wxdbtableclearmembervars} @@ -1876,11 +2337,15 @@ optionally sets the column to be a NULL column. Initializes all bound columns of the wxDbTable instance to zero. In the case of a string, zero is copied to the first byte of the string. -\docparam{setToNull}{{\it OPTIONAL}. Indicates whether all columns should be flagged as having a NULL value stored in the bound memory variable. If TRUE, then any value stored in the bound member variable is cleared. Default is FALSE.} +\docparam{setToNull}{{\it OPTIONAL}. Indicates whether all columns should be +flagged as having a NULL value stored in the bound memory variable. If TRUE, +then any value stored in the bound member variable is cleared. Default is +FALSE.} \wxheading{Remarks} -This is useful before calling functions such as \helpref{wxDbTable::QueryMatching}{wxdbtablequerymatching} or +This is useful before calling functions such as +\helpref{wxDbTable::QueryMatching}{wxdbtablequerymatching} or \helpref{wxDbTable::DeleteMatching}{wxdbtabledeletematching} since these functions build their WHERE clauses from non-zero columns. To call either \helpref{wxDbTable::QueryMatching}{wxdbtablequerymatching} or @@ -1909,24 +2374,24 @@ Typically handled internally by the ODBC class library, but may be used by the programmer if desired. -\normalbox{DO NOT CLOSE THE wxDB_DEFAULT_CURSOR!} +\normalbox{DO NOT CLOSE THE wxDB\_DEFAULT\_CURSOR!} \membersection{wxDbTable::Count}\label{wxdbtablecount} -\func{ULONG }{Count}{\param{const char *}{args="*"}} +\func{ULONG }{Count}{\param{const wxString &}{args="*"}} Returns the number of records which would be in the result set using the current query parameters specified in the WHERE and FROM clauses. \wxheading{Parameters} -\docparam{args}{{\it OPTIONAL}. This arguement allows the use of the +\docparam{args}{{\it OPTIONAL}. This argument allows the use of the DISTINCT keyword against a column name to cause the returned count to only indicate the number of rows in the result set that have a unique value in the specified column. An example is shown below. Default is "*", -meaning a count of the total number of rows matching is returned, regardless of -uniqueness.} +meaning a count of the total number of rows matching is returned, regardless +of uniqueness.} \wxheading{Remarks} @@ -1934,7 +2399,8 @@ This function can be called before or after an actual query to obtain the count of records in the result set. Count() uses its own cursor, so result set cursor positioning is not affected by calls to Count(). -WHERE and FROM clauses specified using \helpref{wxDbTable::SetWhereClause}{wxdbtablesetwhereclause} +WHERE and FROM clauses specified using +\helpref{wxDbTable::SetWhereClause}{wxdbtablesetwhereclause} and \helpref{wxDbTable::SetFromClause}{wxdbtablesetfromclause} ARE used by this function. @@ -1968,7 +2434,9 @@ this function. \membersection{wxDbTable::CreateIndex}\label{wxdbtablecreateindex} -\func{bool}{CreateIndex}{\param{const char *}{idxName}, \param{bool }{unique}, \param{int }{noIdxCols}, \param{wxDbIdxDef *}{pIdxDefs}, \param{bool }{attemptDrop=TRUE}} +\func{bool}{CreateIndex}{\param{const wxString &}{idxName}, \param{bool }{unique}, +\param{UWORD }{noIdxCols}, \param{wxDbIdxDef *}{pIdxDefs}, +\param{bool }{attemptDrop=TRUE}} This member function allows you to create secondary (non primary) indexes on your tables. You first create your table, normally specifying a primary @@ -1982,7 +2450,8 @@ take advantage of those indexes. \wxheading{Parameters} -\docparam{idxName}{Name of the Index. Name must be unique within the table space of the datasource.} +\docparam{idxName}{Name of the Index. Name must be unique within the table +space of the datasource.} \docparam{unique}{Indicates if this index is unique.} \docparam{noIdxCols}{Number of columns in the index.} \docparam{pIdxDefs}{A pointer to an array wxDbIdxDef structures. } @@ -1995,7 +2464,7 @@ name provided before trying to create the index name. Default is TRUE.} The first parameter, index name, must be unique and should be given a meaningful name. Common practice is to include the table name as a prefix in the index name (e.g. For table PARTS, you might want to call your index -PARTS_IDX1). This will allow you to easily view all +PARTS\_IDX1). This will allow you to easily view all of the indexes defined for a given table grouped together alphabetically. The second parameter indicates if the index is unique or not. Uniqueness @@ -2036,16 +2505,16 @@ after executing this function. // Create a secondary index on the PARTS table wxDbIdxDef idxDef[2]; // 2 columns make up the index - strcpy(idxDef[0].ColName, "PART_DESC"); // Column 1 + wxStrcpy(idxDef[0].ColName, "PART_DESC"); // Column 1 idxDef[0].Ascending = TRUE; - strcpy(idxDef[1].ColName, "SERIAL_NO"); // Column 2 + wxStrcpy(idxDef[1].ColName, "SERIAL_NO"); // Column 2 idxDef[1].Ascending = FALSE; // Create a name for the index based on the table's name wxString indexName; - indexName.sprintf("%s_IDX1",parts->GetTableName()); - parts->CreateIndex(indexName.c_str(), TRUE, 2, idxDef); + indexName.Printf("%s_IDX1",parts->GetTableName()); + parts->CreateIndex(indexName, TRUE, 2, idxDef); \end{verbatim} @@ -2067,24 +2536,25 @@ being used. Default is TRUE.} This function creates the table and primary index (if any) in the table space associated with the connected datasource. The owner of these objects will -be the user id that was given when \helpref{wxDb::Open}{wxdbopen} was called. The objects will -be created in the default schema/table space for that user. +be the user id that was given when \helpref{wxDb::Open}{wxdbopen} was called. +The objects will be created in the default schema/table space for that user. In your derived wxDbTable object constructor, the columns and primary index of the table are described through the \helpref{wxDbColDef}{wxdbcoldef} structure. -\helpref{wxDbTable::CreateTable}{wxdbtablecreatetable} uses this information to create the table and to add -the primary index. See \helpref{wxDbTable}{wxdbtable} ctor and wxDbColDef -description for additional information on describing the columns of the table. +\helpref{wxDbTable::CreateTable}{wxdbtablecreatetable} uses this information +to create the table and to add the primary index. See +\helpref{wxDbTable}{wxdbtable} ctor and wxDbColDef description for additional +information on describing the columns of the table. It is not necessary to call \helpref{wxDb::CommitTrans}{wxdbcommittrans} after executing this function. -\membersection{wxDbTable::DB_STATUS}\label{wxdbtabledbstatus} +\membersection{wxDbTable::DB\_STATUS}\label{wxdbtabledbstatus} -\func{bool}{DB_STATUS}{\void} +\func{bool}{DB\_STATUS}{\void} -Accessor function that returns the wxDb private member variable DB_STATUS for +Accessor function that returns the wxDb private member variable DB\_STATUS for the database connection used by this instance of wxDbTable. @@ -2096,7 +2566,8 @@ Deletes the row from the table indicated by the current cursor. \wxheading{Remarks} -Use \helpref{wxDbTable::GetFirst}{wxdbtablegetfirst}, \helpref{wxDbTable::GetLast}{wxdbtablegetlast}, +Use \helpref{wxDbTable::GetFirst}{wxdbtablegetfirst}, +\helpref{wxDbTable::GetLast}{wxdbtablegetlast}, \helpref{wxDbTable::GetNext}{wxdbtablegetnext} or \helpref{wxDbTable::GetPrev}{wxdbtablegetprev} to position the cursor to a valid record. Once positioned on a record, call this function to delete @@ -2136,7 +2607,7 @@ NOTE: If the cursor could not be deleted for some reason, an error is logged indicating the reason. Even if the cursor could not be deleted, the HSTMT that is passed in is deleted, and the pointer is set to NULL. -\normalbox{DO NOT DELETE THE wxDB_DEFAULT_CURSOR!} +\normalbox{DO NOT DELETE THE wxDB\_DEFAULT\_CURSOR!} \membersection{wxDbTable::DeleteMatching}\label{wxdbtabledeletematching} @@ -2157,16 +2628,16 @@ To delete all users with a first name of "JOHN", do the following: \end{verbatim} The WHERE clause is built by the ODBC class library based on all non-NULL -columns. This allows deletion of records -by matching on any column(s) in your wxDbTable instance, without having to -write the SQL WHERE clause. +columns. This allows deletion of records by matching on any column(s) in +your wxDbTable instance, without having to write the SQL WHERE clause. A \helpref{wxDb::CommitTrans}{wxdbcommittrans} or \helpref{wxDb::RollbackTrans}{wxdbrollbacktrans} must be called after use of this function to commit or rollback the deletion. NOTE: Row(s) should be locked before deleting them to make sure they are -not already in use. This can be achieved by calling \helpref{wxDbTable::QueryMatching}{wxdbtablequerymatching}, +not already in use. This can be achieved by calling +\helpref{wxDbTable::QueryMatching}{wxdbtablequerymatching}, and then retrieving the records, locking each as you go (assuming FOR UPDATE is allowed on the datasource). After the row(s) have been successfully locked, call this function. @@ -2187,14 +2658,14 @@ of actions that insert/update/delete rows in a table. // Incomplete code sample to delete all users with a first name // of "JOHN" users.ClearMemberVars(); - strcpy(users.FirstName,"JOHN"); + wxStrcpy(users.FirstName,"JOHN"); users.DeleteMatching(); \end{verbatim} \membersection{wxDbTable::DeleteWhere}\label{wxdbtabledeletewhere} -\func{bool}{DeleteWhere}{\param{const char *}{pWhereClause}} +\func{bool}{DeleteWhere}{\param{const wxString &}{pWhereClause}} Deletes all rows from the table which match the criteria specified in the WHERE clause that is passed in. @@ -2247,7 +2718,7 @@ this function. \membersection{wxDbTable::DropIndex}\label{wxdbtabledropindex} -\func{bool}{DropIndex}{\param{const char *}{idxName}} +\func{bool}{DropIndex}{\param{const wxString &}{idxName}} Allows an index on the associated table to be dropped (deleted) if the user login has sufficient privileges to do so. @@ -2288,7 +2759,7 @@ after executing this function. \membersection{wxDbTable::From}\label{wxdbtablefrom} -\func{const char *}{From}{} +\func{const wxString &}{From}{} \func{void}{From}{\param{const wxString &}{From}} @@ -2384,12 +2855,12 @@ return FALSE, and the data contained in the bound columns will be undefined. \wxheading{See also} -\helpref{wxDb::FwdOnlyCursors}{wxdbfwdonlycursors} +\helpref{wxDb::IsFwdOnlyCursors}{wxdbisfwdonlycursors} \membersection{wxDbTable::GetFromClause}\label{wxdbtablegetfromclause} -\func{const char *}{GetFromClause}{} +\func{const wxString &}{GetFromClause}{} Accessor function that returns the current FROM setting assigned with the \helpref{wxDbTable::SetFromClause}{wxdbtablesetfromclause}. @@ -2419,27 +2890,32 @@ return FALSE, and the data contained in the bound columns will be undefined. \wxheading{See also} -\helpref{wxDb::FwdOnlyCursors}{wxdbfwdonlycursors} +\helpref{wxDb::IsFwdOnlyCursors}{wxdbisfwdonlycursors} \membersection{wxDbTable::GetNewCursor}\label{wxdbtablegetnewcursor} -\func{HSTMT *}{GetNewCursor}{\param{bool }{setCursor=FALSE}, \param{bool }{bindColumns=TRUE}} +\func{HSTMT *}{GetNewCursor}{\param{bool }{setCursor=FALSE}, +\param{bool }{bindColumns=TRUE}} This function will create a new cursor that can be used to access the table being referenced by this wxDbTable instance, or to execute direct SQL commands -on without affecting the cursors that are already defined and possibly positioned. +on without affecting the cursors that are already defined and possibly +positioned. \wxheading{Parameters} -\docparam{setCursor}{{\it OPTIONAL}. Should this new cursor be set to be the current cursor after successfully creating the new cursor. Default is FALSE.} -\docparam{bindColumns}{{\it OPTIONAL}. Should this new cursor be bound to all the memory variables that the default cursor is bound to. Default is TRUE.} +\docparam{setCursor}{{\it OPTIONAL}. Should this new cursor be set to be the +current cursor after successfully creating the new cursor. Default is FALSE.} +\docparam{bindColumns}{{\it OPTIONAL}. Should this new cursor be bound to all +the memory variables that the default cursor is bound to. Default is TRUE.} \wxheading{Remarks} -This new cursor must be closed using \helpref{wxDbTable::DeleteCursor}{wxdbtabledeletecursor} -by the calling program before the wxDbTable instance is deleted, or both memory -and resource leaks will occur. +This new cursor must be closed using +\helpref{wxDbTable::DeleteCursor}{wxdbtabledeletecursor} +by the calling program before the wxDbTable instance is deleted, or both +memory and resource leaks will occur. \membersection{wxDbTable::GetNext}\label{wxdbtablegetnext} @@ -2469,7 +2945,7 @@ This function works with both forward and backward scrolling cursors. \membersection{wxDbTable::GetNumberOfColumns}\label{wxdbtablegetnumberofcolumns} -\func{bool}{GetNumberOfColumns}{} +\func{UWORD }{GetNumberOfColumns}{} Accessor function that returns the number of columns that are statically bound for access by the wxDbTable instance. @@ -2477,7 +2953,7 @@ bound for access by the wxDbTable instance. \membersection{wxDbTable::GetOrderByClause}\label{wxdbtablegetorderbyclause} -\func{const char *}{GetOrderByClause}{} +\func{const wxString &}{GetOrderByClause}{} Accessor function that returns the current ORDER BY setting assigned with the \helpref{wxDbTable::SetOrderByClause}{wxdbtablesetorderbyclause}. @@ -2513,13 +2989,13 @@ return FALSE, and the data contained in the bound columns will be undefined. \wxheading{See also} -\helpref{wxDb::FwdOnlyCursors}{wxdbfwdonlycursors}, +\helpref{wxDb::IsFwdOnlyCursors}{wxdbisfwdonlycursors}, \helpref{wxDbTable::--}{wxdbtableminusminus} \membersection{wxDbTable::GetQueryTableName}\label{wxdbtablegetquerytablename} -\func{const char *}{GetQueryTableName}{} +\func{const wxString &}{GetQueryTableName}{} Accessor function that returns the name of the table/view that was indicated as being the table/view to query against when this wxDbTable instance was @@ -2541,14 +3017,14 @@ Returns the ODBC row number for performing positioned updates and deletes. This function is not being used within the ODBC class library and may be a candidate for removal if no use is found for it. -Row nuumber with some datasources/ODBC drivers is the position in the result set, +Row number with some datasources/ODBC drivers is the position in the result set, while in others it may be a physical position in the database. Check your database documentation to find out which behavior is supported. \membersection{wxDbTable::GetTableName}\label{wxdbtablegettablename} -\func{const char *}{GetTableName}{} +\func{const wxString &}{GetTableName}{} Accessor function that returns the name of the table that was indicated as being the table that this wxDbTable instance was associated with. @@ -2556,7 +3032,7 @@ as being the table that this wxDbTable instance was associated with. \membersection{wxDbTable::GetTablePath}\label{wxdbtablegettablepath} -\func{const char *}{GetTablePath}{} +\func{const wxString &}{GetTablePath}{} Accessor function that returns the path to the data table that was indicated during creation of this wxDbTable instance. @@ -2568,7 +3044,7 @@ Currently only applicable to dBase and MS-Access datasources. \membersection{wxDbTable::GetWhereClause}\label{wxdbtablegetwhereclause} -\func{const char *}{GetWhereClause}{} +\func{const wxString &}{GetWhereClause}{} Accessor function that returns the current WHERE setting assigned with the \helpref{wxDbTable::SetWhereClause}{wxdbtablesetwhereclause} @@ -2609,10 +3085,10 @@ this function to commit or rollback the insertion. \begin{verbatim} // Incomplete code snippet - strcpy(parts->PartName, "10"); - strcpy(parts->PartDesc, "Part #10"); + wxStrcpy(parts->PartName, "10"); + wxStrcpy(parts->PartDesc, "Part #10"); parts->Qty = 1000; - RETCODE retcode = parts.Insert(); + RETCODE retcode = parts->Insert(); switch(retcode) { case DB_SUCCESS: @@ -2633,16 +3109,16 @@ this function to commit or rollback the insertion. \membersection{wxDbTable::IsColNull}\label{wxdbtableiscolnull} -\func{bool}{IsColNull}{\param{int }{colNo}} +\func{bool }{IsColNull}{\param{UWORD }{colNo}} const -Used primarily in the ODBC class library to determine if a column is equal -to "NULL". Works for all data types supported by the ODBC class library. +Used primarily in the ODBC class library to determine if a column value is +set to "NULL". Works for all data types supported by the ODBC class library. \wxheading{Parameters} \docparam{colNo}{The column number of the bound column as defined by the \helpref{wxDbTable::SetColDefs}{wxdbtablesetcoldefs} -calls which defined the columns accesible to this wxDbTable instance.} +calls which defined the columns accessible to this wxDbTable instance.} \wxheading{Remarks} @@ -2651,11 +3127,11 @@ NULL column support is currently not fully implemented as of wxWindows 2.4 \membersection{wxDbTable::IsCursorClosedOnCommit}\label{wxdbtableiscursorclosedoncommit} -\func{bool}{IsCursorClosedOnCommit}{\void} +\func{bool }{IsCursorClosedOnCommit}{\void} Accessor function to return information collected during the opening of the datasource connection that is used by this wxDbTable instance. The result -returned by this function indicates whether an implicit closing of the curosr is +returned by this function indicates whether an implicit closing of the cursor is done after a commit on the database connection. \wxheading{Return value} @@ -2672,7 +3148,7 @@ indicates TRUE. \membersection{wxDbTable::IsQueryOnly}\label{wxdbtableisqueryonly} -\func{bool}{IsQueryOnly}{} +\func{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 @@ -2682,11 +3158,11 @@ wxDbTable instance that would modify (insert/delete/update) the table's data. \membersection{wxDbTable::Open}\label{wxdbtableopen} -\func{bool}{Open}{\param{bool }{checkPrivileges=FALSE}} +\func{bool }{Open}{\param{bool }{checkPrivileges=FALSE}, \param{bool }{checkTableExists=TRUE}} Every wxDbTable instance must be opened before it can be used. This function checks for the existence of the requested table, binds columns, creates required -cursors, (insert/select and update if connection is not wxDB_QUERY_ONLY) and +cursors, (insert/select and update if connection is not wxDB\_QUERY\_ONLY) and constructs the insert statement that is to be used for inserting data as a new row in the datasource. @@ -2696,14 +3172,17 @@ row in the datasource. whether the current connected user has at least SELECT privileges to access the table to which they are trying to open. Default is FALSE.} +\docparam{checkTableExists}{Indicates whether the Open() function should check +whether the table exists in the database or not before opening it. Default is TRUE.} + \wxheading{Remarks} If the function returns a FALSE value due to the table not existing, a log entry is recorded for the datasource connection indicating the problem that was detected when checking for table existence. Note that it is usually best for the calling routine to check for the existence of the table and for -sufficent user privileges to access the table in the mode (wxDB_QUERY_ONLY or -!wxDB_QUERY_ONLY) before trying to open the table for the best possible +sufficent user privileges to access the table in the mode (wxDB\_QUERY\_ONLY or +!wxDB\_QUERY\_ONLY) before trying to open the table for the best possible explanation as to why a table cannot be opened. Checking the user's privileges on a table can be quite time consuming during @@ -2724,13 +3203,15 @@ function can significantly speed up the privileges checks. \membersection{wxDbTable::OrderBy}\label{wxdbtableorderby} -\func{const char *}{OrderBy}{} +\func{const wxString &}{OrderBy}{} \func{void}{OrderBy}{\param{const wxString &}{OrderBy}} Accessor function for the private class member wxDbTable::orderBy. Can be -used as a synonym for \helpref{wxDbTable::GetOrderByClause}{wxdbtablegetorderbyclause} -(the first form of this function) or \helpref{wxDbTable::SetOrderByClause}{wxdbtablesetorderbyclause} +used as a synonym for +\helpref{wxDbTable::GetOrderByClause}{wxdbtablegetorderbyclause} +(the first form of this function) or +\helpref{wxDbTable::SetOrderByClause}{wxdbtablesetorderbyclause} (the second form of this function). \wxheading{Parameters} @@ -2739,7 +3220,7 @@ used as a synonym for \helpref{wxDbTable::GetOrderByClause}{wxdbtablegetorderbyc alphabetized/numeric sorting sequence that the result set is to be returned in. If a FROM clause has also been specified, each column name specified in the ORDER BY clause should be prefaced with the table name to which the column -belongs using DOT notation (TABLE_NAME.COLUMN_NAME).} +belongs using DOT notation (TABLE\_NAME.COLUMN\_NAME).} \wxheading{Return value} @@ -2756,7 +3237,7 @@ The second form of the function has no return value. \membersection{wxDbTable::Query}\label{wxdbtablequery} -\func{virtual bool}{Query}{\param{bool }{forUpdate=FALSE}, \param{bool }{distinct=FALSE}} +\func{virtual bool }{Query}{\param{bool }{forUpdate=FALSE}, \param{bool }{distinct=FALSE}} \wxheading{Parameters} @@ -2778,7 +3259,7 @@ wxDbTable members: "where", "orderBy", and "from". Use records to be retrieved (e.g. All users with a first name of "JOHN"). Use \helpref{wxDbTable::SetOrderByClause}{wxdbtablesetorderbyclause} to change the sequence in which records are returned in the result set from -the datasource (e.g. Ordered by LAST_NAME). Use +the datasource (e.g. Ordered by LAST\_NAME). Use \helpref{wxDbTable::SetFromClause}{wxdbtablesetfromclause} to allow outer joining of the base table (the one being associated with this instance of wxDbTable) with other tables which share a related field. @@ -2842,7 +3323,7 @@ clauses.} \membersection{wxDbTable::QueryBySqlStmt}\label{wxdbtablequerybysqlstmt} -\func{bool}{QueryBySqlStmt}{\param{const char *}{pSqlStmt}} +\func{bool}{QueryBySqlStmt}{\param{const wxString &}{pSqlStmt}} Performs a query against the datasource by accepting and passing verbatim the SQL SELECT statement passed to the function. @@ -2876,7 +3357,7 @@ The requirements of the SELECT statement are the following: float for column 3 (e.g. PRICE * 1.10 to increase the price by 10%). - 3. The ROWID can be included in your SELECT statement as the {\bf last} + 3. The ROWID can be included in your SELECT statement as the {\bf last} column selected, if the datasource supports it. Use wxDbTable::CanUpdByROWID() to determine if the ROWID can be selected from the datasource. If it can, much better @@ -2905,8 +3386,9 @@ either \helpref{wxDbTable::GetFirst}{wxdbtablegetfirst} or \begin{verbatim} // Incomplete code samples - strcpy(sqlStmt, "SELECT * FROM PARTS WHERE STORAGE_DEVICE = 'SD98' \ - AND CONTAINER = 12"); + wxString sqlStmt; + sqlStmt = "SELECT * FROM PARTS WHERE STORAGE_DEVICE = 'SD98' \ + AND CONTAINER = 12"; // Query the records using the SQL SELECT statement above parts->QueryBySqlStmt(sqlStmt); // Display all records queried @@ -2942,14 +3424,15 @@ either \helpref{wxDbTable::GetFirst}{wxdbtablegetfirst} or \membersection{wxDbTable::QueryMatching}\label{wxdbtablequerymatching} -\func{virtual bool}{QueryMatching}{\param{bool }{forUpdate=FALSE}, \param{bool }{distinct=FALSE}} +\func{virtual bool }{QueryMatching}{\param{bool }{forUpdate=FALSE}, +\param{bool }{distinct=FALSE}} QueryMatching allows querying of records from the table associated with the wxDbTable object by matching "columns" to values. -For example: To query the datasource for the row with a PART_NUMBER column +For example: To query the datasource for the row with a PART\_NUMBER column value of "32", clear all column variables of the wxDbTable object, set the -PartNumber variable that is bound to the PART_NUMBER column in the wxDbTable +PartNumber variable that is bound to the PART\_NUMBER column in the wxDbTable object to "32", and then call wxDbTable::QueryMatching(). \wxheading{Parameters} @@ -2995,7 +3478,7 @@ this function. \begin{verbatim} // Incomplete code sample parts->ClearMemberVars(); // Set all columns to zero - strcpy(parts->PartNumber,"32"); // Set columns to query on + wxStrcpy(parts->PartNumber,"32"); // Set columns to query on parts->OnHold = TRUE; parts->QueryMatching(); // Query // Display all records queried @@ -3006,7 +3489,8 @@ this function. \membersection{wxDbTable::QueryOnKeyFields}\label{wxdbtablequeryonkeyfields} -\func{bool}{QueryOnKeyFields}{\param{bool }{forUpdate=FALSE}, \param{bool }{distinct=FALSE}} +\func{bool }{QueryOnKeyFields}{\param{bool }{forUpdate=FALSE}, +\param{bool }{distinct=FALSE}} QueryOnKeyFields provides an easy mechanism to query records in the table associated with the wxDbTable object by the primary index column(s). Simply @@ -3045,7 +3529,7 @@ this function. \begin{verbatim} // Incomplete code sample - strcpy(parts->PartNumber, "32"); + wxStrcpy(parts->PartNumber, "32"); parts->QueryOnKeyFields(); // Display all records queried while(parts->GetNext()) @@ -3078,9 +3562,12 @@ table's columns are refreshed to reflect the current data in the database. \membersection{wxDbTable::SetColDefs}\label{wxdbtablesetcoldefs} -\func{void}{SetColDefs}{\param{int }{index}, \param{const char *}{fieldName}, \param{int }{dataType}, \param{void *}{pData}, \param{int }{cType}, \param{int }{size}, \param{bool }{keyField = FALSE}, \param{bool }{upd = TRUE}, \param{bool }{insAllow = TRUE}, \param{bool }{derivedCol = FALSE}} +\func{void}{SetColDefs}{\param{UWORD }{index}, \param{const wxString &}{fieldName}, +\param{int }{dataType}, \param{void *}{pData}, \param{SWORD }{cType}, +\param{int }{size}, \param{bool }{keyField = FALSE}, \param{bool }{upd = TRUE}, +\param{bool }{insAllow = TRUE}, \param{bool }{derivedCol = FALSE}} -\func{wxDbColDataPtr *}{SetColDefs}{\param{wxDbColInf *}{colInfs}, \param{ULONG }{numCols}} +\func{wxDbColDataPtr *}{SetColDefs}{\param{wxDbColInf *}{colInfs}, \param{UWORD }{numCols}} \wxheading{Parameters} @@ -3154,7 +3641,7 @@ were to be copied over to another datasource or table. \begin{verbatim} // Long way not using this function - strcpy(colDefs[0].ColName, "PART_NO"); + wxStrcpy(colDefs[0].ColName, "PART_NO"); colDefs[0].DbDataType = DB_DATA_TYPE_VARCHAR; colDefs[0].PtrDataObj = PartNumber; colDefs[0].SqlCtype = SQL_C_CHAR; @@ -3172,14 +3659,14 @@ were to be copied over to another datasource or table. \membersection{wxDbTable::SetCursor}\label{wxdbtablesetcursor} -\func{bool}{SetCursor}{\param{HSTMT *}{hstmtActivate = (void **) wxDB_DEFAULT_CURSOR}} +\func{bool}{SetCursor}{\param{HSTMT *}{hstmtActivate = (void **) wxDB\_DEFAULT\_CURSOR}} \wxheading{Parameters} \docparam{hstmtActivate}{{\it OPTIONAL}. Pointer to the cursor that is to become the current cursor. Passing no cursor handle will reset the cursor back to the wxDbTable's default (original) cursor that was created when the -wxDbTable instance was first created. Default is wxDB_DEFAULT_CURSOR.} +wxDbTable instance was first created. Default is wxDB\_DEFAULT\_CURSOR.} \wxheading{Remarks} @@ -3195,7 +3682,8 @@ and saving a pointer to that cursor. \wxheading{See also} -\helpref{wxDbTable::GetNewCursor}{wxdbtablegetnewcursor}, \helpref{wxDbTable::GetCursor}{wxdbtablegetcursor}, +\helpref{wxDbTable::GetNewCursor}{wxdbtablegetnewcursor}, +\helpref{wxDbTable::GetCursor}{wxdbtablegetcursor}, \helpref{wxDbTable::SetCursor}{wxdbtablesetcursor} @@ -3251,9 +3739,10 @@ the datasource knows on which column values the tables should be joined on. \membersection{wxDbTable::SetColNull}\label{wxdbtablesetcolnull} -\func{bool}{SetColNull}{\param{int }{colNo}, \param{bool }{set=TRUE}} +\func{bool}{SetColNull}{\param{UWORD }{colNo}, \param{bool }{set=TRUE}} -\func{bool}{SetColNull}{\param{const char *}{colName}, \param{bool }{set=TRUE}} +\func{bool}{SetColNull}{\param{const wxString &}{colName}, +\param{bool }{set=TRUE}} Both forms of this function allow a member variable representing a column in the table associated with this wxDbTable object to be set to NULL. @@ -3295,7 +3784,7 @@ A synonym to this function is one form of the function \helpref{wxDbTable::Order alphabetized sorting sequence that the result set is to be returned in. If a FROM clause has also been specified, each column name specified in the ORDER BY clause should be prefaced with the table name to which the column -belongs using DOT notation (TABLE_NAME.COLUMN_NAME).} +belongs using DOT notation (TABLE\_NAME.COLUMN\_NAME).} \wxheading{Remarks} @@ -3352,7 +3841,7 @@ A synonym to this function is one form of the function \helpref{wxDbTable::Where that is legal in standard where clauses. If a FROM clause has also been specified, each column name specified in the ORDER BY clause should be prefaced with the table name to which the column belongs using DOT notation -(TABLE_NAME.COLUMN_NAME).} +(TABLE\_NAME.COLUMN\_NAME).} \wxheading{Remarks} @@ -3390,9 +3879,9 @@ Do {\bf not} include the keywords "WHERE" when setting the WHERE clause. \membersection{wxDbTable::Update}\label{wxdbtableupdate} -\func{bool}{Update}{\void} +\func{bool }{Update}{\void} -\func{bool}{Update}{\param{const char *}{pSqlStmt}} +\func{bool }{Update}{\param{const wxString &}{pSqlStmt}} The first form of this function will update the row that the current cursor is currently positioned at with the values in the memory variables that @@ -3423,13 +3912,14 @@ this function to commit or rollback the update. \wxheading{Example} \begin{verbatim} - strcpy(sqlStmt, "update PART set QTY = 0 where PART_NUMBER = '32'"); + wxString sqlStmt; + sqlStmt = "update PART set QTY = 0 where PART_NUMBER = '32'"; \end{verbatim} \membersection{wxDbTable::UpdateWhere}\label{wxdbtableupdatewhere} -\func{bool}{UpdateWhere}{\param{const char *}{pWhereClause}} +\func{bool}{UpdateWhere}{\param{const wxString &}{pWhereClause}} Performs updates to the base table of the wxDbTable object, updating only the rows which match the criteria specified in the {\it pWhereClause}. @@ -3455,7 +3945,7 @@ this function to commit or rollback the update(s). \membersection{wxDbTable::Where}\label{wxdbtablewhere} -\func{const char *}{Where}{} +\func{const wxString &}{Where}{} \func{void}{Where}{\param{const wxString& }{Where}} @@ -3521,7 +4011,15 @@ Currently only used by \helpref{wxDb::GetCatalog}{wxdbgetcatalog} internally and \helpref{wxDbInf}{wxdbinf} class, but may be used in future releases for user functions. Contains information describing the table (Name, type, etc). A pointer to a wxDbColInf array instance is included so a program can create a -\helpref{wxDbColInf}{wxdbcolinf} array instance (using \helpref{wxDb::GetColumns}{wxdbgetcolumns}) +\helpref{wxDbColInf}{wxdbcolinf} array instance (using +\helpref{wxDb::GetColumns}{wxdbgetcolumns}) to maintain all information about the columns of a table in one memory structure. +Eventually, accessor functions will be added for this class + +\membersection{wxDbTableInf::Initialize}\label{wxdbtableinfinitialize} + +Simply initializes all member variables to a cleared state. Called by +the constructor automatically. +