⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 db.tex

📁 很牛的GUI源码wxWidgets-2.8.0.zip 可在多种平台下运行.
💻 TEX
📖 第 1 页 / 共 5 页
字号:
    // Check for a NULL result    if (cb == SQL_NULL_DATA)        return(0);\end{verbatim}\wxheading{Remarks}When requesting multiple columns to be returned from the result set (for example, the SQL queryrequested 3 columns be returned), the calls to this function must request the columns in ordinalsequence (1,2,3 or 1,3 or 2,3).\membersection{wxDb::GetDatabaseName}\label{wxdbgetdatabasename}\func{const wxChar *}{GetDatabaseName}{\void}Returns the name of the database engine.\membersection{wxDb::GetDatasourceName}\label{wxdbgetdatasourcename}\func{const wxString \&}{GetDatasourceName}{\void}Returns the ODBC datasource name.\membersection{wxDb::GetHDBC}\label{wxdbgethdbc}\func{HDBC}{GetHDBC}{\void}Returns the ODBC handle to the database connection.\membersection{wxDb::GetHENV}\label{wxdbgethenv}\func{HENV}{GetHENV}{\void}Returns the ODBC environment handle.\membersection{wxDb::GetHSTMT}\label{wxdbgethstmt}\func{HSTMT}{GetHSTMT}{\void}Returns the ODBC statement handle associated with this database connection.\membersection{wxDb::GetKeyFields}\label{wxdbgetkeyfields}\func{int }{GetKeyFields}{\param{const wxString \&}{tableName}, \param{wxDbColInf *}{colInf}, \param{UWORD }{numColumns}}Used to determine which columns are members of primary or non-primary indexes on the specified table.  If a column is a member of a foreign key for some other table, that information is detected also.This function is primarily for use by the \helpref{wxDb::GetColumns}{wxdbgetcolumns} function, but may be called if desired from the client application.\wxheading{Parameters}\docparam{tableName}{Name of the table for which the columns will be evaluated as to their inclusion in any indexes.}\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.}\docparam{numColumns}{Number of columns defined in the instance of colInf.}\wxheading{Return value}Currently always returns true.\wxheading{See also}\helpref{wxDbColInf}{wxdbcolinf}, \helpref{wxDb::GetColumns}{wxdbgetcolumns}\membersection{wxDb::GetNext}\label{wxdbgetnext}\func{bool}{GetNext}{\void}Called after executing a query, this function requests the next rowin the result set after the current position of the cursor.\wxheading{See also}\helpref{wxDb::ExecSql}{wxdbexecsql}, \helpref{wxDb::GetData}{wxdbgetdata}\membersection{wxDb::GetNextError}\label{wxdbgetnexterror}\func{bool}{GetNextError}{\param{HENV}{ aHenv},\param{HDBC}{ aHdbc = SQL\_NULL\_HDBC}, \param{HSTMT}{ aHstmt = SQL\_NULL\_HSTMT}}\wxheading{Parameters}\docparam{aHenv}{A handle to the ODBC environment.}\docparam{aHdbc}{{\it OPTIONAL.}  A handle to the ODBC connection.  Pass thisin if the ODBC function call that failed required a hdbc or hstmt argument.}\docparam{AHstmt}{{\it OPTIONAL.}A handle to the ODBC statement being executedagainst.  Pass this in if the ODBC function call that failed requires ahstmt argument.}\wxheading{Example}\begin{verbatim}   if (SQLExecDirect(hstmt, (UCHAR FAR *) pSqlStmt, SQL_NTS) != SQL_SUCCESS)   {      return(db.GetNextError(db.henv, db.hdbc, hstmt));   }\end{verbatim}\wxheading{See also}\helpref{wxDb::DispNextError}{wxdbdispnexterror},\helpref{wxDb::DispAllErrors}{wxdbdispallerrors}\membersection{wxDb::GetPassword}\label{wxdbgetpassword}\func{const wxString \&}{GetPassword}{\void}Returns the password used to establish this connection to the datasource.\membersection{wxDb::GetTableCount}\label{wxdbgettablecount}\func{int }{GetTableCount}{\void}Returns the number of wxDbTable() instances currently using this datasourceconnection.\membersection{wxDb::GetUsername}\label{wxdbgetusername}\func{const wxString \&}{GetUsername}{\void}Returns the user name (uid) used to establish this connection to thedatasource.\membersection{wxDb::Grant}\label{wxdbgrant}\func{bool}{Grant}{\param{int }{privileges}, \param{const wxString \&}{tableName},\param{const wxString \&}{userList = "PUBLIC"}}Use this member function to GRANT privileges to users for accessing tables inthe datasource.\wxheading{Parameters}\docparam{privileges}{Use this argument to select which privileges you want togrant.  Pass DB\_GRANT\_ALL to grant all privileges.  To grant individualprivileges pass one or more of the following OR'd together:}\begin{verbatim}         DB_GRANT_SELECT  = 1         DB_GRANT_INSERT  = 2         DB_GRANT_UPDATE  = 4         DB_GRANT_DELETE  = 8         DB_GRANT_ALL     = DB_GRANT_SELECT | DB_GRANT_INSERT |                            DB_GRANT_UPDATE | DB_GRANT_DELETE\end{verbatim}\docparam{tableName}{The name of the table you wish to grant privileges on.}\docparam{userList}{{\it OPTIONAL.}  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.}\wxheading{Remarks}Some 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.The currently logged in user must have sufficient grantor privileges for thisfunction to be able to successfully grant the indicated privileges.\wxheading{Example}\begin{verbatim}   db.Grant(DB_GRANT_SELECT | DB_GRANT_INSERT, "PARTS", "mary, sue");\end{verbatim}\membersection{wxDb::IsFwdOnlyCursors}\label{wxdbisfwdonlycursors}\func{bool}{IsFwdOnlyCursors}{\void}This setting indicates whether this database connection was createdas being capable of using only forward scrolling cursors.This function does NOT indicate if the ODBC driver or datasource supportsbackward scrolling cursors.  There is no standard way of detecting if thedriver or datasource can support backward scrolling cursors.If a wxDb instance was created as being capable of only forward scrollingcursors, then even if the datasource and ODBC driver support backwardscrolling cursors, tables using this database connection would only be ableto use forward scrolling cursors.The default setting of whether a wxDb connection to a database allowsforward-only or also backward scrolling cursors is defined in setup.h by thevalue of wxODBC\_FWD\_ONLY\_CURSORS.  This default setting can be overriddenwhen the wxDb connection is initially created (see\helpref{wxDb constructor}{wxdbctor} and \helpref{wxDbGetConnection}{wxdbfunctions}).\wxheading{Return value}Returns true if this datasource connection is defined as using only forwardscrolling cursors, or false if the connection is defined as being allowed touse backward scrolling cursors and their associated functions (see note above).\wxheading{Remarks}Added as of wxWidgets v2.4 release, this function is a renamed version ofwxDb::FwdOnlyCursors() to match the normal wxWidgets naming conventions forclass member functions.This function is not available in versions prior to v2.4.  You shoulduse \helpref{wxDb::FwdOnlyCursors}{wxdbfwdonlycursors} for wxWidgetsversions prior to 2.4.\wxheading{See also}\helpref{wxDb constructor}{wxdbctor}, \helpref{wxDbGetConnection}{wxdbfunctions}\membersection{wxDb::IsOpen}\label{wxdbisopen}\func{bool}{IsOpen}{\void}Indicates whether the database connection to the datasource is currentlyopened.\wxheading{Remarks}This function may indicate that the database connection is open, even ifthe call to \helpref{wxDb::Open}{wxdbopen} may have failed to fullyinitialize the connection correctly.  The connection to the database{\it is} open and can be used via the direct SQL commands, if thisfunction returns true.  Other functions which depend on the\helpref{wxDb::Open}{wxdbopen} to have completed correctly may not functionas expected.  The return result from \helpref{wxDb::Open}{wxdbopen} is theonly way to know if complete initialization of this wxDb connection wassuccessful or not.  See \helpref{wxDb::Open}{wxdbopen} for more details onpartial failures to open a connection instance.\membersection{wxDb::LogError}\label{wxdblogerror}\func{void}{LogError}{\param{const wxString \&}{errMsg} \param{const wxString \&}{SQLState=""}}\docparam{errMsg}{Free-form text to display describing the error/text to be logged.}\docparam{SQLState}{{\it OPTIONAL.}  Native SQL state error.  Default is 0.}\wxheading{Remarks}Calling this function will enter a log message in the error list maintainedfor the database connection.  This log message is free form and can beanything the programmer wants to enter in the error list.If SQL logging is turned on, the call to this function will also log thetext into the SQL log file.\wxheading{See also}\helpref{wxDb::WriteSqlLog}{wxdbwritesqllog}\membersection{wxDb::ModifyColumn}\label{wxdbmodifycolumn}\func{void}{ModifyColumn}{\param{const wxString \&}{tableName} \param{const wxString \&}{ColumnName}\param{int }{dataType} \param{ULONG }{columnLength=0} \param{const wxString \&}{optionalParam=""}}Used to change certain properties of a column such as the length, or whether a columnallows NULLs or not.\docparam{tableName}{Name of the table that the column to be modified is in.}\docparam{columnName}{Name of the column to be modified.  NOTE: Name of column cannotbe changed with this function.}\docparam{dataType}{Any one of DB\_DATA\_TYPE\_VARCHAR, DB\_DATA\_TYPE\_INTEGER,DB\_DATA\_TYPE\_FLOAT, DB\_DATA\_TYPE\_DATE.}\docparam{columnLength}{New size of the column.  Valid only for DB\_DATA\_TYPE\_VARCHARdataType fields.  Default is 0.}\docparam{optionalParam}{Default is "".}\wxheading{Remarks}Cannot be used to modify the precision of a numeric column, therefore 'columnLength'is ignored unless the dataType is DB\_DATA\_TYPE\_VARCHAR.Some datasources do not allow certain properties of a column to be changed if any rowscurrently have data stored in that column.  Those datasources that do allow columnsto be changed with data in the rows many handle truncation and/or expansion indifferent ways.  Please refer to the reference material for the datasource beingused for behavioral descriptions.\wxheading{Example}\begin{verbatim}    ok = pDb->ModifyColumn("CONTACTS", "ADDRESS2",                            DB_, colDefs[j].SzDataObj,                            wxT("NOT NULL"));\end{verbatim}\membersection{wxDb::Open}\label{wxdbopen}\func{bool}{Open}{\param{const wxString \&}{Dsn}, \param{const wxString \&}{Uid},\param{const wxString \&}{AuthStr}, \param{bool }{failOnDataTypeUnsupported}}\func{bool}{Open}{\param{const wxString \&}{inConnectStr}, \param{bool }{failOnDataTypeUnsupported}}\func{bool}{Open}{\param{wxDbConnectInf *}{dbConnectInf}, \param{bool }{failOnDataTypeUnsupported}}\func{bool}{Open}{\param{wxDb *}{copyDb}}Opens a connection to the datasource, sets certain behaviors of the datasourceto confirm to the accepted behaviors (e.g. cursor position maintained oncommits), and queries the datasource for its representations of the basicdatatypes to determine the form in which the data going to/from columns inthe data tables are to be handled.The second form of this function, which accepts a "wxDb *" as a parameter,can be used to avoid the overhead (execution time, database load, networktraffic) which are needed to determine the data types and representationsof data that are necessary for cross-datasource support by these classes.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -