More parameter variable names fixed to make them more readable by replacing abbreviations with the full word
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@31180 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1961,7 +1961,7 @@ Accessor function to set the user ID for this class instance.
|
|||||||
|
|
||||||
Accessor function to assign the user ID for this class instance.
|
Accessor function to assign the user ID for this class instance.
|
||||||
|
|
||||||
\section{\class{wxDbIdxDef}}\label{wxdbidxdef}
|
\section{\class{wxDbIndexDef}}\label{wxdbIndexdef}
|
||||||
|
|
||||||
Used in creation of non-primary indexes. Currently there are no member
|
Used in creation of non-primary indexes. Currently there are no member
|
||||||
functions for this class.
|
functions for this class.
|
||||||
@@ -2032,7 +2032,7 @@ with the wxDbTable class.
|
|||||||
\begin{itemize}\itemsep=0pt
|
\begin{itemize}\itemsep=0pt
|
||||||
\item \helpref{wxDbColDef}{wxdbcoldef}
|
\item \helpref{wxDbColDef}{wxdbcoldef}
|
||||||
\item \helpref{wxDbColDataPtr}{wxdbcoldataptr}
|
\item \helpref{wxDbColDataPtr}{wxdbcoldataptr}
|
||||||
\item \helpref{wxDbIdxDef}{wxdbidxdef}
|
\item \helpref{wxDbIndexDef}{wxdbIndexdef}
|
||||||
\end{itemize}
|
\end{itemize}
|
||||||
|
|
||||||
\wxheading{Constants}
|
\wxheading{Constants}
|
||||||
@@ -2168,7 +2168,7 @@ this function.
|
|||||||
Constructs the full SQL statement that can be used to update all rows matching
|
Constructs the full SQL statement that can be used to update all rows matching
|
||||||
the criteria in the pWhereClause.
|
the criteria in the pWhereClause.
|
||||||
|
|
||||||
If typeOfUpd is DB\_UPD\_KEYFIELDS, then the current values in the bound columns
|
If typeOfUpdate 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
|
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
|
exception to this is when a datasource supports ROW IDs (Oracle). The ROW ID
|
||||||
column is used for efficiency purposes when available.
|
column is used for efficiency purposes when available.
|
||||||
@@ -2184,9 +2184,9 @@ by this function.
|
|||||||
\docparam{pSqlStmt}{Pointer to storage for the SQL statement retrieved. To be
|
\docparam{pSqlStmt}{Pointer to storage for the SQL statement retrieved. To be
|
||||||
sure you have adequate space allocated for the SQL statement, allocate
|
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
|
\docparam{typeOfUpdate}{The type of update statement being performed. Can be one
|
||||||
of two values: DB\_UPD\_KEYFIELDS or DB\_UPD\_WHERE.}
|
of two values: DB\_UPD\_KEYFIELDS or DB\_UPD\_WHERE.}
|
||||||
\docparam{pWhereClause}{{\it OPTIONAL}. If the typeOfUpd is DB\_UPD\_WHERE,
|
\docparam{pWhereClause}{{\it OPTIONAL}. If the typeOfUpdate is DB\_UPD\_WHERE,
|
||||||
then you must also pass in a SQL WHERE clause in this argument. Default is "".}
|
then you must also pass in a SQL WHERE clause in this argument. Default is "".}
|
||||||
|
|
||||||
\wxheading{Remarks}
|
\wxheading{Remarks}
|
||||||
@@ -2414,8 +2414,8 @@ this function.
|
|||||||
|
|
||||||
\membersection{wxDbTable::CreateIndex}\label{wxdbtablecreateindex}
|
\membersection{wxDbTable::CreateIndex}\label{wxdbtablecreateindex}
|
||||||
|
|
||||||
\func{bool}{CreateIndex}{\param{const wxString \&}{idxName}, \param{bool }{unique},
|
\func{bool}{CreateIndex}{\param{const wxString \&}{IndexName}, \param{bool }{unique},
|
||||||
\param{UWORD }{noIdxCols}, \param{wxDbIdxDef *}{pIdxDefs},
|
\param{UWORD }{numIndexColumns}, \param{wxDbIndexDef *}{pIndexDefs},
|
||||||
\param{bool }{attemptDrop=true}}
|
\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
|
||||||
@@ -2430,11 +2430,11 @@ take advantage of those indexes.
|
|||||||
|
|
||||||
\wxheading{Parameters}
|
\wxheading{Parameters}
|
||||||
|
|
||||||
\docparam{idxName}{Name of the Index. Name must be unique within the table
|
\docparam{IndexName}{Name of the Index. Name must be unique within the table
|
||||||
space of the datasource.}
|
space of the datasource.}
|
||||||
\docparam{unique}{Indicates if this index is unique.}
|
\docparam{unique}{Indicates if this index is unique.}
|
||||||
\docparam{noIdxCols}{Number of columns in the index.}
|
\docparam{numIndexColumns}{Number of columns in the index.}
|
||||||
\docparam{pIdxDefs}{A pointer to an array wxDbIdxDef structures. }
|
\docparam{pIndexDefs}{A pointer to an array wxDbIndexDef structures. }
|
||||||
\docparam{attemptDrop}{{\it OPTIONAL}. Indicates if the function should try
|
\docparam{attemptDrop}{{\it OPTIONAL}. Indicates if the function should try
|
||||||
to execute a \helpref{wxDbTable::DropIndex}{wxdbtabledropindex} on the index
|
to execute a \helpref{wxDbTable::DropIndex}{wxdbtabledropindex} on the index
|
||||||
name provided before trying to create the index name. Default is true.}
|
name provided before trying to create the index name. Default is true.}
|
||||||
@@ -2444,7 +2444,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
|
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
|
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
|
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\_Index1). This will allow you to easily view all
|
||||||
of the indexes defined for a given table grouped together alphabetically.
|
of the indexes defined for a given table grouped together alphabetically.
|
||||||
|
|
||||||
The second parameter indicates if the index is unique or not. Uniqueness
|
The second parameter indicates if the index is unique or not. Uniqueness
|
||||||
@@ -2453,12 +2453,12 @@ indexes from being inserted into the table when violating a unique index's
|
|||||||
uniqueness.
|
uniqueness.
|
||||||
|
|
||||||
In the third parameter, specify how many columns are in your index. This
|
In the third parameter, specify how many columns are in your index. This
|
||||||
number must match the number of columns defined in the 'pIdxDefs' parameter.
|
number must match the number of columns defined in the 'pIndexDefs' parameter.
|
||||||
|
|
||||||
The fourth parameter specifies which columns make up the index using the
|
The fourth parameter specifies which columns make up the index using the
|
||||||
wxDbIdxDef structure. For each column in the index, you must specify two
|
wxDbIndexDef structure. For each column in the index, you must specify two
|
||||||
things, the column name and the sort order (ascending / descending). See
|
things, the column name and the sort order (ascending / descending). See
|
||||||
the example below to see how to build and pass in the wxDbIdxDef structure.
|
the example below to see how to build and pass in the wxDbIndexDef structure.
|
||||||
|
|
||||||
The fifth parameter is provided to handle the differences in datasources as
|
The fifth parameter is provided to handle the differences in datasources as
|
||||||
to whether they will automatically overwrite existing indexes with the same
|
to whether they will automatically overwrite existing indexes with the same
|
||||||
@@ -2483,18 +2483,18 @@ after executing this function.
|
|||||||
|
|
||||||
\begin{verbatim}
|
\begin{verbatim}
|
||||||
// Create a secondary index on the PARTS table
|
// Create a secondary index on the PARTS table
|
||||||
wxDbIdxDef idxDef[2]; // 2 columns make up the index
|
wxDbIndexDef IndexDef[2]; // 2 columns make up the index
|
||||||
|
|
||||||
wxStrcpy(idxDef[0].ColName, "PART_DESC"); // Column 1
|
wxStrcpy(IndexDef[0].ColName, "PART_DESC"); // Column 1
|
||||||
idxDef[0].Ascending = true;
|
IndexDef[0].Ascending = true;
|
||||||
|
|
||||||
wxStrcpy(idxDef[1].ColName, "SERIAL_NO"); // Column 2
|
wxStrcpy(IndexDef[1].ColName, "SERIAL_NO"); // Column 2
|
||||||
idxDef[1].Ascending = false;
|
IndexDef[1].Ascending = false;
|
||||||
|
|
||||||
// Create a name for the index based on the table's name
|
// Create a name for the index based on the table's name
|
||||||
wxString indexName;
|
wxString indexName;
|
||||||
indexName.Printf("%s_IDX1",parts->GetTableName());
|
indexName.Printf("%s_Index1",parts->GetTableName());
|
||||||
parts->CreateIndex(indexName, true, 2, idxDef);
|
parts->CreateIndex(indexName, true, 2, IndexDef);
|
||||||
\end{verbatim}
|
\end{verbatim}
|
||||||
|
|
||||||
\membersection{wxDbTable::CreateTable}\label{wxdbtablecreatetable}
|
\membersection{wxDbTable::CreateTable}\label{wxdbtablecreatetable}
|
||||||
@@ -2692,18 +2692,18 @@ this function.
|
|||||||
|
|
||||||
\membersection{wxDbTable::DropIndex}\label{wxdbtabledropindex}
|
\membersection{wxDbTable::DropIndex}\label{wxdbtabledropindex}
|
||||||
|
|
||||||
\func{bool}{DropIndex}{\param{const wxString \&}{idxName}}
|
\func{bool}{DropIndex}{\param{const wxString \&}{IndexName}}
|
||||||
|
|
||||||
Allows an index on the associated table to be dropped (deleted) if the user
|
Allows an index on the associated table to be dropped (deleted) if the user
|
||||||
login has sufficient privileges to do so.
|
login has sufficient privileges to do so.
|
||||||
|
|
||||||
\wxheading{Parameters}
|
\wxheading{Parameters}
|
||||||
|
|
||||||
\docparam{idxName}{Name of the index to be dropped.}
|
\docparam{IndexName}{Name of the index to be dropped.}
|
||||||
|
|
||||||
\wxheading{Remarks}
|
\wxheading{Remarks}
|
||||||
|
|
||||||
If the index specified in the 'idxName' parameter does not exist, an error
|
If the index specified in the 'IndexName' parameter does not exist, an error
|
||||||
will be logged, and the function will return a result of false.
|
will be logged, and the function will return a result of false.
|
||||||
|
|
||||||
It is not necessary to call \helpref{wxDb::CommitTrans}{wxdbcommittrans}
|
It is not necessary to call \helpref{wxDb::CommitTrans}{wxdbcommittrans}
|
||||||
@@ -3513,10 +3513,10 @@ table's columns are refreshed to reflect the current data in the database.
|
|||||||
|
|
||||||
\membersection{wxDbTable::SetColDefs}\label{wxdbtablesetcoldefs}
|
\membersection{wxDbTable::SetColDefs}\label{wxdbtablesetcoldefs}
|
||||||
|
|
||||||
\func{void}{SetColDefs}{\param{UWORD }{index}, \param{const wxString \&}{fieldName},
|
\func{bool}{SetColDefs}{\param{UWORD }{index}, \param{const wxString \&}{fieldName},
|
||||||
\param{int }{dataType}, \param{void *}{pData}, \param{SWORD }{cType},
|
\param{int }{dataType}, \param{void *}{pData}, \param{SWORD }{cType},
|
||||||
\param{int }{size}, \param{bool }{keyField = false}, \param{bool }{upd = true},
|
\param{int }{size}, \param{bool }{keyField = false}, \param{bool }{updateable = true},
|
||||||
\param{bool }{insAllow = true}, \param{bool }{derivedCol = false}}
|
\param{bool }{insertAllowed = true}, \param{bool }{derivedColumn = false}}
|
||||||
|
|
||||||
\func{wxDbColDataPtr *}{SetColDefs}{\param{wxDbColInf *}{colInfs}, \param{UWORD }{numCols}}
|
\func{wxDbColDataPtr *}{SetColDefs}{\param{wxDbColInf *}{colInfs}, \param{UWORD }{numCols}}
|
||||||
|
|
||||||
@@ -3560,11 +3560,11 @@ Other valid types are available also, but these are the most common ones:}
|
|||||||
\docparam{size}{Maximum size in bytes of the {\it pData} object.}
|
\docparam{size}{Maximum size in bytes of the {\it pData} object.}
|
||||||
\docparam{keyField}{{\it OPTIONAL}. Indicates if this column is part of the
|
\docparam{keyField}{{\it OPTIONAL}. Indicates if this column is part of the
|
||||||
primary index. Default is false.}
|
primary index. Default is false.}
|
||||||
\docparam{upd}{{\it OPTIONAL}. Are updates allowed on this column?
|
\docparam{updateable}{{\it OPTIONAL}. Are updates allowed on this column?
|
||||||
Default is true.}
|
Default is true.}
|
||||||
\docparam{insAllow}{{\it OPTIONAL}. Inserts allowed on this column?
|
\docparam{insertAllowed}{{\it OPTIONAL}. Inserts allowed on this column?
|
||||||
Default is true.}
|
Default is true.}
|
||||||
\docparam{derivedCol}{{\it OPTIONAL}. Is this a derived column (non-base
|
\docparam{derivedColumn}{{\it OPTIONAL}. Is this a derived column (non-base
|
||||||
table column for query only)? Default is false.}
|
table column for query only)? Default is false.}
|
||||||
|
|
||||||
\docparam{colInfs}{Pointer to an array of wxDbColInf instances which contains
|
\docparam{colInfs}{Pointer to an array of wxDbColInf instances which contains
|
||||||
@@ -3577,6 +3577,14 @@ to by {\it colInfs}, which are to have column definitions created from them.}
|
|||||||
If {\it pData} is to hold a string of characters, be sure to include enough
|
If {\it pData} is to hold a string of characters, be sure to include enough
|
||||||
space for the NULL terminator in pData and in the byte count of {\it size}.
|
space for the NULL terminator in pData and in the byte count of {\it size}.
|
||||||
|
|
||||||
|
Using the first form of this function, if the column definition is not able
|
||||||
|
to be created, a value of false is returned. If the specified index of the
|
||||||
|
column exceeds the number of columns defined in the wxDbTable instance, an
|
||||||
|
assert is thrown and logged (in debug builds) and a false is returned.
|
||||||
|
|
||||||
|
A failure to create the column definition in the second form results in a
|
||||||
|
value of NULL being returned.
|
||||||
|
|
||||||
Both forms of this function provide a shortcut for defining the columns in
|
Both forms of this function provide a shortcut for defining the columns in
|
||||||
your wxDbTable object. Use this function in any derived wxDbTable
|
your wxDbTable object. Use this function in any derived wxDbTable
|
||||||
constructor when describing the column/columns in the wxDbTable object.
|
constructor when describing the column/columns in the wxDbTable object.
|
||||||
|
@@ -197,9 +197,9 @@ public:
|
|||||||
bool Open(bool checkPrivileges=false, bool checkTableExists=true);
|
bool Open(bool checkPrivileges=false, bool checkTableExists=true);
|
||||||
bool CreateTable(bool attemptDrop=true);
|
bool CreateTable(bool attemptDrop=true);
|
||||||
bool DropTable(void);
|
bool DropTable(void);
|
||||||
bool CreateIndex(const wxString &idxName, bool unique, UWORD noIdxCols,
|
bool CreateIndex(const wxString &indexName, bool unique, UWORD numIndexColumns,
|
||||||
wxDbIdxDef *pIdxDefs, bool attemptDrop=true);
|
wxDbIdxDef *pIndexDefs, bool attemptDrop=true);
|
||||||
bool DropIndex(const wxString &idxName);
|
bool DropIndex(const wxString &indexName);
|
||||||
|
|
||||||
// Accessors
|
// Accessors
|
||||||
|
|
||||||
@@ -265,8 +265,8 @@ public:
|
|||||||
void BuildDeleteStmt(wxString &pSqlStmt, int typeOfDel, const wxString &pWhereClause=wxEmptyString);
|
void BuildDeleteStmt(wxString &pSqlStmt, int typeOfDel, const wxString &pWhereClause=wxEmptyString);
|
||||||
void BuildDeleteStmt(wxChar *pSqlStmt, int typeOfDel, const wxString &pWhereClause=wxEmptyString);
|
void BuildDeleteStmt(wxChar *pSqlStmt, int typeOfDel, const wxString &pWhereClause=wxEmptyString);
|
||||||
|
|
||||||
void BuildUpdateStmt(wxString &pSqlStmt, int typeOfUpd, const wxString &pWhereClause=wxEmptyString);
|
void BuildUpdateStmt(wxString &pSqlStmt, int typeOfUpdate, const wxString &pWhereClause=wxEmptyString);
|
||||||
void BuildUpdateStmt(wxChar *pSqlStmt, int typeOfUpd, const wxString &pWhereClause=wxEmptyString);
|
void BuildUpdateStmt(wxChar *pSqlStmt, int typeOfUpdate, const wxString &pWhereClause=wxEmptyString);
|
||||||
|
|
||||||
void BuildWhereClause(wxString &pWhereClause, int typeOfWhere, const wxString &qualTableName=wxEmptyString, bool useLikeComparison=false);
|
void BuildWhereClause(wxString &pWhereClause, int typeOfWhere, const wxString &qualTableName=wxEmptyString, bool useLikeComparison=false);
|
||||||
void BuildWhereClause(wxChar *pWhereClause, int typeOfWhere, const wxString &qualTableName=wxEmptyString, bool useLikeComparison=false);
|
void BuildWhereClause(wxChar *pWhereClause, int typeOfWhere, const wxString &qualTableName=wxEmptyString, bool useLikeComparison=false);
|
||||||
@@ -277,8 +277,8 @@ public:
|
|||||||
{ BuildSelectStmt(pSqlStmt,typeOfSelect,distinct); }
|
{ BuildSelectStmt(pSqlStmt,typeOfSelect,distinct); }
|
||||||
void GetDeleteStmt(char *pSqlStmt, int typeOfDel, const char *pWhereClause = NULL)
|
void GetDeleteStmt(char *pSqlStmt, int typeOfDel, const char *pWhereClause = NULL)
|
||||||
{ BuildDeleteStmt(pSqlStmt,typeOfDel,pWhereClause); }
|
{ BuildDeleteStmt(pSqlStmt,typeOfDel,pWhereClause); }
|
||||||
void GetUpdateStmt(char *pSqlStmt, int typeOfUpd, const char *pWhereClause = NULL)
|
void GetUpdateStmt(char *pSqlStmt, int typeOfUpdate, const char *pWhereClause = NULL)
|
||||||
{ BuildUpdateStmt(pSqlStmt,typeOfUpd,pWhereClause); }
|
{ BuildUpdateStmt(pSqlStmt,typeOfUpdate,pWhereClause); }
|
||||||
void GetWhereClause(char *pWhereClause, int typeOfWhere,
|
void GetWhereClause(char *pWhereClause, int typeOfWhere,
|
||||||
const char *qualTableName = NULL, bool useLikeComparison=false)
|
const char *qualTableName = NULL, bool useLikeComparison=false)
|
||||||
{ BuildWhereClause(pWhereClause,typeOfWhere,qualTableName,useLikeComparison); }
|
{ BuildWhereClause(pWhereClause,typeOfWhere,qualTableName,useLikeComparison); }
|
||||||
@@ -295,8 +295,8 @@ public:
|
|||||||
wxDbColDef *GetColDefs() { return colDefs; }
|
wxDbColDef *GetColDefs() { return colDefs; }
|
||||||
bool SetColDefs(UWORD index, const wxString &fieldName, int dataType,
|
bool SetColDefs(UWORD index, const wxString &fieldName, int dataType,
|
||||||
void *pData, SWORD cType,
|
void *pData, SWORD cType,
|
||||||
int size, bool keyField = false, bool upd = true,
|
int size, bool keyField = false, bool updateable = true,
|
||||||
bool insAllow = true, bool derivedCol = false);
|
bool insertAllowed = true, bool derivedColumn = false);
|
||||||
wxDbColDataPtr *SetColDefs(wxDbColInf *colInfs, UWORD numCols);
|
wxDbColDataPtr *SetColDefs(wxDbColInf *colInfs, UWORD numCols);
|
||||||
|
|
||||||
bool CloseCursor(HSTMT cursor);
|
bool CloseCursor(HSTMT cursor);
|
||||||
|
@@ -1178,7 +1178,7 @@ void wxDbTable::BuildSelectStmt(wxChar *pSqlStmt, int typeOfSelect, bool distinc
|
|||||||
|
|
||||||
|
|
||||||
/********** wxDbTable::BuildUpdateStmt() **********/
|
/********** wxDbTable::BuildUpdateStmt() **********/
|
||||||
void wxDbTable::BuildUpdateStmt(wxString &pSqlStmt, int typeOfUpd, const wxString &pWhereClause)
|
void wxDbTable::BuildUpdateStmt(wxString &pSqlStmt, int typeOfUpdate, const wxString &pWhereClause)
|
||||||
{
|
{
|
||||||
wxASSERT(!queryOnly);
|
wxASSERT(!queryOnly);
|
||||||
if (queryOnly)
|
if (queryOnly)
|
||||||
@@ -1212,7 +1212,7 @@ void wxDbTable::BuildUpdateStmt(wxString &pSqlStmt, int typeOfUpd, const wxStrin
|
|||||||
|
|
||||||
// Append the WHERE clause to the SQL UPDATE statement
|
// Append the WHERE clause to the SQL UPDATE statement
|
||||||
pSqlStmt += wxT(" WHERE ");
|
pSqlStmt += wxT(" WHERE ");
|
||||||
switch(typeOfUpd)
|
switch(typeOfUpdate)
|
||||||
{
|
{
|
||||||
case DB_UPD_KEYFIELDS:
|
case DB_UPD_KEYFIELDS:
|
||||||
// If the datasource supports the ROWID column, build
|
// If the datasource supports the ROWID column, build
|
||||||
@@ -1247,10 +1247,10 @@ void wxDbTable::BuildUpdateStmt(wxString &pSqlStmt, int typeOfUpd, const wxStrin
|
|||||||
|
|
||||||
|
|
||||||
/***** DEPRECATED: use wxDbTable::BuildUpdateStmt(wxString &....) form *****/
|
/***** DEPRECATED: use wxDbTable::BuildUpdateStmt(wxString &....) form *****/
|
||||||
void wxDbTable::BuildUpdateStmt(wxChar *pSqlStmt, int typeOfUpd, const wxString &pWhereClause)
|
void wxDbTable::BuildUpdateStmt(wxChar *pSqlStmt, int typeOfUpdate, const wxString &pWhereClause)
|
||||||
{
|
{
|
||||||
wxString tempSqlStmt;
|
wxString tempSqlStmt;
|
||||||
BuildUpdateStmt(tempSqlStmt, typeOfUpd, pWhereClause);
|
BuildUpdateStmt(tempSqlStmt, typeOfUpdate, pWhereClause);
|
||||||
wxStrcpy(pSqlStmt, tempSqlStmt);
|
wxStrcpy(pSqlStmt, tempSqlStmt);
|
||||||
} // BuildUpdateStmt()
|
} // BuildUpdateStmt()
|
||||||
|
|
||||||
@@ -1648,13 +1648,13 @@ bool wxDbTable::DropTable()
|
|||||||
|
|
||||||
|
|
||||||
/********** wxDbTable::CreateIndex() **********/
|
/********** wxDbTable::CreateIndex() **********/
|
||||||
bool wxDbTable::CreateIndex(const wxString &idxName, bool unique, UWORD noIdxCols,
|
bool wxDbTable::CreateIndex(const wxString &indexName, bool unique, UWORD numIndexColumns,
|
||||||
wxDbIdxDef *pIdxDefs, bool attemptDrop)
|
wxDbIdxDef *pIndexDefs, bool attemptDrop)
|
||||||
{
|
{
|
||||||
wxString sqlStmt;
|
wxString sqlStmt;
|
||||||
|
|
||||||
// Drop the index first
|
// Drop the index first
|
||||||
if (attemptDrop && !DropIndex(idxName))
|
if (attemptDrop && !DropIndex(indexName))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// MySQL (and possibly Sybase ASE?? - gt) require that any columns which are used as portions
|
// MySQL (and possibly Sybase ASE?? - gt) require that any columns which are used as portions
|
||||||
@@ -1670,7 +1670,7 @@ bool wxDbTable::CreateIndex(const wxString &idxName, bool unique, UWORD noIdxCol
|
|||||||
wxString sqlStmt;
|
wxString sqlStmt;
|
||||||
int i;
|
int i;
|
||||||
bool ok = true;
|
bool ok = true;
|
||||||
for (i = 0; i < noIdxCols && ok; i++)
|
for (i = 0; i < numIndexColumns && ok; i++)
|
||||||
{
|
{
|
||||||
int j = 0;
|
int j = 0;
|
||||||
bool found = false;
|
bool found = false;
|
||||||
@@ -1680,7 +1680,7 @@ bool wxDbTable::CreateIndex(const wxString &idxName, bool unique, UWORD noIdxCol
|
|||||||
// this information
|
// this information
|
||||||
while (!found && (j < this->m_numCols))
|
while (!found && (j < this->m_numCols))
|
||||||
{
|
{
|
||||||
if (wxStrcmp(colDefs[j].ColName,pIdxDefs[i].ColName) == 0)
|
if (wxStrcmp(colDefs[j].ColName,pIndexDefs[i].ColName) == 0)
|
||||||
found = true;
|
found = true;
|
||||||
if (!found)
|
if (!found)
|
||||||
j++;
|
j++;
|
||||||
@@ -1688,7 +1688,7 @@ bool wxDbTable::CreateIndex(const wxString &idxName, bool unique, UWORD noIdxCol
|
|||||||
|
|
||||||
if (found)
|
if (found)
|
||||||
{
|
{
|
||||||
ok = pDb->ModifyColumn(tableName, pIdxDefs[i].ColName,
|
ok = pDb->ModifyColumn(tableName, pIndexDefs[i].ColName,
|
||||||
colDefs[j].DbDataType, (int)(colDefs[j].SzDataObj / sizeof(wxChar)),
|
colDefs[j].DbDataType, (int)(colDefs[j].SzDataObj / sizeof(wxChar)),
|
||||||
wxT("NOT NULL"));
|
wxT("NOT NULL"));
|
||||||
|
|
||||||
@@ -1722,7 +1722,7 @@ bool wxDbTable::CreateIndex(const wxString &idxName, bool unique, UWORD noIdxCol
|
|||||||
sqlStmt += wxT("UNIQUE ");
|
sqlStmt += wxT("UNIQUE ");
|
||||||
|
|
||||||
sqlStmt += wxT("INDEX ");
|
sqlStmt += wxT("INDEX ");
|
||||||
sqlStmt += pDb->SQLTableName(idxName);
|
sqlStmt += pDb->SQLTableName(indexName);
|
||||||
sqlStmt += wxT(" ON ");
|
sqlStmt += wxT(" ON ");
|
||||||
|
|
||||||
sqlStmt += pDb->SQLTableName(tableName);
|
sqlStmt += pDb->SQLTableName(tableName);
|
||||||
@@ -1731,10 +1731,10 @@ bool wxDbTable::CreateIndex(const wxString &idxName, bool unique, UWORD noIdxCol
|
|||||||
|
|
||||||
// Append list of columns making up index
|
// Append list of columns making up index
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < noIdxCols; i++)
|
for (i = 0; i < numIndexColumns; i++)
|
||||||
{
|
{
|
||||||
sqlStmt += pDb->SQLColumnName(pIdxDefs[i].ColName);
|
sqlStmt += pDb->SQLColumnName(pIndexDefs[i].ColName);
|
||||||
// sqlStmt += pIdxDefs[i].ColName;
|
// sqlStmt += pIndexDefs[i].ColName;
|
||||||
|
|
||||||
// MySQL requires a key length on VARCHAR keys
|
// MySQL requires a key length on VARCHAR keys
|
||||||
if ( pDb->Dbms() == dbmsMY_SQL )
|
if ( pDb->Dbms() == dbmsMY_SQL )
|
||||||
@@ -1743,7 +1743,7 @@ bool wxDbTable::CreateIndex(const wxString &idxName, bool unique, UWORD noIdxCol
|
|||||||
int j;
|
int j;
|
||||||
for ( j = 0; j < m_numCols; ++j )
|
for ( j = 0; j < m_numCols; ++j )
|
||||||
{
|
{
|
||||||
if ( wxStrcmp( pIdxDefs[i].ColName, colDefs[j].ColName ) == 0 )
|
if ( wxStrcmp( pIndexDefs[i].ColName, colDefs[j].ColName ) == 0 )
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -1761,15 +1761,15 @@ bool wxDbTable::CreateIndex(const wxString &idxName, bool unique, UWORD noIdxCol
|
|||||||
!(pDb->Dbms() == dbmsFIREBIRD) &&
|
!(pDb->Dbms() == dbmsFIREBIRD) &&
|
||||||
!(pDb->Dbms() == dbmsPOSTGRES))
|
!(pDb->Dbms() == dbmsPOSTGRES))
|
||||||
{
|
{
|
||||||
if (pIdxDefs[i].Ascending)
|
if (pIndexDefs[i].Ascending)
|
||||||
sqlStmt += wxT(" ASC");
|
sqlStmt += wxT(" ASC");
|
||||||
else
|
else
|
||||||
sqlStmt += wxT(" DESC");
|
sqlStmt += wxT(" DESC");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
wxASSERT_MSG(pIdxDefs[i].Ascending, _T("Datasource does not support DESCending index columns"));
|
wxASSERT_MSG(pIndexDefs[i].Ascending, _T("Datasource does not support DESCending index columns"));
|
||||||
|
|
||||||
if ((i + 1) < noIdxCols)
|
if ((i + 1) < numIndexColumns)
|
||||||
sqlStmt += wxT(",");
|
sqlStmt += wxT(",");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1805,7 +1805,7 @@ bool wxDbTable::CreateIndex(const wxString &idxName, bool unique, UWORD noIdxCol
|
|||||||
|
|
||||||
|
|
||||||
/********** wxDbTable::DropIndex() **********/
|
/********** wxDbTable::DropIndex() **********/
|
||||||
bool wxDbTable::DropIndex(const wxString &idxName)
|
bool wxDbTable::DropIndex(const wxString &indexName)
|
||||||
{
|
{
|
||||||
// NOTE: This function returns true if the Index does not exist, but
|
// NOTE: This function returns true if the Index does not exist, but
|
||||||
// only for identified databases. Code will need to be added
|
// only for identified databases. Code will need to be added
|
||||||
@@ -1817,17 +1817,17 @@ bool wxDbTable::DropIndex(const wxString &idxName)
|
|||||||
if (pDb->Dbms() == dbmsACCESS || pDb->Dbms() == dbmsMY_SQL ||
|
if (pDb->Dbms() == dbmsACCESS || pDb->Dbms() == dbmsMY_SQL ||
|
||||||
pDb->Dbms() == dbmsDBASE /*|| Paradox needs this syntax too when we add support*/)
|
pDb->Dbms() == dbmsDBASE /*|| Paradox needs this syntax too when we add support*/)
|
||||||
sqlStmt.Printf(wxT("DROP INDEX %s ON %s"),
|
sqlStmt.Printf(wxT("DROP INDEX %s ON %s"),
|
||||||
pDb->SQLTableName(idxName.c_str()).c_str(),
|
pDb->SQLTableName(indexName.c_str()).c_str(),
|
||||||
pDb->SQLTableName(tableName.c_str()).c_str());
|
pDb->SQLTableName(tableName.c_str()).c_str());
|
||||||
else if ((pDb->Dbms() == dbmsMS_SQL_SERVER) ||
|
else if ((pDb->Dbms() == dbmsMS_SQL_SERVER) ||
|
||||||
(pDb->Dbms() == dbmsSYBASE_ASE) ||
|
(pDb->Dbms() == dbmsSYBASE_ASE) ||
|
||||||
(pDb->Dbms() == dbmsXBASE_SEQUITER))
|
(pDb->Dbms() == dbmsXBASE_SEQUITER))
|
||||||
sqlStmt.Printf(wxT("DROP INDEX %s.%s"),
|
sqlStmt.Printf(wxT("DROP INDEX %s.%s"),
|
||||||
pDb->SQLTableName(tableName.c_str()).c_str(),
|
pDb->SQLTableName(tableName.c_str()).c_str(),
|
||||||
pDb->SQLTableName(idxName.c_str()).c_str());
|
pDb->SQLTableName(indexName.c_str()).c_str());
|
||||||
else
|
else
|
||||||
sqlStmt.Printf(wxT("DROP INDEX %s"),
|
sqlStmt.Printf(wxT("DROP INDEX %s"),
|
||||||
pDb->SQLTableName(idxName.c_str()).c_str());
|
pDb->SQLTableName(indexName.c_str()).c_str());
|
||||||
|
|
||||||
pDb->WriteSqlLog(sqlStmt);
|
pDb->WriteSqlLog(sqlStmt);
|
||||||
|
|
||||||
@@ -2270,7 +2270,7 @@ bool wxDbTable::SetQueryTimeout(UDWORD nSeconds)
|
|||||||
/********** wxDbTable::SetColDefs() **********/
|
/********** wxDbTable::SetColDefs() **********/
|
||||||
bool wxDbTable::SetColDefs(UWORD index, const wxString &fieldName, int dataType, void *pData,
|
bool wxDbTable::SetColDefs(UWORD index, const wxString &fieldName, int dataType, void *pData,
|
||||||
SWORD cType, int size, bool keyField, bool updateable,
|
SWORD cType, int size, bool keyField, bool updateable,
|
||||||
bool insAllow, bool derivedCol)
|
bool insertAllowed, bool derivedColumn)
|
||||||
{
|
{
|
||||||
wxString tmpStr;
|
wxString tmpStr;
|
||||||
|
|
||||||
@@ -2303,9 +2303,9 @@ bool wxDbTable::SetColDefs(UWORD index, const wxString &fieldName, int dataType,
|
|||||||
colDefs[index].SqlCtype = cType;
|
colDefs[index].SqlCtype = cType;
|
||||||
colDefs[index].SzDataObj = size; //TODO: glt ??? * sizeof(wxChar) ???
|
colDefs[index].SzDataObj = size; //TODO: glt ??? * sizeof(wxChar) ???
|
||||||
colDefs[index].KeyField = keyField;
|
colDefs[index].KeyField = keyField;
|
||||||
colDefs[index].DerivedCol = derivedCol;
|
colDefs[index].DerivedCol = derivedColumn;
|
||||||
// Derived columns by definition would NOT be "Insertable" or "Updateable"
|
// Derived columns by definition would NOT be "Insertable" or "Updateable"
|
||||||
if (derivedCol)
|
if (derivedColumn)
|
||||||
{
|
{
|
||||||
colDefs[index].Updateable = false;
|
colDefs[index].Updateable = false;
|
||||||
colDefs[index].InsertAllowed = false;
|
colDefs[index].InsertAllowed = false;
|
||||||
@@ -2313,7 +2313,7 @@ bool wxDbTable::SetColDefs(UWORD index, const wxString &fieldName, int dataType,
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
colDefs[index].Updateable = updateable;
|
colDefs[index].Updateable = updateable;
|
||||||
colDefs[index].InsertAllowed = insAllow;
|
colDefs[index].InsertAllowed = insertAllowed;
|
||||||
}
|
}
|
||||||
|
|
||||||
colDefs[index].Null = false;
|
colDefs[index].Null = false;
|
||||||
|
Reference in New Issue
Block a user