<wx/db.h>
+\wxheading{Library}
+
+\helpref{wxOdbc}{librarieslist}
+
\wxheading{Helper classes and data structures}
The following classes and structs are defined in db.cpp/.h for use with the wxDb class.
available through the ODBC driver manager on the current workstation.
\begin{verbatim}
- wxStringList strList;
+ wxArrayString strArray;
while (wxDbGetDataSource(DbConnectInf.GetHenv(), Dsn, SQL_MAX_DSN_LENGTH+1, DsDesc, 255))
- strList.Add(Dsn);
+ strArray.Add(Dsn);
\end{verbatim}
\latexignore{\rtfignore{\wxheading{Members}}}
If the view does not exist, this function will return true. Note that views are not supported with all datasources.
+\membersection{wxDb::EscapeSqlChars}\label{wxdbescapesqlchars}
+
+\func{wxString}{EscapeSqlChars}{\param{const wxString\& }{value}}
+
+This function is used internally by wxWidgets while building SQL statements.
+It has been provided to help users who wish to explicity construct SQL
+statements to be sent to the server. The function takes the value passed and
+returns it with any special characters escaped. Which characters are
+considered special depends on what type of datasource the object is connected
+to. For example, most database servers use a backslash as the escape
+character; if the value passed contains a backlash it will be replaced with a
+double backslash before it is passed to the server. This function can be used
+to avoid passing statements with syntax errors to the server as well as prevent
+SQL injection attacks.
+
+\wxheading{Parameters}
+
+\docparam{value}{The value to be escaped.}
+
\membersection{wxDb::ExecSql}\label{wxdbexecsql}
\func{bool}{ExecSql}{\param{const wxString \&}{pSqlStmt}}
+\func{bool}{ExecSql}{\param{const wxString \&}{pSqlStmt}, \param{wxDbColInf **}{columns}, \param{short \&}{numcols}}
+
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.
+To get column amount and column names or other information about returned columns, pass {\it 'columns'} and {\it 'numcols'} parameters to the function also.
+
\wxheading{Parameters}
\docparam{pSqlStmt}{Pointer to the SQL statement to be executed.}
+\docparam{columns}{On success, this function will set this pointer to point to array of \helpref{wxDbColInf}{wxdbcolinf} objects, holding information about columns returned by the query. You need to call delete[] for the pointer you pass here after you don't use it anymore to prevent memory leak.}
+
+\docparam{numcols}{Reference to variable where amount of objects in {\it 'columns'}-parameter will be set.}
+
\wxheading{Remarks}
This member extends the wxDb class and allows you to build and execute ANY VALID
\membersection{wxDb::SQLColumnName}\label{wxdbsqlcolumnname}
-\func{const wxString}{SQLColumnName}{\param{const char *}{ colName}}
+\func{const wxString}{SQLColumnName}{\param{const wxChar *}{ 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
\membersection{wxDb::SQLTableName}\label{wxdbsqltablename}
-\func{const wxString}{SQLTableName}{\param{const char *}{ tableName}}
+\func{const wxString}{SQLTableName}{\param{const wxChar *}{ 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
\helpref{database classes overview}{odbcoverview},
\helpref{wxDbTable::GetColDefs}{wxdbtablegetcoldefs}, \helpref{wxDb constructor}{wxdbctor}
+\wxheading{Include files}
+
+<wx/db.h>
+
+\latexignore{\rtfignore{\wxheading{Members}}}
+
\membersection{wxDbColDef::Initialize}\label{wxdbcoldefinitialize}
Simply initializes all member variables to a cleared state. Called by
and floats.
\begin{verbatim}
- wxString s_Field; // Formated String for Output
- wxString s_Format[7]; // Formated Objects - TIMESTAMP has
+ wxString s_Field; // Formatted String for Output
+ wxString s_Format[7]; // Formatted Objects - TIMESTAMP has
the biggest (7)
- wxString s_Amount[7]; // Formated Objects - amount of
+ wxString s_Amount[7]; // Formatted Objects - amount of
things that can be formatted
- int i_Amount[7]; // Formated Objects -
+ int i_Amount[7]; // Formatted Objects -
TT MM YYYY HH MM SS m
int i_Nation; // 0 = timestamp
1 = EU
See the \helpref{database classes overview}{odbcoverview} for
an introduction to using the ODBC classes.
+\wxheading{Include files}
+
+<wx/db.h>
+
+\wxheading{Library}
+
+\helpref{wxOdbc}{librarieslist}
+
+\latexignore{\rtfignore{\wxheading{Members}}}
+
\membersection{wxDbColFor::Format}\label{wxdbcolforformat}
\func{int }{Format}{\param{int }{Nation}, \param{int }{dbDataType},
See the \helpref{database classes overview}{odbcoverview} for
an introduction to using the ODBC classes.
+\wxheading{Include files}
+
+<wx/db.h>
+
+\wxheading{Library}
+
+\helpref{wxOdbc}{librarieslist}
+
+\latexignore{\rtfignore{\wxheading{Members}}}
+
\membersection{wxDbColInf::Initialize}\label{wxdbcolinfinitialize}
Simply initializes all member variables to a cleared state. Called by
Accessor function to assign the user ID for this class instance.
-\section{\class{wxDbIndexDef}}\label{wxdbIndexdef}
+\section{\class{wxDbIdxDef}}\label{wxdbidxdef}
Used in creation of non-primary indexes. Currently there are no member
functions for this class.
See the \helpref{database classes overview}{odbcoverview} for
an introduction to using the ODBC classes.
+
+\wxheading{Include files}
+
+<wx/db.h>
+
+\wxheading{Library}
+
+\helpref{wxOdbc}{librarieslist}
+
\section{\class{wxDbInf}}\label{wxdbinf}
Contains information regarding the database connection (datasource name,
See the \helpref{database classes overview}{odbcoverview} for
an introduction to using the ODBC classes.
+\wxheading{Include files}
+
+<wx/db.h>
+
+\wxheading{Library}
+
+\helpref{wxOdbc}{librarieslist}
+
+\latexignore{\rtfignore{\wxheading{Members}}}
+
\membersection{wxDbInf::Initialize}\label{wxdbinfinitialize}
Simply initializes all member variables to a cleared state. Called by
<wx/dbtable.h>\\
<wx/db.h>
+\wxheading{Library}
+
+\helpref{wxOdbc}{librarieslist}
+
\latexignore{\rtfignore{\wxheading{Members}}}
\wxheading{Helper classes and data structures}
\begin{itemize}\itemsep=0pt
\item \helpref{wxDbColDef}{wxdbcoldef}
\item \helpref{wxDbColDataPtr}{wxdbcoldataptr}
-\item \helpref{wxDbIndexDef}{wxdbIndexdef}
+\item \helpref{wxDbIdxDef}{wxdbidxdef}
\end{itemize}
\wxheading{Constants}
and \helpref{wxDbTable::SetFromClause}{wxdbtablesetfromclause} are ignored by
this function.
-\membersection{wxDbTable::BuildWhereStmt}\label{wxdbtablebuildwherestmt}
-\func{void}{BuildSelectStmt}{\param{wxString \&}{pWhereClause},
+\membersection{wxDbTable::BuildWhereClause}\label{wxdbtablebuildwhereclause}
+
+\func{void}{BuildWhereClause}{\param{wxString \&}{pWhereClause},
\param{int }{typeOfWhere}, \param{const wxString \&}{qualTableName=""},
\param{bool }{useLikeComparison=false}}
containing a NULL value are not included in the WHERE clause's list of
columns to use in the comparison.
+
\membersection{wxDbTable::CanSelectForUpdate}\label{wxdbtablecanselectforupdate}
\func{bool}{CanSelectForUpdate}{\void}
\membersection{wxDbTable::CreateIndex}\label{wxdbtablecreateindex}
\func{bool}{CreateIndex}{\param{const wxString \&}{IndexName}, \param{bool }{unique},
-\param{UWORD }{numIndexColumns}, \param{wxDbIndexDef *}{pIndexDefs},
+\param{UWORD }{numIndexColumns}, \param{wxDbIdxDef *}{pIndexDefs},
\param{bool }{attemptDrop=true}}
-This member function allows you to create secondary (non primary) indexes on
+This member function allows you to create secondary (non-primary) indexes on
your tables. You first create your table, normally specifying a primary
index, and then create any secondary indexes on the table. Indexes in
relational model are not required. You do not need indexes to look up records
space of the datasource.}
\docparam{unique}{Indicates if this index is unique.}
\docparam{numIndexColumns}{Number of columns in the index.}
-\docparam{pIndexDefs}{A pointer to an array wxDbIndexDef structures. }
+\docparam{pIndexDefs}{A pointer to an array \helpref{wxDbIdxDef}{wxdbidxdef} structures. }
\docparam{attemptDrop}{{\it OPTIONAL}. Indicates if the function should try
to execute a \helpref{wxDbTable::DropIndex}{wxdbtabledropindex} on the index
name provided before trying to create the index name. Default is true.}
number must match the number of columns defined in the 'pIndexDefs' parameter.
The fourth parameter specifies which columns make up the index using the
-wxDbIndexDef structure. For each column in the index, you must specify two
+\helpref{wxDbIdxDef}{wxdbidxdef} structure. For each column in the index, you must specify two
things, the column name and the sort order (ascending / descending). See
-the example below to see how to build and pass in the wxDbIndexDef structure.
+the example below to see how to build and pass in the \helpref{wxDbIdxDef}{wxdbidxdef} structure.
The fifth parameter is provided to handle the differences in datasources as
to whether they will automatically overwrite existing indexes with the same
\begin{verbatim}
// Create a secondary index on the PARTS table
- wxDbIndexDef IndexDef[2]; // 2 columns make up the index
+ wxDbIdxDef IndexDef[2]; // 2 columns make up the index
wxStrcpy(IndexDef[0].ColName, "PART_DESC"); // Column 1
IndexDef[0].Ascending = true;
\wxheading{Parameters}
-\docparam{From}{A comma separated list of table names that are to be outer
+\docparam{From}{A comma separated list of table names that are to be inner
joined with the base table's columns so that the joined table's columns
may be returned in the result set or used as a portion of a comparison with
the base table's columns. NOTE that the base tables name must NOT be included
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
-\helpref{wxDbTable::SetFromClause}{wxdbtablesetfromclause} to allow outer
+\helpref{wxDbTable::SetFromClause}{wxdbtablesetfromclause} to allow inner
joining of the base table (the one being associated with this instance of
wxDbTable) with other tables which share a related field.
DB_DATA_TYPE_INTEGER : non-floating point numbers
DB_DATA_TYPE_FLOAT : floating point numbers
DB_DATA_TYPE_DATE : dates
+ DB_DATA_TYPE_BLOB : binary large objects
+ DB_DATA_TYPE_MEMO : large strings
\end{verbatim}
\docparam{pData}{Pointer to the data object that will hold the column's
\membersection{wxDbTable::SetCursor}\label{wxdbtablesetcursor}
-\func{bool}{SetCursor}{\param{HSTMT *}{hstmtActivate = (void **) wxDB\_DEFAULT\_CURSOR}}
+\func{void}{SetCursor}{\param{HSTMT *}{hstmtActivate = (void **) wxDB\_DEFAULT\_CURSOR}}
\wxheading{Parameters}
\func{void}{SetFromClause}{\param{const wxString \&}{From}}
Accessor function for setting the private class member wxDbTable::from
-that indicates what other tables should be outer joined with the wxDbTable's
+that indicates what other tables should be inner joined with the wxDbTable's
base table for access to the columns in those other tables.
Synonym to this function is one form of \helpref{wxDbTable::From}{wxdbtablefrom}
\wxheading{Parameters}
-\docparam{From}{A comma separated list of table names that are to be outer
+\docparam{From}{A comma separated list of table names that are to be inner
joined with the base table's columns so that the joined table's columns
may be returned in the result set or used as a portion of a comparison with
the base table's columns. NOTE that the base tables name must NOT be included
\wxheading{Remarks}
Used by the \helpref{wxDbTable::Query}{wxdbtablequery} and
-\helpref{wxDbTable::Count}{wxdbtablecount} member functions to allow outer
+\helpref{wxDbTable::Count}{wxdbtablecount} member functions to allow inner
joining of records from multiple tables.
Do {\bf not} include the keyword "FROM" when setting the FROM clause.
\begin{verbatim}
...
// Base table is the "LOCATION" table, and it is being
- // outer joined to the "PART" table via the the field "PART_NUMBER"
+ // inner joined to the "PART" table via the field "PART_NUMBER"
// that can be related between the two tables.
location->SetWhereClause("LOCATION.PART_NUMBER = PART.PART_NUMBER")
location->SetFromClause("PART");
// Using parameters and multiple logical combinations
parts->Where("((QTY > 10) OR (ON_ORDER > 0)) AND ON_HOLD = 0");
...
- // This query uses an outer join (requiring a FROM clause also)
+ // This query uses an inner join (requiring a FROM clause also)
// that joins the PART and LOCATION table on he common field
// PART_NUMBER.
parts->Where("PART.ON_HOLD = 0 AND \
See the \helpref{database classes overview}{odbcoverview} for
an introduction to using the ODBC classes.
+\wxheading{Include files}
+
+<wx/db.h>
+
+\wxheading{Library}
+
+\helpref{wxOdbc}{librarieslist}
+
+\latexignore{\rtfignore{\wxheading{Members}}}
+
\membersection{wxDbTableInf::Initialize}\label{wxdbtableinfinitialize}
Simply initializes all member variables to a cleared state. Called by
<wx/dbgrid.h>
+\wxheading{Library}
+
+\helpref{wxDbgrid}{librarieslist}
+
\latexignore{\rtfignore{\wxheading{Members}}}
\membersection{wxDbGridColInfo::wxDbGridColInfo}\label{wxdbgridcolinfoctor}
<wx/dbgrid.h>
+\wxheading{Library}
+
+\helpref{wxDbgrid}{librarieslist}
+
\wxheading{Example}