]> git.saurik.com Git - wxWidgets.git/blame - docs/latex/wx/db.tex
typo fixed
[wxWidgets.git] / docs / latex / wx / db.tex
CommitLineData
3ca6a5f0 1\section{\class{wxDb}}\label{wxdb}
f6bcfd97 2
3ca6a5f0 3A wxDb instance is a connection to an ODBC data source which may
f6bcfd97
BP
4be opened, closed, and re-opened an unlimited number of times. A
5database connection allows function to be performed directly on the
6data source, as well as allowing access to any tables/views defined in
7the data source to which the user has sufficient privileges.
8
9\wxheading{Include files}
10
f6bcfd97
BP
11<wx/db.h>
12
d0c6b305
GT
13\wxheading{Helper classes and data structures}
14
15The following classes and structs are defined in db.cpp/.h for use with the wxDb class.
16
17\begin{itemize}\itemsep=0pt
18\item \helpref{wxDbColFor}{wxdbcolfor}
19\item \helpref{wxDbColInf}{wxdbcolinf}
20\item \helpref{wxDbTableInf}{wxdbtableinf}
21\item \helpref{wxDbInf}{wxdbinf}
22\end{itemize}
23
24\wxheading{Constants}
25
26NOTE: In a future release, all ODBC class constants will be prefaced with 'wx'
27
28\begin{verbatim}
29
30 wxDB_PATH_MAX Maximum path length allowed to be passed to the ODBC
31 driver to indicate where the data file is located.
32
33 DB_MAX_COLUMN_NAME_LEN Maximum supported length for the name of a column
34
35 DB_MAX_ERROR_HISTORY Maximum number of error messages retained in the
36 queue before being overwritten by new errors.
37
38 DB_MAX_ERROR_MSG_LEN Maximum supported length of an error message returned
39 by the ODBC classes
40
41 DB_MAX_STATEMENT_LEN Maximum supported length for a complete SQL statement
42 to be passed to the ODBC driver
43
44 DB_MAX_TABLE_NAME_LEN Maximum supported length for the name of a table
45
46 DB_MAX_WHERE_CLAUSE_LEN Maximum supported WHERE clause length that can be
47 passed to the ODBC driver
48
49 DB_TYPE_NAME_LEN Maximum length of the name of a column's data type
50\end{verbatim}
51
52
3ca6a5f0
BP
53\wxheading{Enumerated types}
54
d0c6b305 55\docparam{enum {\bf wxDbSqlLogState}}{sqlLogOFF, sqlLogON}
3ca6a5f0
BP
56
57{\it enum {\bf wxDBMS}}
58
d0c6b305 59These are the databases currently tested and working with the ODBC classes. A call to \helpref{wxDb::Dbms}{wxdbdbms} will return one of these enumerated values listed below.
3ca6a5f0
BP
60
61\begin{verbatim}
62 dbmsUNIDENTIFIED,
63 dbmsORACLE,
64 dbmsSYBASE_ASA, // Adaptive Server Anywhere
65 dbmsSYBASE_ASE, // Adaptive Server Enterprise
66 dbmsMS_SQL_SERVER,
67 dbmsMY_SQL,
68 dbmsPOSTGRES,
69 dbmsACCESS,
70 dbmsDBASE,
71 dbmsINFORMIX
72\end{verbatim}
73
d0c6b305 74See the remarks in \helpref{wxDb::Dbms}{wxdbdbms} for exceptions/issues with each of these database engines.
3ca6a5f0
BP
75
76\wxheading{Public member variables}
77
d0c6b305 78\docparam{SWORD {\bf wxDb::cbErrorMsg}}{This member variable is populated as a result of calling \helpref{wxDb::GetNextError}{wxdbgetnexterror}. Contains the count of bytes in the wxDb::errorMsg string.}
3ca6a5f0 79
d0c6b305 80\docparam{int {\bf wxDb::DB\_STATUS}}{The last ODBC error that occurred on this data connection. Possible codes are:}
3ca6a5f0
BP
81
82\begin{verbatim}
83 DB_ERR_GENERAL_WARNING // SqlState = '01000'
84 DB_ERR_DISCONNECT_ERROR // SqlState = '01002'
85 DB_ERR_DATA_TRUNCATED // SqlState = '01004'
86 DB_ERR_PRIV_NOT_REVOKED // SqlState = '01006'
87 DB_ERR_INVALID_CONN_STR_ATTR // SqlState = '01S00'
88 DB_ERR_ERROR_IN_ROW // SqlState = '01S01'
89 DB_ERR_OPTION_VALUE_CHANGED // SqlState = '01S02'
90 DB_ERR_NO_ROWS_UPD_OR_DEL // SqlState = '01S03'
91 DB_ERR_MULTI_ROWS_UPD_OR_DEL // SqlState = '01S04'
92 DB_ERR_WRONG_NO_OF_PARAMS // SqlState = '07001'
93 DB_ERR_DATA_TYPE_ATTR_VIOL // SqlState = '07006'
94 DB_ERR_UNABLE_TO_CONNECT // SqlState = '08001'
95 DB_ERR_CONNECTION_IN_USE // SqlState = '08002'
96 DB_ERR_CONNECTION_NOT_OPEN // SqlState = '08003'
97 DB_ERR_REJECTED_CONNECTION // SqlState = '08004'
98 DB_ERR_CONN_FAIL_IN_TRANS // SqlState = '08007'
99 DB_ERR_COMM_LINK_FAILURE // SqlState = '08S01'
100 DB_ERR_INSERT_VALUE_LIST_MISMATCH // SqlState = '21S01'
101 DB_ERR_DERIVED_TABLE_MISMATCH // SqlState = '21S02'
102 DB_ERR_STRING_RIGHT_TRUNC // SqlState = '22001'
103 DB_ERR_NUMERIC_VALUE_OUT_OF_RNG // SqlState = '22003'
104 DB_ERR_ERROR_IN_ASSIGNMENT // SqlState = '22005'
105 DB_ERR_DATETIME_FLD_OVERFLOW // SqlState = '22008'
106 DB_ERR_DIVIDE_BY_ZERO // SqlState = '22012'
107 DB_ERR_STR_DATA_LENGTH_MISMATCH // SqlState = '22026'
108 DB_ERR_INTEGRITY_CONSTRAINT_VIOL // SqlState = '23000'
109 DB_ERR_INVALID_CURSOR_STATE // SqlState = '24000'
110 DB_ERR_INVALID_TRANS_STATE // SqlState = '25000'
111 DB_ERR_INVALID_AUTH_SPEC // SqlState = '28000'
112 DB_ERR_INVALID_CURSOR_NAME // SqlState = '34000'
113 DB_ERR_SYNTAX_ERROR_OR_ACCESS_VIOL // SqlState = '37000'
114 DB_ERR_DUPLICATE_CURSOR_NAME // SqlState = '3C000'
115 DB_ERR_SERIALIZATION_FAILURE // SqlState = '40001'
116 DB_ERR_SYNTAX_ERROR_OR_ACCESS_VIOL2 // SqlState = '42000'
117 DB_ERR_OPERATION_ABORTED // SqlState = '70100'
118 DB_ERR_UNSUPPORTED_FUNCTION // SqlState = 'IM001'
119 DB_ERR_NO_DATA_SOURCE // SqlState = 'IM002'
120 DB_ERR_DRIVER_LOAD_ERROR // SqlState = 'IM003'
121 DB_ERR_SQLALLOCENV_FAILED // SqlState = 'IM004'
122 DB_ERR_SQLALLOCCONNECT_FAILED // SqlState = 'IM005'
123 DB_ERR_SQLSETCONNECTOPTION_FAILED // SqlState = 'IM006'
124 DB_ERR_NO_DATA_SOURCE_DLG_PROHIB // SqlState = 'IM007'
125 DB_ERR_DIALOG_FAILED // SqlState = 'IM008'
126 DB_ERR_UNABLE_TO_LOAD_TRANSLATION_DLL // SqlState = 'IM009'
127 DB_ERR_DATA_SOURCE_NAME_TOO_LONG // SqlState = 'IM010'
128 DB_ERR_DRIVER_NAME_TOO_LONG // SqlState = 'IM011'
129 DB_ERR_DRIVER_KEYWORD_SYNTAX_ERROR // SqlState = 'IM012'
130 DB_ERR_TRACE_FILE_ERROR // SqlState = 'IM013'
131 DB_ERR_TABLE_OR_VIEW_ALREADY_EXISTS // SqlState = 'S0001'
132 DB_ERR_TABLE_NOT_FOUND // SqlState = 'S0002'
133 DB_ERR_INDEX_ALREADY_EXISTS // SqlState = 'S0011'
134 DB_ERR_INDEX_NOT_FOUND // SqlState = 'S0012'
135 DB_ERR_COLUMN_ALREADY_EXISTS // SqlState = 'S0021'
136 DB_ERR_COLUMN_NOT_FOUND // SqlState = 'S0022'
137 DB_ERR_NO_DEFAULT_FOR_COLUMN // SqlState = 'S0023'
138 DB_ERR_GENERAL_ERROR // SqlState = 'S1000'
139 DB_ERR_MEMORY_ALLOCATION_FAILURE // SqlState = 'S1001'
140 DB_ERR_INVALID_COLUMN_NUMBER // SqlState = 'S1002'
141 DB_ERR_PROGRAM_TYPE_OUT_OF_RANGE // SqlState = 'S1003'
142 DB_ERR_SQL_DATA_TYPE_OUT_OF_RANGE // SqlState = 'S1004'
143 DB_ERR_OPERATION_CANCELLED // SqlState = 'S1008'
144 DB_ERR_INVALID_ARGUMENT_VALUE // SqlState = 'S1009'
145 DB_ERR_FUNCTION_SEQUENCE_ERROR // SqlState = 'S1010'
146 DB_ERR_OPERATION_INVALID_AT_THIS_TIME // SqlState = 'S1011'
147 DB_ERR_INVALID_TRANS_OPERATION_CODE // SqlState = 'S1012'
148 DB_ERR_NO_CURSOR_NAME_AVAIL // SqlState = 'S1015'
149 DB_ERR_INVALID_STR_OR_BUF_LEN // SqlState = 'S1090'
150 DB_ERR_DESCRIPTOR_TYPE_OUT_OF_RANGE // SqlState = 'S1091'
151 DB_ERR_OPTION_TYPE_OUT_OF_RANGE // SqlState = 'S1092'
152 DB_ERR_INVALID_PARAM_NO // SqlState = 'S1093'
153 DB_ERR_INVALID_SCALE_VALUE // SqlState = 'S1094'
154 DB_ERR_FUNCTION_TYPE_OUT_OF_RANGE // SqlState = 'S1095'
155 DB_ERR_INF_TYPE_OUT_OF_RANGE // SqlState = 'S1096'
156 DB_ERR_COLUMN_TYPE_OUT_OF_RANGE // SqlState = 'S1097'
157 DB_ERR_SCOPE_TYPE_OUT_OF_RANGE // SqlState = 'S1098'
158 DB_ERR_NULLABLE_TYPE_OUT_OF_RANGE // SqlState = 'S1099'
159 DB_ERR_UNIQUENESS_OPTION_TYPE_OUT_OF_RANGE // SqlState = 'S1100'
160 DB_ERR_ACCURACY_OPTION_TYPE_OUT_OF_RANGE // SqlState = 'S1101'
161 DB_ERR_DIRECTION_OPTION_OUT_OF_RANGE // SqlState = 'S1103'
162 DB_ERR_INVALID_PRECISION_VALUE // SqlState = 'S1104'
163 DB_ERR_INVALID_PARAM_TYPE // SqlState = 'S1105'
164 DB_ERR_FETCH_TYPE_OUT_OF_RANGE // SqlState = 'S1106'
165 DB_ERR_ROW_VALUE_OUT_OF_RANGE // SqlState = 'S1107'
166 DB_ERR_CONCURRENCY_OPTION_OUT_OF_RANGE // SqlState = 'S1108'
167 DB_ERR_INVALID_CURSOR_POSITION // SqlState = 'S1109'
168 DB_ERR_INVALID_DRIVER_COMPLETION // SqlState = 'S1110'
169 DB_ERR_INVALID_BOOKMARK_VALUE // SqlState = 'S1111'
170 DB_ERR_DRIVER_NOT_CAPABLE // SqlState = 'S1C00'
171 DB_ERR_TIMEOUT_EXPIRED // SqlState = 'S1T00'
172\end{verbatim}
173
d0c6b305 174\docparam{struct {\bf wxDb::dbInf}}{This structure is internal to the wxDb class and contains details of the ODBC datasource that the current instance of the wxDb is connected to in its members. When the data source is opened, all of the information contained in the dbInf structure is queried from the data source. This information is used almost exclusively within the ODBC class library. Where there is a need for this information outside of the class library a member function such as wxDbTable::IsCursorClosedOnCommit() has been added for ease of use.}
3ca6a5f0
BP
175
176\begin{verbatim}
177 char dbmsName[40] - Name of the dbms product
178 char dbmsVer[64] - Version # of the dbms product
179 char driverName[40] - Driver name
180 char odbcVer[60] - ODBC version of the driver
181 char drvMgrOdbcVer[60] - ODBC version of the driver manager
182 char driverVer[60] - Driver version
183 char serverName[80] - Server Name, typically a connect string
184 char databaseName[128] - Database filename
185 char outerJoins[2] - Does datasource support outer joins
186 char procedureSupport[2] - Does datasource support stored procedures
187 UWORD maxConnections - Maximum # of connections datasource supports
188 UWORD maxStmts - Maximum # of HSTMTs per HDBC
189 UWORD apiConfLvl - ODBC API conformance level
190 UWORD cliConfLvl - Is datasource SAG compliant
191 UWORD sqlConfLvl - SQL conformance level
192 UWORD cursorCommitBehavior - How cursors are affected on db commit
193 UWORD cursorRollbackBehavior - How cursors are affected on db rollback
194 UWORD supportNotNullClause - Does datasource support NOT NULL clause
195 char supportIEF[2] - Integrity Enhancement Facility (Ref. Integrity)
196 UDWORD txnIsolation - Transaction isolation level supported by driver
197 UDWORD txnIsolationOptions - Transaction isolation level options available
198 UDWORD fetchDirections - Fetch directions supported
199 UDWORD lockTypes - Lock types supported in SQLSetPos
200 UDWORD posOperations - Position operations supported in SQLSetPos
201 UDWORD posStmts - Position statements supported
202 UDWORD scrollConcurrency - Scrollable cursor concurrency options supported
203 UDWORD scrollOptions - Scrollable cursor options supported
204 UDWORD staticSensitivity - Can additions/deletions/updates be detected
205 UWORD txnCapable - Indicates if datasource supports transactions
206 UDWORD loginTimeout - Number seconds to wait for a login request
207\end{verbatim}
208
d0c6b305 209\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.}
3ca6a5f0
BP
210
211\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.}
212
213\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.}
214
215\docparam{wxChar {\bf wxDb::sqlState}[20]}{Set by wxDb::TranslateSqlState(). Indicates the error state after a failed ODBC operation. Used for reporting ODBC errors.}
216
d0c6b305 217\wxheading{Remarks}
3ca6a5f0 218
d0c6b305
GT
219Default cursor scrolling is defined by wxODBC_FWD_ONLY_CURSORS in setup.h
220when the wxWindows library is built. This behavior can be overridden when
221an instance of a wxDb is created (see \helpref{wxDb constructor}{wxdbconstr}).
3ca6a5f0 222
d0c6b305 223\wxheading{See also}
3ca6a5f0 224
d0c6b305 225\helpref{wxDbColFor}{wxdbcolfor}, \helpref{wxDbColInf}{wxdbcolinf}, \helpref{wxDbTable}{wxdbtable}, \helpref{wxDbTableInf}{wxdbtableinf}, \helpref{wxDbInf}{wxdbinf}
3ca6a5f0 226
d0c6b305 227\subsection{Associated non-class functions}\label{wxdbfunctions}
3ca6a5f0 228
d0c6b305 229The following functions are used in conjunction with the wxDb class.
3ca6a5f0 230
d0c6b305 231\func{wxDb *}{wxDbGetConnection}{\param{wxDbConnectInf *}{pDbConfig}, \param{bool }{FwdOnlyCursors=(bool)wxODBC_FWD_ONLY_CURSORS}}
3ca6a5f0 232
d0c6b305 233\func{bool}{wxDbFreeConnection}{\param{wxDb *}{pDb}}
f6bcfd97 234
d0c6b305 235\func{void}{wxDbCloseConnections}{\void}
f6bcfd97 236
d0c6b305 237\func{int}{wxDbConnectionsInUse}{\void}
f6bcfd97 238
d0c6b305 239\func{bool}{wxDbSqlLog}{\param{wxDbSqlLogState }{state}, \param{const wxChar *}{filename = SQL_LOG_FILENAME}}
f6bcfd97 240
d0c6b305 241\func{bool}{wxDbGetDataSource}{\param{HENV }{henv}, \param{char *}{Dsn}, \param{SWORD }{DsnMax}, \param{char *}{DsDesc}, \param{SWORD }{DsDescMax}, \param{UWORD }{direction = SQL_FETCH_NEXT}}
f6bcfd97 242
d0c6b305 243\latexignore{\rtfignore{\wxheading{Members}}}
f6bcfd97 244
3ca6a5f0
BP
245\membersection{wxDb::wxDb}\label{wxdbconstr}
246
247\func{}{wxDb}{\void}
f6bcfd97
BP
248
249Default constructor.
250
d0c6b305 251\func{}{wxDb}{\param{HENV\& }{aHenv}, \param{bool }{FwdOnlyCursors=(bool)wxODBC_FWD_ONLY_CURSORS}}
f6bcfd97
BP
252
253Constructor, used to create an ODBC connection to a data source.
254
255\wxheading{Parameters}
256
d0c6b305
GT
257\docparam{aHenv}{Environment handle used for this connection.}
258
259\docparam{FwdOnlyCursors}{Will cursors created for use with this datasource connection only allow forward scrolling cursors.}
f6bcfd97
BP
260
261\wxheading{Remarks}
262
3ca6a5f0 263This is the constructor for the wxDb class. The wxDb object must
f6bcfd97
BP
264be created and opened before any database activity can occur.
265
266\wxheading{Example}
d0c6b305 267
f6bcfd97 268\begin{verbatim}
3ca6a5f0
BP
269 wxDbConnectInf ConnectInf;
270 ....Set values for member variables of ConnectInf here
f6bcfd97 271
3ca6a5f0
BP
272 wxDb sampleDB(ConnectInf.Henv);
273 if (!sampleDB.Open(ConnectInf.Dsn, ConnectInf.Uid, ConnectInf.AuthStr))
f6bcfd97
BP
274 {
275 // Error opening data source
276 }
277\end{verbatim}
278
279
3ca6a5f0 280\membersection{wxDb::Catalog}\label{wxdbcatalog}
f6bcfd97
BP
281
282\func{bool}{Catalog}{\param{char *}{ userID}, \param{char *}{fileName = SQL_CATALOG_FILENAME}}
283
3ca6a5f0
BP
284Allows a data "dictionary" of the data source to be created, dumping pertinent information about all data tables to which the user specified in userID has access.
285
f6bcfd97
BP
286\wxheading{Parameters}
287
288\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.}
289
290\docparam{fileName}{OPTIONAL argument. Name of the text file to create and write the DB catalog to.}
291
3ca6a5f0 292\wxheading{Return value}
f6bcfd97 293
3ca6a5f0 294Returns TRUE if the catalog request was successful, of FALSE if there was some reason the catalog could not be generated
f6bcfd97
BP
295
296\wxheading{Example}
d0c6b305 297
f6bcfd97
BP
298\begin{verbatim}
299============== ============== ================ ========= =======
300TABLE NAME COLUMN NAME DATA TYPE PRECISION LENGTH
301============== ============== ================ ========= =======
302EMPLOYEE RECID (0008)NUMBER 15 8
303EMPLOYEE USER_ID (0012)VARCHAR2 13 13
304EMPLOYEE FULL_NAME (0012)VARCHAR2 26 26
305EMPLOYEE PASSWORD (0012)VARCHAR2 26 26
306EMPLOYEE START_DATE (0011)DATE 19 16
307\end{verbatim}
308
309
3ca6a5f0 310\membersection{wxDb::Close}\label{wxdbclose}
f6bcfd97
BP
311
312\func{void}{Close}{\void}
313
3ca6a5f0
BP
314Closes the database connection.
315
f6bcfd97
BP
316\wxheading{Remarks}
317
3ca6a5f0
BP
318At the end of your program, when you have finished all of your database work, you must close the ODBC connection to the data source. There are actually four steps involved in doing this as illustrated in the example.
319
d0c6b305 320Any wxDbTable instances which use this connection must be deleted before closing the database connection.
f6bcfd97
BP
321
322\wxheading{Example}
d0c6b305 323
f6bcfd97
BP
324\begin{verbatim}
325 // Commit any open transactions on the data source
326 sampleDB.CommitTrans();
327
d0c6b305 328 // Delete any remaining wxDbTable objects allocated with new
f6bcfd97
BP
329 delete parts;
330
3ca6a5f0 331 // Close the wxDb connection when finished with it
f6bcfd97
BP
332 sampleDB.Close();
333
334 // Free Environment Handle that ODBC uses
335 if (SQLFreeEnv(Db.Henv) != SQL_SUCCESS)
336 {
337 // Error freeing environment handle
338 }
339\end{verbatim}
340
3ca6a5f0
BP
341
342\membersection{wxDb::CommitTrans}\label{wxdbcommittrans}
343
344\func{bool}{CommitTrans}{\void}
345
346Permanently "commits" changes (insertions/deletions/updates) to the database.
347
348\wxheading{Return value}
349
350Returns TRUE if the commit was successful, or FALSE if the commit failed.
351
352\wxheading{Remarks}
353
354Transactions begin implicitly as soon as you make a change to the database. At any time thereafter, you can save your work to the database ("Commit") or roll back all of your changes ("Rollback"). Calling this member function commits all open transactions on this ODBC connection.
355
356\wxheading{Special Note : {\it Cursors} }
357
358\normalbox{It is important to understand that different database/ODBC driver combinations handle
359transactions differently. One thing in particular that you must pay attention to is
360cursors, in regard to transactions. Cursors are what allow you to scroll through
361records forward and backward and to manipulate records as you scroll through them.
362When you issue a query, a cursor is created behind the scenes. The cursor keeps track
363of the query and keeps track of the current record pointer. After you commit or
364rollback a transaction, the cursor may be closed automatically. This means you must
d0c6b305 365requery the data source before you can perform any additional work against the wxDbTable
3ca6a5f0 366object. This is only necessary however if the data source closes the cursor after a
d0c6b305 367commit or rollback. Use the wxDbTable::IsCursorClosedOnCommit() member function to
3ca6a5f0
BP
368determine the data source's transaction behavior. Note, it would be very inefficient
369to just assume the data source closes the cursor and always requery. This could put
370a significant, unnecessary load on data sources that leave the cursors open after a
371transaction.}
372
373
374\membersection{wxDb::CreateView}\label{wxdbcreateviews}
375
376\func{bool}{CreateView}{\param{char *}{ viewName}, \param{char *}{ colList}, \param{char *}{pSqlStmt}}
377
378Creates a SQL VIEW.
379
380\wxheading{Parameters}
381
382\docparam{viewName}{The name of the view. e.g. PARTS_V}
d0c6b305
GT
383
384\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.}
385
386\docparam{pSqlStmt}{Pointer to the select statement portion of the CREATE VIEW statement. Must be a complete, valid SQL SELECT statement.}
3ca6a5f0
BP
387
388\wxheading{Remarks}
389
390A '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.
391
392NOTE: Views are not available with all datasources. Oracle is one example of a datasouce which does support views.
393
394\wxheading{Example}
d0c6b305 395
3ca6a5f0
BP
396\begin{verbatim}
397 // Incomplete code sample
398 db.CreateView("PARTS_SD1", "PN, PD, QTY",
d0c6b305
GT
399 "SELECT PART_NO, PART_DESC, QTY_ON_HAND * 1.1 FROM PARTS \
400 WHERE STORAGE_DEVICE = 1");
3ca6a5f0
BP
401
402 // PARTS_SD1 can now be queried just as if it were a data table.
403 // e.g. SELECT PN, PD, QTY FROM PARTS_SD1
404\end{verbatim}
405
406
407\membersection{wxDb::DispAllErrors}\label{wxdbdispallerrors}
408
409\func{bool}{DispAllErrors}{\param{HENV}{ aHenv}, {\param}{HDBC}{ aHdbc = SQL_NULL_HDBC}, {\param}{HSTMT}{ aHstmt = SQL_NULL_HSTMT}}
410
411Logs all database errors that occurred as a result of the last executed database command. This logging also includes debug logging when compiled in debug mode via \helpref{wxLogDebug}{wxlogdebug}. If logging is turned on via \helpref{wxDb::SetSqlLogging}{wxdbsetsqllogging}, then an entry is also logged to the defined log file.
412
413\wxheading{Parameters}
414
415\docparam{aHenv}{A handle to the ODBC environment.}
d0c6b305
GT
416
417\docparam{aHdbc}{A handle to the ODBC connection. Pass this in if the ODBC function call that erred out required a hdbc or hstmt argument.}
418
419\docparam{AHstmt}{A handle to the ODBC statement being executed against. Pass this in if the ODBC function call that erred out required a hstmt argument.}
3ca6a5f0
BP
420
421\wxheading{Remarks}
422
423This member function will display all of the ODBC error messages for the last ODBC function call that was made. Normally used internally within the ODBC class library. Would be used externally if calling ODBC functions directly (i.e. SQLFreeEnv()).
424
425\wxheading{See also}
426
d0c6b305 427\helpref{wxDb::SetSqlLogging}{wxdbsetsqllogging}, wxDbSqlLog
3ca6a5f0
BP
428
429\wxheading{Example}
d0c6b305 430
3ca6a5f0
BP
431\begin{verbatim}
432 if (SQLExecDirect(hstmt, (UCHAR FAR *) pSqlStmt, SQL_NTS) != SQL_SUCCESS)
433 // Display all ODBC errors for this stmt
434 return(db.DispAllErrors(db.henv, db.hdbc, hstmt));
435\end{verbatim}
436
437
438\membersection{wxDb::DispNextError}\label{wxdbdispnexterror}
439
440\func{void}{DispNextError}{\void}
441
442\wxheading{Remarks}
443
444This function is normally used internally within the ODBC class library.
445It could be used externally if calling ODBC functions directly. This
446function works in conjunction with \helpref{wxDb::GetNextError}{wxdbgetnexterror} when errors (or
447sometimes informational messages) returned from ODBC need to be analyzed
448rather than simply displaying them as an error. GetNextError() retrieves
449the next ODBC error from the ODBC error queue. The wxDb member variables
450"sqlState", "nativeError" and "errorMsg" could then be evaluated. To
451display the error retrieved, DispNextError() could then be called.
452The combination of GetNextError() and DispNextError() can be used to
453iteratively step through the errors returned from ODBC evaluating each
454one in context and displaying the ones you choose.
455
456\wxheading{Example}
d0c6b305 457
3ca6a5f0
BP
458\begin{verbatim}
459 // Drop the table before attempting to create it
460 sprintf(sqlStmt, "DROP TABLE %s", tableName);
461 // Execute the drop table statement
462 if (SQLExecDirect(hstmt,(UCHAR FAR *)sqlStmt,SQL_NTS) != SQL_SUCCESS)
463 {
464 // Check for sqlState = S0002, "Table or view not found".
465 // Ignore this error, bomb out on any other error.
466 pDb->GetNextError(henv, hdbc, hstmt);
467 if (strcmp(pDb->sqlState, "S0002"))
468 {
469 pDb->DispNextError(); // Displayed error retrieved
470 pDb->DispAllErrors(henv, hdbc, hstmt); // Display all other errors, if any
471 pDb->RollbackTrans(); // Rollback the transaction
472 CloseCursor(); // Close the cursor
473 return(FALSE); // Return Failure
474 }
475 }
476\end{verbatim}
477
478
479\membersection{wxDb::DropView}\label{wxdbdropview}
480
481\func{bool}{DropView}{\param{const char *}{viewName}}
482
483Drops the data table view named in 'viewName'.
484
485\wxheading{Parameters}
486
487\docparam{viewName}{Name of the view to be dropped.}
488
489\wxheading{Remarks}
490
d0c6b305 491If the view does not exist, this function will return TRUE. Note that views are not supported with all data sources.
3ca6a5f0
BP
492
493\membersection{wxDb::ExecSql}\label{wxdbexecsql}
494
495\func{bool}{ExecSql}{\param{char *}{pSqlStmt}}
496
497Allows 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.
498
499\wxheading{Parameters}
500
501\docparam{pSqlStmt}{Pointer to the SQL statement to be executed.}
502
503\wxheading{Remarks}
504
505This member extends the wxDb class and allows you to build and execute ANY VALID
506SQL statement against the data source. This allows you to extend the class
507library by being able to issue any SQL statement that the data source is capable
508of processing.
509
510\wxheading{See also}
511
512\helpref{wxDb::GetData}{wxdbgetdata}, \helpref{wxDb::GetNext}{wxdbgetnext}
513
3ca6a5f0
BP
514\membersection{wxDb::FwdOnlyCursors}\label{wxdbfwdonlycursors}
515
516\func{bool}{FwdOnlyCursors}{\void}
517
518Indicates whether this connection to the datasource only allows forward scrolling cursors or not. This state is set at connection creation time.
519
d0c6b305
GT
520\wxheading{Remarks}
521
522In wxWindows v2.4 release, this function will be deprecated to use a renamed version of the function called wxDb::IsFwdOnlyCursors() to match the normal wxWindows naming conventions for class member functions.
3ca6a5f0 523
d0c6b305 524\wxheading{See also}
3ca6a5f0 525
d0c6b305 526\helpref{wxDb::IsFwdOnlyCursors}{wxdbisfwdonlycursors}, \helpref{wxDb::wxDb}{wxdbconstr}, \helpref{wxDbGetConnection}{wxdbfunctions}
3ca6a5f0
BP
527
528\membersection{wxDb::GetCatalog}\label{wxdbgetcatalog}
529
530\func{wxDbInf *}{GetCatalog}{\param{char *}{userID}}
531
532Returns a wxDbInf pointer that points to the catalog(data source) name, schema, number of tables accessible to the current user, and a wxDbTableInf pointer to all data pertaining to all tables in the users catalog.
533
534\wxheading{Parameters}
535
d0c6b305 536\docparam{userID}{Owner of the table. Specify a userID when the datasource you are connected to allows multiple unique tables with the same name to be owned by different users. {\it userID} is evaluated as follows:}
3ca6a5f0
BP
537
538\begin{verbatim}
539 userID == NULL ... UserID is ignored (DEFAULT)
540 userID == "" ... UserID set equal to 'this->uid'
541 userID != "" ... UserID set equal to 'userID'
542\end{verbatim}
543
544\wxheading{Remarks}
545
546The returned catalog will only contain catalog entries for tables to which the user specified in 'userID' has sufficient privileges. If no user is specified (NULL passed in), a catalog pertaining to all tables in the datasource accessible via this connection will be returned.
547
3ca6a5f0
BP
548\membersection{wxDb::GetColumnCount}\label{wxdbgetcolumncount}
549
550\func{int}{GetColumnCount}{\param{char *}{tableName}, \param{const char *}{userID}}
551
552\wxheading{Parameters}
553
554\docparam{tableName}{A table name you wish to obtain column information about.}
d0c6b305
GT
555
556\docparam{userID}{Name of the user that owns the table(s). 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:}
3ca6a5f0
BP
557
558\begin{verbatim}
559 userID == NULL ... UserID is ignored (DEFAULT)
560 userID == "" ... UserID set equal to 'this->uid'
561 userID != "" ... UserID set equal to 'userID'
562\end{verbatim}
563
564\wxheading{Return value}
565
566Returns a count of how many columns are in the specified table. If an error occurs retrieving the number of columns the function will return a -1.
567
3ca6a5f0
BP
568\membersection{wxDb::GetColumns}\label{wxdbgetcolumns}
569
570\func{wxDbColInf *}{GetColumns}{\param{char *}{tableName}, \param{int *}{numCols}, \param{const char *}{userID=NULL}}
571
572\func{wxDbColInf *}{GetColumns}{\param{char *}{tableName[]}, \param{const char *}{userID}}
573
574\wxheading{Parameters}
575
576\docparam{tableName}{A table name you wish to obtain column information about.}
d0c6b305
GT
577\docparam{numCols}{A pointer to a integer which will hold a count of the number of columns returned by this function}
578\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.}
579\docparam{userID}{Name of the user that owns the table(s). 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:}
3ca6a5f0
BP
580
581\begin{verbatim}
582 userID == NULL ... UserID is ignored (DEFAULT)
583 userID == "" ... UserID set equal to 'this->uid'
584 userID != "" ... UserID set equal to 'userID'
585\end{verbatim}
586
587\wxheading{Return value}
588
589This function returns an array of wxDbColInf structures. This allows you to obtain
590information regarding the columns of your table(s). If no columns were found, or
d0c6b305 591an error occurred, this pointer will be zero (null).
3ca6a5f0
BP
592
593THE CALLING FUNCTION IS RESPONSIBLE FOR DELETING THE {\it wxDbColInf} MEMORY WHEN IT IS
594FINISHED WITH IT.
595
596\normalbox{ALL column bindings associated with this wxDb instance are unbound
597by this function. This function should use its own wxDb instance
598to avoid undesired unbinding of columns.}
599
600\wxheading{See also}
601
602\helpref{wxDbColInf}{wxdbcolinf}
603
604\wxheading{Example}
d0c6b305 605
3ca6a5f0
BP
606\begin{verbatim}
607 char *tableList[] = {"PARTS", 0};
608 wxDbColInf *colInf = pDb->GetColumns(tableList);
609 if (colInf)
610 {
611 // Use the column inf
612 .......
613 // Destroy the memory
614 delete [] colInf;
615 }
616\end{verbatim}
617
618
619\membersection{wxDb::GetData}\label{wxdbgetdata}
620
621\func{bool}{GetData}{\param{UWORD}{ colNo}, \param{SWORD}{ cType}, \param{PTR}{ pData}, \param{SDWORD}{ maxLen}, \param{SDWORD FAR *}{ cbReturned} }
622
623Used to retrieve result set data without binding column values to memory variables (i.e. not using a wxDbTable instance to access table data).
624
625\wxheading{Parameters}
626
627\docparam{colNo}{Ordinal number of column in the result set to be returned.}
628\docparam{cType}{The C data type that is to be returned.}
629\docparam{pData}{Memory buffer which will hold the data returned by the call to this function.}
630\docparam{maxLen}{Maximum size of the buffer that will hold the returned value.}
631\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 GetData() call has failed.}
632
633\wxheading{See also}
634
635\helpref{wxDb::GetNext}{wxdbgetnext}, \helpref{wxDb::ExecSql}{wxdbexecsql}
636
637\wxheading{Example}
d0c6b305 638
3ca6a5f0
BP
639\begin{verbatim}
640 SDWORD cb;
641 ULONG reqQty;
642 wxString sqlStmt;
d0c6b305
GT
643 sqlStmt = "SELECT SUM(REQUIRED_QTY - PICKED_QTY) FROM ORDER_TABLE WHERE \
644 PART_RECID = 1450 AND REQUIRED_QTY > PICKED_QTY";
3ca6a5f0
BP
645
646 // Perform the query
647 if (!pDb->ExecSql(sqlStmt.c_str()))
648 {
649 // ERROR
650 return(0);
651 }
652
653 // Request the first row of the result set
654 if (!pDb->GetNext())
655 {
656 // ERROR
657 return(0);
658 }
659
660 Read column #1 of this row of the result set and store the value in 'reqQty'
661 if (!pDb->GetData(1, SQL_C_ULONG, &reqQty, 0, &cb))
662 {
663 // ERROR
664 return(0);
665 }
666
667 // Check for a NULL result
668 if (cb == SQL_NULL_DATA)
669 return(0);
670\end{verbatim}
671
672\wxheading{Remarks}
673
674When requesting multiple columns to be returned from the result set (for example, the SQL query
675requested 3 columns be returned), the calls to GetData must request the columns in ordinal
676sequence (1,2,3 or 1,3 or 2,3).
677
3ca6a5f0
BP
678\membersection{wxDb::GetDatabaseName}\label{wxdbgetdatabasename}
679
680\func{char *}{GetDatabaseName}{\void}
681
682Returns the name of the database engine.
683
3ca6a5f0
BP
684\membersection{wxDb::GetDataSource}\label{wxdbgetdatasource}
685
686\func{char *}{GetDataSource}{\void}
687
688Returns the ODBC datasource name.
689
3ca6a5f0
BP
690\membersection{wxDb::GetHDBC}\label{wxdbgethdbc}
691
692\func{HDBC}{GetHDBC}{\void}
693
694Returns the ODBC handle to the database connection.
695
3ca6a5f0
BP
696\membersection{wxDb::GetHENV}\label{wxdbgethenv}
697
698\func{HENV}{GetHENV}{\void}
699
700Returns the ODBC environment handle.
701
3ca6a5f0
BP
702\membersection{wxDb::GetHSTMT}\label{wxdbgethstmt}
703
704\func{HSTMT}{GetHSTMT}{\void}
705
706Returns the ODBC statement handle associated with this database connection.
707
3ca6a5f0
BP
708\membersection{wxDb::GetKeyFields}\label{wxdbgetkeyfields}
709
710\func{int}{GetKeyFields}{\param{char *}{tableName}, \param{wxDbColInf *}{colInf}, \param{int}{nocols}}
711
712Used 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.
713
d0c6b305 714This function is primarily for use by the \helpref{wxDb::GetColumns}{wxdbgetcolumns} function, but may be called if desired from the client application.
3ca6a5f0
BP
715
716\wxheading{Parameters}
717
718\docparam{tableName}{Name of the table for which the columns will be evaluated as to their inclusion in any indexes.}
d0c6b305 719\docparam{colInf}{Data structure containing the column definitions (obtained with \helpref{wxDb::GetColumns}{wxdbgetcolumns}). This function populates the PkCol, PkTableName, and FkTableName members of the colInf structure.}
3ca6a5f0
BP
720\docparam{nocols}{Number of columns defined in the instance of colInf.}
721
722\wxheading{Return value}
723
724Currently always returns TRUE.
725
726\wxheading{See also}
727
728\helpref{wxDbColInf}{wxdbcolinf}, \helpref{wxDb::GetColumns}{wxdbgetcolumns}
729
3ca6a5f0
BP
730\membersection{wxDb::GetNext}\label{wxdbgetnext}
731
d0c6b305 732\func{bool}{GetNext}{\void}
3ca6a5f0
BP
733
734Requests the next row in the result set obtained by issueing a query through a direct request using wxDb::ExecSql().
735
736\wxheading{See also}
737
738\helpref{wxDb::ExecSql}{wxdbexecsql}, \helpref{wxDb::GetData}{wxdbgetdata}
739
3ca6a5f0
BP
740\membersection{wxDb::GetNextError}\label{wxdbgetnexterror}
741
742\func{bool}{GetNextError}{\param{HENV}{ aHenv}, \param{HDBC}{ aHdbc = SQL_NULL_HDBC}, \param{HSTMT}{ aHstmt = SQL_NULL_HSTMT}}
743
744\wxheading{Parameters}
745
746\docparam{aHenv}{A handle to the ODBC environment.}
747\docparam{aHdbc}{A handle to the ODBC connection. Pass this in if the ODBC function call that
748erred out required a hdbc or hstmt argument.}
749\docparam{AHstmt}{A handle to the ODBC statement being executed against. Pass this in if the
750ODBC function call that erred out requires a hstmt argument.}
751
752\wxheading{See also}
753
754\helpref{wxDb::DispNextError}{wxdbdispnexterror}, \helpref{wxDb::DispAllErrors}{wxdbdispallerrors}
755
756\wxheading{Example}
d0c6b305 757
3ca6a5f0
BP
758\begin{verbatim}
759 if (SQLExecDirect(hstmt, (UCHAR FAR *) pSqlStmt, SQL_NTS) != SQL_SUCCESS)
760 {
761 // Display all ODBC errors for this stmt
762 return(db.DispAllErrors(db.henv, db.hdbc, hstmt));
763 }
764\end{verbatim}
765
3ca6a5f0
BP
766\membersection{wxDb::GetPassword}\label{wxdbgetpassword}
767
768\func{char *}{GetPassword}{\void}
769
770Returns the password used to connect to the datasource.
771
3ca6a5f0
BP
772\membersection{wxDb::GetTableCount}\label{wxdbgettablecount}
773
774\func{int}{GetTableCount}{\void}
775
776Returns the number of wxDbTable() instances currently using this data source connection.
777
3ca6a5f0
BP
778\membersection{wxDb::GetUsername}\label{wxdbgetusername}
779
780\func{char *}{GetUsername}{\void}
781
782Returns the user name used to access the datasource.
783
3ca6a5f0
BP
784\membersection{wxDb::Grant}\label{wxdbgrant}
785
786\func{bool}{Grant}{\param{int}{ privileges}, \param{char *}{tableName}, \param{char *}{userList = "PUBLIC"}}
787
788Use this member function to GRANT privileges to users for accessing tables in the datasource.
789
790\wxheading{Parameters}
791
d0c6b305 792\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:}
3ca6a5f0
BP
793\begin{verbatim}
794 DB_GRANT_SELECT = 1
795 DB_GRANT_INSERT = 2
796 DB_GRANT_UPDATE = 4
797 DB_GRANT_DELETE = 8
798 DB_GRANT_ALL = DB_GRANT_SELECT | DB_GRANT_INSERT |
799 DB_GRANT_UPDATE | DB_GRANT_DELETE
800\end{verbatim}
801\docparam{tableName}{The name of the table you wish to grant privileges on.}
d0c6b305 802\docparam{userList}{A comma delimited list of users to grant the privileges to. If this argument is not passed in, the privileges will be given to the general PUBLIC.}
3ca6a5f0
BP
803
804\wxheading{Remarks}
805
806Some databases require user names to be specified in all capital letters (i.e. Oracle). This function does not automatically capitalize the user names passed in the comma-separated list. This is the responsibility of the calling routine.
807
808\wxheading{Example}
d0c6b305 809
3ca6a5f0
BP
810\begin{verbatim}
811 db.Grant(DB_GRANT_SELECT | DB_GRANT_INSERT, "PARTS", "mary, sue");
812\end{verbatim}
813
814
d0c6b305
GT
815\membersection{wxDb::IsFwdOnlyCursors}\label{wxdbisfwdonlycursors}
816
817\func{bool}{IsFwdOnlyCursors}{\void}
818
819Indicates whether this connection to the datasource only allows forward scrolling cursors or not. This state is set at connection creation time.
820
821\wxheading{Remarks}
822
823Added as of wxWindows v2.4 release, this function is a renamed version of wxDb::FwdOnlyCursors() to match the normal wxWindows naming conventions for class member functions.
824
825This function is not available in versions prior to v2.4. You should use \helpref{wxDb::FwdOnlyCursors}{wxdbfwdonlycursors} for wxWindows versions priori to 2.4.
826
827\wxheading{See also}
828
829\helpref{wxDb::wxDb}{wxdbconstr}, \helpref{wxDbGetConnection}{wxdbfunctions}
830
3ca6a5f0
BP
831\membersection{wxDb::IsOpen}\label{wxdbisopen}
832
833\func{bool}{IsOpen}{\void}
834
835Indicates whether the database connection to the datasource is currently opened.
836
3ca6a5f0
BP
837\membersection{wxDb::Open}\label{wxdbopen}
838
839\func{bool}{Open}{\param{char *}{Dsn}, \param{char *}{Uid}, \param{char *}{AuthStr}}
840
841\wxheading{Parameters}
842
843\docparam{Dsn}{Data source name. The name of the ODBC data source as
844assigned when the data source is initially set up through the ODBC data
845source manager.}
846\docparam{Uid}{User ID. The name (ID) of the user you wish to connect as
847to the data source. The user name (ID) determines what objects you
848have access to in the datasource and what datasource privileges you have.
849Privileges include being able to create new objects, update objects, delete
850objects and so on. Users and privileges are normally administered by the
851database administrator.}
852\docparam{AuthStr}{The password associated witht the Uid.}
853
854\wxheading{Remarks}
855
856After a wxDb instance is created, it must then be opened. When opening a data source, there must be hree pieces of information passed. The data source name, user name (ID) and the password for the user. No database activity on the data source can be performed until it is opened. This would normally be done at program startup and the data source would remain open for the duration of the program run. Note: It is possible to have multiple data sources open at the same time to support distributed database connections.
857
858\wxheading{Example}
d0c6b305 859
3ca6a5f0
BP
860\begin{verbatim}
861 wxDb sampleDB(Db.Henv);
862 if (!sampleDB.Open("Oracle 7.1 HP/UX", "gtasker", "myPassword"))
863 {
864 // Error opening data source
865 }
866\end{verbatim}
867
868
869\membersection{wxDb::RollbackTrans}\label{wxdbrollbacktrans}
870
871\func{bool}{RollbackTrans}{\void}
872
873Function to "rollback" changes made to the database. After an insert/update/delete, the operation may be "undone" by issuing this command any time before a \helpref{wxDb::CommitTrans}{wxdbcommittrans} is called on the database connection.
874
875\wxheading{Remarks}
876
877Transactions begin implicitly as soon as you make a change to the database. At any time thereafter, you can save your work to the database (using \helpref{wxDb::CommitTrans}{wxdbcommittrans}) or undo all of your changes using this function.
878
879\normalbox{Calling this member function rolls back ALL open (uncommitted) transactions on this ODBC connection.}
880
881\wxheading{See also}
882
883\helpref{wxDb::CommitTrans}{wxdbcommittrans} for a special note on cursors
884
3ca6a5f0
BP
885\membersection{wxDb::SetSqlLogging}\label{wxdbsetsqllogging}
886
887\func{bool}{SetSqlLogging}{\param{wxDbSqlLogState}{ state}, \param{const wxChar *}{filename = SQL_LOG_FILENAME}, \param{bool}{ append = FALSE}}
888
889\wxheading{Parameters}
890
d0c6b305 891\docparam{state}{Either sqlLogOFF or sqlLogON (see \helpref{enum wxDbSqlLogState}{wxdbcolfor}). Turns logging of SQL commands sent to the data source OFF or ON.}
3ca6a5f0
BP
892\docparam{filename}{{\it OPTIONAL}. Name of the file to which the log text is to be written.}
893\docparam{append}{{\it OPTIONAL}. Whether the file is appended to or overwritten.}
894
895\wxheading{Remarks}
896
897When called with {\it sqlLogON}, all commands sent to the data source engine are logged to the file specified by {\it filename}. Logging is done by embedded WriteSqlLog() calls in the database member functions, or may be manually logged by adding calls to WriteSqlLog() in your own source code.
898
899When called with {\it sqlLogOFF}, the logging file is closed, and any calls to WriteSqlLog() are ignored.
900
3ca6a5f0
BP
901\membersection{wxDb::TableExists}\label{wxdbtablexists}
902
903\func{bool}{TableExists}{\param{const char *}{tableName}, \param{const char *}{userID=NULL}, \param{const char *}{path=NULL}}
904
905Checks the ODBC data source for the existence of a table. If a {\it userID} is specified, then the table must be accessible by that user (user must have at least minimal privileges to the table).
906
907\wxheading{Parameters}
908
909\docparam{tableName}{Name of the table to check for the existence of}
910\docparam{userID}{Owner of the table. Specify a userID when the datasource you are connected
911to allows multiple unique tables with the same name to be owned by different users. {\it userID}
912is evaluated as follows:}
913
914\begin{verbatim}
915 userID == NULL ... UserID is ignored (DEFAULT)
916 userID == "" ... UserID set equal to 'this->uid'
917 userID != "" ... UserID set equal to 'userID'
918\end{verbatim}
919
920\wxheading{Remarks}
921
922{\it tableName} may refer to a table, view, alias or synonym.
923
d0c6b305 924This function does not indicate whether or not the user has privileges to query or perform other functions on the table.
3ca6a5f0
BP
925
926\membersection{wxDb::TranslateSqlState}\label{wxdbtranslatesqlstate}
927
928\func{int}{TranslateSqlState}{\param{const wxChar *}{SQLState}}
929
930\wxheading{Parameters}
931
932\docparam{SQLState}{Converts an ODBC sqlstate to an internal error code.}
933
934\wxheading{Return value}
935
d0c6b305 936Returns the internal class DB_ERR code. See \helpref{wxDb::DB_STATUS}{wxdb} definition.
3ca6a5f0
BP
937
938\membersection{wxDb::WriteSqlLog}\label{wxdbwritesqllog}
939
940\func{bool}{WriteSqlLog}{\param{const wxChar *}{logMsg}}
941
942\wxheading{Parameters}
943
944\docparam{logMsg}{Free form string to be written to the log file.}
945
946\wxheading{Remarks}
947
948Very useful debugging tool that may be turned on/off during run time. The
949passed in string {\it logMsg} will be written to a log file if SQL logging
950is turned on (see \helpref{wxDb::SetSqlLogging}{wxdbsetsqllogging} for details on turning logging on/off).
951
952\wxheading{Return value}
953
954If SQL logging is off when a call to WriteSqlLog() is made, or there is a
955failure to write the log message to the log file, the function returns
956FALSE without performing the requested log, otherwise TRUE is returned.
957
958\wxheading{See also}
959
960\helpref{wxDb::SetSqlLogging}{wxdbsetsqllogging}
961
d0c6b305 962\begin{comment} % George: this is a duplicate of one above (only with more text)
3ca6a5f0
BP
963\membersection{wxDb::IsFwdOnlyCursors}\label{wxdbisfwdonlycursors}
964
965\func{bool}{IsFwdOnlyCursors}{\void}
966
967\wxheading{Remarks}
968
969This setting indicates whether this database connection was created
970as being capable of using only forward scrolling cursors. This function
971does NOT indicate if the ODBC driver or datasource supports backward
972scrolling cursors. There is no standard way of detecting if the driver
973or datasource can support backward scrolling cursors.
974
975If a wxDb instance was created as being forward only cursors, then even if
976the datasource and ODBC driver support backward scrolling cursors, then
977tables using this database connection can only use forward scrolling
978cursors.
979
980The default setting of whether a wxDb connection to a database allows
981forward-only or also backward scrolling cursors is defined in setup.h by
982the wxODBC_FWD_ONLY_CURSORS value. This default setting can be overridden
983when the wxDb connection is initially created (see \helpref{wxDb constructor}{wxdbconstr}).
984
985\wxheading{Return value}
986
987Returns TRUE if this datasource connection is defined as using only forward
988scrolling cursors, or FALSE if the connection is defined as being capable
989of supporting backward scrolling cursors (see note above).
990
991\wxheading{See also}
992
993\helpref{wxDb constructor}{wxdbconstr}
d0c6b305 994\end{comment}
3ca6a5f0 995
3ca6a5f0
BP
996\membersection{wxDb::Dbms}\label{wxdbdbms}
997
998\func{wxDBMS }{Dbms}{\void}
999
1000\wxheading{Remarks}
1001
1002The return value will be of the enumerated type wxDBMS. This enumerated
1003type contains a list of all the currently tested and supported databases.
1004
1005Additional databases may be work with these classes, but these databases
1006returned by this function have been tested and confirmed to work with
1007these ODBC classes.
1008
1009enum wxDBMS includes:
1010\begin{verbatim}
1011 dbmsUNIDENTIFIED
1012 dbmsORACLE
1013 dbmsSYBASE_ASA
1014 dbmsSYBASE_ASE
1015 dbmsMY_SQL_SERVER
1016 dbmsMY_SQL
1017 dbmsPOSTGRES
1018 dbmsACCESS
1019 dbmsDBASE
1020 dbmsINFORMIX
1021\end{verbatim}
1022
1023There are known issues with conformance to the ODBC standards with several
1024datasources listed above. Please see the overview for specific details on
d0c6b305 1025which datasource have which issues.
3ca6a5f0
BP
1026
1027\wxheading{Return value}
1028
1029The return value will indicate which of the supported datasources is
1030currently connected to by this connection. In the event that the
1031datasource is not recognized, a value of 'dbmsUNIDENTIFIED' is returned.
1032
3ca6a5f0
BP
1033\membersection{wxDb::SetDebugErrorMessages}\label{wxdbsetdebugerrormessages}
1034
d0c6b305 1035\func{void}{SetDebugErrorMessages}{\param{bool }{state}}
3ca6a5f0
BP
1036
1037\docparam{state}{Either TRUE (debug messages are displayed) or FALSE (debug
1038messages are not displayed.}
1039
1040\wxheading{Remarks}
1041
1042Turns on/off debug error messages from the ODBC class library. When
1043this function is passed TRUE, errors are reported to the user automatically
1044in a text or pop-up dialog when an ODBC error occurs. When passed FALSE,
1045errors are silently handled.
1046
1047When compiled in release mode (FINAL=1), this setting has no affect.
1048
1049\wxheading{See also}
1050
1051\helpref{wxDb constructor}{wxdbconstr}
1052
3ca6a5f0
BP
1053\membersection{wxDb::LogError}\label{wxdblogerror}
1054
1055\func{void}{LogError}{\param{const char *}{errMsg} \param{const char *}{SQLState=0}}
1056
1057\docparam{errMsg}{Free-form text to display describing the error to be logged.}
1058\docparam{SQLState}{Native SQL state error}
1059
1060\wxheading{Remarks}
d0c6b305 1061
3ca6a5f0
BP
1062Calling this function will enter a log message in the error list maintained
1063for the database connection. This log message is free form and can be
1064anything the programmer wants to enter in the error list.
1065
1066If SQL logging is turned on, the call to this function will also log the
1067text into the SQL log file.
1068
1069\wxheading{See also}
1070
1071\helpref{wxDb::WriteSqlLog}{wxdbwritesqllog}
1072
d0c6b305
GT
1073\section{\class{wxDbColInf}}\label{wxdbcolinf}
1074
1075Used with the \helpref{wxDb::GetColumns}{wxdbgetcolumns} functions for obtaining all retrievable information about a columns definition.
1076
1077\section{\class{wxDbColFor}}\label{wxdbcolfor}
1078
1079Beginning support for handling international formatting specifically on dates and floats.
1080
1081Only one function is provided with this class currently:
1082
1083\membersection{wxDbColFor::Format}\label{wxdbcolforformat}
1084
1085\func{int}{Format}{\param{int }{Nation}, \param{int }{dbDataType}, \param{SWORD }{sqlDataType}, \param{short }{columnSize}, \param{short }{decimalDigits}}\label{wxdbcolforformat}
1086
1087Work in progress, and should be inter-related with wxLocale
1088
1089\section{\class{wxDbInf}}\label{wxdbinf}
1090
1091Contains information regarding the database connection (data source name,
1092number of tables, etc). A pointer to a wxDbTableInf is included in this
1093class so a program can create a wxDbTableInf array instance to maintain all
1094information about all tables in the datasource to have all the datasource's
1095information in one memory structure.
1096
1097\section{\class{wxDbTable}}\label{wxdbtable}
1098
1099A wxDbTable instance provides re-usable access to rows of data in
1100a table contained within the associated ODBC data source
1101
1102\wxheading{Include files}
1103
1104<wx/dbtable.h>\\
1105<wx/db.h>
1106
1107\latexignore{\rtfignore{\wxheading{Members}}}
1108\wxheading{Helper classes and data structures}
1109
1110The following classes and structs are defined in dbtable.cpp/.h for use with the wxDbTable class.
1111\begin{verbatim}
1112
1113 class wxDbColDef : Bound column definitions for use by a wxDbTable
1114 instance
1115
1116 class wxDbColDataPtr : Pointer to dynamic column definitions for use with
1117 a wxDbTable instance
1118
1119 class wxDbIdxDef : Used in creation of non-primary indexes
1120
1121\end{verbatim}
1122
1123\wxheading{Constants}
1124\begin{verbatim}
1125 wxDB_DEFAULT_CURSOR Index number of the cursor that each table will use
1126 by default.
3ca6a5f0 1127
d0c6b305
GT
1128 wxDB_QUERY_ONLY Used to indicate whether a table that is opened is
1129 for query only, or if insert/update/deletes will
1130 be performed on the table. Less overhead (cursors
1131 and memory) are allocated for query only tables, plus
1132 read access times are faster with some datasources.
3ca6a5f0 1133
d0c6b305
GT
1134 wxDB_ROWID_LEN [Oracle specific] - Used when CanUpdateByRowID() is
1135 true. Optimizes updates so they are faster by
1136 updating on the Oracle-specific ROWID column rather
1137 than some other index.
3ca6a5f0 1138
3ca6a5f0 1139
d0c6b305
GT
1140 wxDB_DISABLE_VIEW Use to indicate when a database view should not be
1141 if a table is normally set up to use a view.
1142 [Currently unsupported.]
1143
1144\end{verbatim}
3ca6a5f0
BP
1145
1146\wxheading{Remarks}
1147
d0c6b305 1148\wxheading{See also}
3ca6a5f0 1149
d0c6b305
GT
1150\helpref{wxDbTable}{wxdbtable}
1151
1152\latexignore{\rtfignore{\wxheading{Members}}}
1153
1154\membersection{wxDbTable::wxDbTable}\label{wxdbtableconstr}
1155
1156\func{}{wxDbTable}{\param{wxDb *}{pwxDb}, \param{const char *}{tblName}, \param{const int }{nCols},\param{const char *}{qryTblName = 0}, \param{bool}{qryOnly = !wxDB_QUERY_ONLY},\param{const char *}{tblPath=NULL}}
1157
1158Default constructor.
1159
1160\wxheading{Parameters}
1161
1162\docparam{pSqlStmt}{}
1163\docparam{typeOfDel}{}
1164\docparam{pWhereClause}{Default is 0.}
1165
1166
1167\membersection{wxDbTable::wxDbTable}\label{wxdbtabledestr}
1168
1169\func{virtual}{\destruct{wxDbTable}}{}
1170
1171Virtual default destructor.
1172
1173
1174\membersection{wxDbTable::BuildDeleteStmt}\label{wxdbtablebuilddeletestmt}
1175
1176\func{void}{BuildSelectStmt}{\param{char *}{pSqlStmt}, \param{int }{typeOfDel}, \param{const char *}{pWhereClause=0}}
1177
1178\wxheading{Parameters}
1179
1180\docparam{pSqlStmt}{}
1181\docparam{typeOfDel}{}
1182\docparam{pWhereClause}{Default is 0.}
1183
1184
1185\membersection{wxDbTable::BuildSelectStmt}\label{wxdbtablebuildselectstmt}
1186
1187\func{void}{BuildSelectStmt}{\param{char *}{pSqlStmt}, \param{int }{typeOfSelect}, \param{bool }{distinct}}
1188
1189\wxheading{Parameters}
1190
1191\docparam{pSqlStmt}{}
1192\docparam{typeOfSelect}{}
1193\docparam{distinct}{}
1194
1195
1196\membersection{wxDbTable::BuildUpdateStmt}\label{wxdbtablebuildupdatestmt}
1197
1198\func{void}{BuildSelectStmt}{\param{char *}{pSqlStmt}, \param{int }{typeOfUpd}, \param{const char *}{pWhereClause=0}}
1199
1200\wxheading{Parameters}
1201
1202\docparam{pSqlStmt}{}
1203\docparam{typeOfUpd}{}
1204\docparam{pWhereClause}{Default is 0.}
1205
1206
1207\membersection{wxDbTable::BuildWhereStmt}\label{wxdbtablebuildwherestmt}
1208
1209\func{void}{BuildSelectStmt}{\param{char *}{pWhereClause}, \param{int }{typeOfWhere}, \param{const char *}{qualTableName=0}, \param{const char *}{useLikeComparison=FALSE}}
1210
1211\wxheading{Parameters}
1212
1213\docparam{pWhereClause}{}
1214\docparam{typeOfWhere}{}
1215\docparam{qualTableName}{Default is 0.}
1216\docparam{useLikeComparison}{Default is FALSE.}
1217
1218
1219\membersection{wxDbTable::CanSelectForUpdate}\label{wxdbtablecanselectforupdate}
1220
1221\func{bool}{CanSelectForUpdate}{\void}
1222
1223\wxheading{Remarks}
1224
1225
1226\membersection{wxDbTable::CanUpdateByROWID}\label{wxdbtablecanupdatebyrowid}
1227
1228\func{bool}{CanUpdateByROWID}{\void}
1229
1230\wxheading{Remarks}
1231
1232
1233\membersection{wxDbTable::ClearMemberVars}\label{wxdbtableclearmembervars}
1234
1235\func{void}{ClearMemberVars}{\void}
1236
1237\wxheading{Remarks}
1238
1239
1240\membersection{wxDbTable::CloseCursor}\label{wxdbtableclosecursor}
1241
1242\func{bool}{CloseCursor}{\param{HSTMT}{cursor}}
1243
1244\wxheading{Parameters}
1245
1246\docparam{cursor}{}
1247
1248\wxheading{Remarks}
1249
1250
1251\membersection{wxDbTable::Count}\label{wxdbtablecount}
1252
1253\func{ULONG}{Count}{\param{const char *}{args="*"}}
1254
1255\wxheading{Parameters}
1256
1257\docparam{args}{Default is "*".}
1258
1259\wxheading{Remarks}
1260
1261
1262\membersection{wxDbTable::CreateIndex}\label{wxdbtablecreateindex}
1263
1264\func{bool}{CreateIndex}{\param{const char *}{idxName}, \param{bool}{unique}, \param{int }{noIdxCols}, \param{wxDbIdxDef *}{pIdxDefs}, \param{bool }{attemptDrop=TRUE}}
1265
1266\wxheading{Parameters}
1267
1268\docparam{idxName}{}
1269\docparam{unique}{}
1270\docparam{noIdxCols}{}
1271\docparam{pIdxDefs}{}
1272\docparam{attemptDrop}{Default is TRUE.}
1273
1274\wxheading{Remarks}
1275
1276\membersection{wxDbTable::CreateTable}\label{wxdbtablecreatetable}
1277
1278\func{bool}{CreateTable}{\param{bool }{attemptDrop=TRUE}}
1279
1280\wxheading{Parameters}
1281
1282\docparam{attemptDrop}{Default is TRUE.}
1283
1284\wxheading{Remarks}
1285
1286\membersection{wxDbTable::DB_STATUS}\label{wxdbtabledbstatus}
1287
1288\func{bool}{DB_STATUS}{\void}
1289
1290Accessor function for the private member variable DB_STATUS.
1291
1292\membersection{wxDbTable::IsColNull}\label{wxdbtableiscolnull}
1293
1294\func{bool}{IsColNull}{\param{int }{colNo}}
1295
1296\wxheading{Parameters}
1297
1298\docparam{colNo}{}
1299
1300\wxheading{Remarks}
1301
1302\membersection{wxDbTable::Delete}\label{wxdbtabledelete}
1303
1304\func{bool}{Delete}{\void}
1305
1306\wxheading{Remarks}
1307
1308\membersection{wxDbTable::DeleteCursor}\label{wxdbtabledeletecursor}
1309
1310\func{bool}{DeleteCursor}{\param{HSTMT }{hstmtDel}}
1311
1312\wxheading{Parameters}
1313
1314\docparam{hstmtDel}{}
1315
1316\wxheading{Remarks}
1317
1318\membersection{wxDbTable::DeleteWhere}\label{wxdbtabledeletewhere}
1319
1320\func{bool}{DeleteWhere}{\param{const char *}{pWhereClause}}
1321
1322\wxheading{Parameters}
1323
1324\docparam{pWhereClause}{}
1325
1326\wxheading{Remarks}
1327
1328\membersection{wxDbTable::DeleteMatching}\label{wxdbtabledeletematching}
1329
1330\func{bool}{DeleteMatching}{\void}
1331
1332\wxheading{Remarks}
1333
1334\membersection{wxDbTable::DropIndex}\label{wxdbtabledropindex}
1335
1336\func{bool}{DropIndex}{\param{const char *}{idxName}}
1337
1338\wxheading{Parameters}
1339
1340\docparam{idxName}{}
1341
1342\wxheading{Remarks}
1343
1344\membersection{wxDbTable::DropTable}\label{wxdbtabledroptable}
1345
1346\func{bool}{DropTable}{\void}
1347
1348\wxheading{Remarks}
1349
1350\membersection{wxDbTable::GetColDefs}\label{wxdbtablegetcoldefs}
1351
1352\func{wxDbColDef *}{GetColDefs}{}
1353
1354\wxheading{Remarks}
1355
1356\membersection{wxDbTable::GetCursor}\label{wxdbtablegetcursor}
1357
1358\func{HSTMT}{GetCursor}{\void}
1359
1360\wxheading{Remarks}
1361
1362\membersection{wxDbTable::GetDb}\label{wxdbtablegetdb}
1363
1364\func{wxDb *}{GetDb}{}
1365
1366Accessor function for the private member variable pDb which is a pointer to the datasource connection that this wxDbTable instance uses.
1367
1368\wxheading{Remarks}
1369
1370\membersection{wxDbTable::GetFirst}\label{wxdbtablegetfirst}
1371
1372\func{bool}{GetFirst}{\void}
1373
1374\wxheading{Remarks}
1375
1376This function can only be used if the datasource connection used by the wxDbTable instance was created with FwdOnlyCursors set to FALSE. If the connection does not allow backward scrolling cursors, this function will return FALSE, and the data contained in the bound columns will be undefined.
1377
1378\wxheading{See also}
1379
1380\helpref{wxDb::FwdOnlyCursors}{wxdbfwdonlycursors}
1381
1382\membersection{wxDbTable::GetFromClause}\label{wxdbtablegetfromclause}
1383
1384\func{const char *}{GetFromClause}{}
1385
1386Accessor function that returns the current FROM setting assigned with the \helpref{wxDbTable::SetFromClause}{wxdbtablesetfromclause}.
1387
1388\membersection{wxDbTable::GetLast}\label{wxdbtablegetlast}
1389
1390\func{bool}{GetLast}{\void}
1391
1392\wxheading{Remarks}
1393
1394This function can only be used if the datasource connection used by the wxDbTable instance was created with FwdOnlyCursors set to FALSE. If the connection does not allow backward scrolling cursors, this function will return FALSE, and the data contained in the bound columns will be undefined.
1395
1396\wxheading{See also}
1397
1398\helpref{wxDb::FwdOnlyCursors}{wxdbfwdonlycursors}
1399
1400\membersection{wxDbTable::GetNewCursor}\label{wxdbtablegetnewcursor}
1401
1402\func{HSTMT *}{GetNewCursor}{\param{bool }{setCursor=FALSE}, \param{bool }{bindColumns=TRUE}}
1403
1404\wxheading{Parameters}
1405
1406\docparam{setCursor}{Default is FALSE.}
1407\docparam{bindColumns}{Default is TRUE.}
1408
1409\wxheading{Remarks}
1410
1411\membersection{wxDbTable::GetNext}\label{wxdbtablegetnext}
1412
1413\func{bool}{GetNext}{\void}
1414
1415\wxheading{Remarks}
1416
1417
1418\membersection{wxDbTable::GetNumberOfColumns}\label{wxdbtablegetnumberofcolumns}
1419
1420\func{bool}{GetNumberOfColumns}{}
1421
1422Accessor function that returns the number of columns that are statically bound for access by the wxDbTable instance.
1423
1424\membersection{wxDbTable::GetOrderByClause}\label{wxdbtablegetorderbyclause}
1425
1426\func{const char *}{GetOrderByClause}{}
1427
1428Accessor function that returns the current ORDER BY setting assigned with the \helpref{wxDbTable::SetOrderByClause}{wxdbtablesetorderbyclause}.
1429
1430\membersection{wxDbTable::GetPrev}\label{wxdbtablegetprev}
1431
1432\func{bool}{GetPrev}{\void}
1433
1434\wxheading{Remarks}
1435
1436This function can only be used if the datasource connection used by the wxDbTable instance was created with FwdOnlyCursors set to FALSE. If the connection does not allow backward scrolling cursors, this function will return FALSE, and the data contained in the bound columns will be undefined.
1437
1438\wxheading{See also}
1439
1440\helpref{wxDb::FwdOnlyCursors}{wxdbfwdonlycursors}
1441
1442
1443\membersection{wxDbTable::GetQueryTableName}\label{wxdbtablegetquerytablename}
1444
1445\func{const char *}{GetQueryTableName}{}
1446
1447\wxheading{Remarks}
1448
1449\membersection{wxDbTable::GetRowNum}\label{wxdbtablegetrownum}
1450
1451\func{UWORD}{GetRowNum}{\void}
1452
1453\wxheading{Remarks}
1454
1455\membersection{wxDbTable::GetTableName}\label{wxdbtablegettablename}
1456
1457\func{const char *}{GetTableName}{}
1458
1459\wxheading{Remarks}
1460
1461\membersection{wxDbTable::GetTablePath}\label{wxdbtablegettablepath}
1462
1463\func{const char *}{GetTablePath}{}
1464
1465\wxheading{Remarks}
1466
1467\membersection{wxDbTable::GetWhereClause}\label{wxdbtablegetwhereclause}
1468
1469\func{const char *}{GetWhereClause}{}
1470
1471Accessor function that returns the current WHERE setting assigned with the \helpref{wxDbTable::SetWhereClause}{wxdbtablesetwhereclause}
1472
1473\membersection{wxDbTable::Insert}\label{wxdbtableinsert}
1474
1475\func{int}{Insert}{\void}
1476
1477\wxheading{Remarks}
1478
1479\membersection{wxDbTable::IsCursorClosedOnCommit}\label{wxdbtableiscursorclosedoncommit}
1480
1481\func{bool}{IsCursorClosedOnCommit}{\void}
1482
1483\wxheading{Remarks}
1484
1485\membersection{wxDbTable::IsQueryOnly}\label{wxdbtableisqueryonly}
1486
1487\func{bool}{IsQueryOnly}{}
1488
1489Accessor function that returns a value indicating if this wxDbTable instance was created to allow only queries to be performed on the bound columns. If this function returns TRUE, then no actions may be performed using this wxDbTable instance that would modify (insert/delete/update) the table's data.
1490
1491\membersection{wxDbTable::Open}\label{wxdbtableopen}
1492
1493\func{bool}{Open}{\void}
1494
1495\wxheading{Remarks}
1496
1497\membersection{wxDbTable::Query}\label{wxdbtablequery}
1498
1499\func{virtual bool}{Query}{\param{bool}{forUpdate=FALSE}, \param{bool}{distinct=FALSE}}
1500
1501\wxheading{Parameters}
1502
1503\docparam{forUpdate}{Default is FALSE.}
1504\docparam{distinct}{Default is FALSE.}
1505
1506\wxheading{Remarks}
1507
1508\membersection{wxDbTable::QueryBySqlStmt}\label{wxdbtablequerybysqlstmt}
1509
1510\func{bool}{QueryBySqlStmt}{\param{const char *}{pSqlStmt}}
1511
1512\wxheading{Parameters}
1513
1514\docparam{pSqlStmt}{}
1515
1516\wxheading{Remarks}
1517
1518\membersection{wxDbTable::QueryMatching}\label{wxdbtablequerymatching}
1519
1520\func{virtual bool}{QueryMatching}{\param{bool}{forUpdate=FALSE}, \param{bool}{distinct=FALSE}}
1521
1522\wxheading{Parameters}
1523
1524\docparam{forUpdate}{Default is FALSE.}
1525\docparam{distinct}{Default is FALSE.}
1526
1527\wxheading{Remarks}
1528
1529\membersection{wxDbTable::QueryOnKeyFields}\label{wxdbtablequeryonkeyfields}
1530
1531\func{bool}{QueryOnKeyFields}{\param{bool}{forUpdate=FALSE}, \param{bool}{distinct=FALSE}}
1532
1533\wxheading{Parameters}
1534
1535\docparam{forUpdate}{Default is FALSE.}
1536\docparam{distinct}{Default is FALSE.}
1537
1538\wxheading{Remarks}
1539
1540\membersection{wxDbTable::Refresh}\label{wxdbtablerefresh}
1541
1542\func{bool}{Refresh}{\void}
1543
1544\wxheading{Remarks}
1545
1546\membersection{wxDbTable::SetColDefs}\label{wxdbtablesetcoldefs}
1547
1548\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}}
1549
1550\func{wxDbColDataPtr *}{SetColDefs}{\param{wxDbColInf *}{colInfs}, \param{ULONG }{numCols}}
1551
1552\wxheading{Parameters}
1553
1554\docparam{index}{}
1555\docparam{fieldName}{}
1556\docparam{dataType}{}
1557\docparam{pData}{}
1558\docparam{cType}{}
1559\docparam{size}{}
1560\docparam{keyField}{Default is FALSE.}
1561\docparam{upd}{Default is TRUE.}
1562\docparam{insAllow}{Default is TRUE.}
1563\docparam{derivedCol}{Default is FALSE.}
1564
1565\docparam{colInfs}{}
1566\docparam{numCols}{}
1567
1568\wxheading{Remarks}
1569
1570\membersection{wxDbTable::SetCursor}\label{wxdbtablesetcursor}
1571
1572\func{bool}{Open}{\param{HSTMT *}{hstmtActivate = (void **) wxDB_DEFAULT_CURSOR}}
1573
1574\wxheading{Parameters}
1575
1576\docparam{hstmtActivate}{Default is wxDB_DEFAULT_CURSOR.}
1577
1578\wxheading{Remarks}
1579
1580\membersection{wxDbTable::SetFromClause}\label{wxdbtablesetfromclause}
1581
1582\func{void}{SetFromClause}{\param{const wxString& }{From}}
1583
1584\wxheading{Parameters}
1585
1586\docparam{From}{}
1587
1588\membersection{wxDbTable::SetNull}\label{wxdbtablesetnull}
1589
1590\func{bool}{SetNull}{\param{int }{colNo}}
1591
1592\func{bool}{SetNull}{\param{const char *}{colName}}
1593
1594\wxheading{Parameters}
1595
1596\docparam{colNo}{}
1597\docparam{colName}{}
1598
1599\wxheading{Remarks}
1600
1601\membersection{wxDbTable::SetOrderByClause}\label{wxdbtablesetorderbyclause}
1602
1603\func{void}{SetOrderByClause}{\param{const wxString& }{OrderBy}}
1604
1605\wxheading{Parameters}
1606
1607\docparam{OrderBy}{}
1608
1609\membersection{wxDbTable::SetQueryTimeout}\label{wxdbtablesetquerytimeout}
1610
1611\func{bool}{SetQueryTimeout}{\param{UDWORD }{nSeconds}}
1612
1613\wxheading{Parameters}
1614
1615\docparam{nSeconds}{}
1616
1617\wxheading{Remarks}
1618
1619\membersection{wxDbTable::SetWhereClause}\label{wxdbtablesetwhereclause}
1620
1621\func{void}{SetWhereClause}{\param{const wxString& }{Where}}
1622
1623\wxheading{Parameters}
1624
1625\docparam{Where}{}
1626
1627\membersection{wxDbTable::Update}\label{wxdbtableupdate}
1628
1629\func{bool}{Update}{\void}
1630
1631\func{bool}{Update}{\param{const char *}{pSqlStmt}}
1632
1633\wxheading{Parameters}
1634
1635\docparam{pSqlStmt}{}
1636
1637\wxheading{Remarks}
1638
1639\membersection{wxDbTable::UpdateWhere}\label{wxdbtableupdatewhere}
1640
1641\func{bool}{UpdateWhere}{\param{const char *}{pWhereClause}}
1642
1643\wxheading{Parameters}
1644
1645\docparam{pWhereClause}{}
1646
1647\wxheading{Remarks}
1648
1649\membersection{wxDbTable::operator $++$}\label{wxdbtableplusplus}
1650
1651\func{bool}{operator $++$}{\void}
1652
1653Same as \helpref{wxDbTable::GetNext}{wxdbtablegetnext}
1654
1655\wxheading{See also}
1656
1657\helpref{wxDbTable::GetNext}{wxdbtablegetnext}
1658
1659\membersection{wxDbTable::operator $--$}\label{wxdbtableminusminus}
1660
1661\func{bool}{operator $--$}{\void}
1662
1663Same as \helpref{wxDbTable::GetPrev}{wxdbtablegetprev}
1664
1665\wxheading{See also}
1666
1667\helpref{wxDbTable::GetPrev}{wxdbtablegetprev}
1668
1669\section{\class{wxDbTableInf}}\label{wxdbtableinf}
1670
1671Currently only used by wxDb::GetCatalog() internally and wxDbInf class,
1672but may be used in future releases for user functions. Contains information
1673describing the table (Name, type, etc). A pointer to a wxDbColInf array
1674instance is included so a program can create a wxDbColInf array instance
1675(using \helpref{wxDb::GetColumns}{wxdbgetcolumns}) to maintain all information about the columns
1676of a table in one memory structure.
3ca6a5f0 1677