1 ///////////////////////////////////////////////////////////////////////////////
3 // Purpose: Header file wxDB class. The wxDB class represents a connection
4 // to an ODBC data source. The wxDB class allows operations on the data
5 // source such as opening and closing the data source.
7 // Modified by: George Tasker
9 // -Added support for SQL statement logging and database cataloging
11 // -Added QUERY_ONLY mode support to reduce default number of cursors
12 // -Added additional SQL logging code
13 // -Added DEBUG-ONLY tracking of Ctable objects to detect orphaned DB connections
14 // -Set ODBC option to only read committed writes to the DB so all
15 // databases operate the same in that respect
19 // Copyright: (c) 1996 Remstar International, Inc.
20 // Licence: wxWindows licence, plus:
21 // Notice: This class library and its intellectual design are free of charge for use,
22 // modification, enhancement, debugging under the following conditions:
23 // 1) These classes may only be used as part of the implementation of a
24 // wxWindows-based application
25 // 2) All enhancements and bug fixes are to be submitted back to the wxWindows
26 // user groups free of all charges for use with the wxWindows library.
27 // 3) These classes may not be distributed as part of any other class library,
28 // DLL, text (written or electronic), other than a complete distribution of
29 // the wxWindows GUI development toolkit.
31 ///////////////////////////////////////////////////////////////////////////////
41 // Use this line for wxWindows v1.x
43 // Use this line for wxWindows v2.x
44 #include "wx/version.h"
46 #if wxMAJOR_VERSION == 2
48 #pragma interface "db.h"
54 #if wxMAJOR_VERSION == 2
57 #include "wx/isqlext.h"
67 typedef double SDOUBLE
;
68 typedef unsigned int UINT
;
71 #ifndef wxODBC_FWD_ONLY_CURSORS
72 #define wxODBC_FWD_ONLY_CURSORS 1
75 enum enumDummy
{enumDum1
};
77 #define SQL_C_BOOLEAN(datatype) (sizeof(datatype) == 1 ? SQL_C_UTINYINT : (sizeof(datatype) == 2 ? SQL_C_USHORT : SQL_C_ULONG))
78 // #define SQL_C_BOOLEAN (sizeof(Bool) == 2 ? SQL_C_USHORT : SQL_C_ULONG)
80 #define SQL_C_ENUM (sizeof(enumDummy) == 2 ? SQL_C_USHORT : SQL_C_ULONG)
90 const int DB_PATH_MAX
= 254;
92 extern char const *SQL_LOG_FILENAME
;
93 extern char const *SQL_CATALOG_FILENAME
;
97 const int DB_TYPE_NAME_LEN
= 40;
98 const int DB_MAX_STATEMENT_LEN
= 2048;
99 const int DB_MAX_WHERE_CLAUSE_LEN
= 1024;
100 const int DB_MAX_ERROR_MSG_LEN
= 512;
101 const int DB_MAX_ERROR_HISTORY
= 5;
102 const int DB_MAX_TABLE_NAME_LEN
= 128;
103 const int DB_MAX_COLUMN_NAME_LEN
= 128;
105 const int DB_DATA_TYPE_VARCHAR
= 1;
106 const int DB_DATA_TYPE_INTEGER
= 2;
107 const int DB_DATA_TYPE_FLOAT
= 3;
108 const int DB_DATA_TYPE_DATE
= 4;
110 const int DB_SELECT_KEYFIELDS
= 1;
111 const int DB_SELECT_WHERE
= 2;
112 const int DB_SELECT_MATCHING
= 3;
113 const int DB_SELECT_STATEMENT
= 4;
115 const int DB_UPD_KEYFIELDS
= 1;
116 const int DB_UPD_WHERE
= 2;
118 const int DB_DEL_KEYFIELDS
= 1;
119 const int DB_DEL_WHERE
= 2;
120 const int DB_DEL_MATCHING
= 3;
122 const int DB_WHERE_KEYFIELDS
= 1;
123 const int DB_WHERE_MATCHING
= 2;
125 const int DB_GRANT_SELECT
= 1;
126 const int DB_GRANT_INSERT
= 2;
127 const int DB_GRANT_UPDATE
= 4;
128 const int DB_GRANT_DELETE
= 8;
129 const int DB_GRANT_ALL
= DB_GRANT_SELECT
| DB_GRANT_INSERT
| DB_GRANT_UPDATE
| DB_GRANT_DELETE
;
131 // ODBC Error codes (derived from ODBC SqlState codes)
137 DB_ERR_GENERAL_WARNING
, // SqlState = '01000'
138 DB_ERR_DISCONNECT_ERROR
, // SqlState = '01002'
139 DB_ERR_DATA_TRUNCATED
, // SqlState = '01004'
140 DB_ERR_PRIV_NOT_REVOKED
, // SqlState = '01006'
141 DB_ERR_INVALID_CONN_STR_ATTR
, // SqlState = '01S00'
142 DB_ERR_ERROR_IN_ROW
, // SqlState = '01S01'
143 DB_ERR_OPTION_VALUE_CHANGED
, // SqlState = '01S02'
144 DB_ERR_NO_ROWS_UPD_OR_DEL
, // SqlState = '01S03'
145 DB_ERR_MULTI_ROWS_UPD_OR_DEL
, // SqlState = '01S04'
146 DB_ERR_WRONG_NO_OF_PARAMS
, // SqlState = '07001'
147 DB_ERR_DATA_TYPE_ATTR_VIOL
, // SqlState = '07006'
148 DB_ERR_UNABLE_TO_CONNECT
, // SqlState = '08001'
149 DB_ERR_CONNECTION_IN_USE
, // SqlState = '08002'
150 DB_ERR_CONNECTION_NOT_OPEN
, // SqlState = '08003'
151 DB_ERR_REJECTED_CONNECTION
, // SqlState = '08004'
152 DB_ERR_CONN_FAIL_IN_TRANS
, // SqlState = '08007'
153 DB_ERR_COMM_LINK_FAILURE
, // SqlState = '08S01'
154 DB_ERR_INSERT_VALUE_LIST_MISMATCH
, // SqlState = '21S01'
155 DB_ERR_DERIVED_TABLE_MISMATCH
, // SqlState = '21S02'
156 DB_ERR_STRING_RIGHT_TRUNC
, // SqlState = '22001'
157 DB_ERR_NUMERIC_VALUE_OUT_OF_RNG
, // SqlState = '22003'
158 DB_ERR_ERROR_IN_ASSIGNMENT
, // SqlState = '22005'
159 DB_ERR_DATETIME_FLD_OVERFLOW
, // SqlState = '22008'
160 DB_ERR_DIVIDE_BY_ZERO
, // SqlState = '22012'
161 DB_ERR_STR_DATA_LENGTH_MISMATCH
, // SqlState = '22026'
162 DB_ERR_INTEGRITY_CONSTRAINT_VIOL
, // SqlState = '23000'
163 DB_ERR_INVALID_CURSOR_STATE
, // SqlState = '24000'
164 DB_ERR_INVALID_TRANS_STATE
, // SqlState = '25000'
165 DB_ERR_INVALID_AUTH_SPEC
, // SqlState = '28000'
166 DB_ERR_INVALID_CURSOR_NAME
, // SqlState = '34000'
167 DB_ERR_SYNTAX_ERROR_OR_ACCESS_VIOL
, // SqlState = '37000'
168 DB_ERR_DUPLICATE_CURSOR_NAME
, // SqlState = '3C000'
169 DB_ERR_SERIALIZATION_FAILURE
, // SqlState = '40001'
170 DB_ERR_SYNTAX_ERROR_OR_ACCESS_VIOL2
, // SqlState = '42000'
171 DB_ERR_OPERATION_ABORTED
, // SqlState = '70100'
172 DB_ERR_UNSUPPORTED_FUNCTION
, // SqlState = 'IM001'
173 DB_ERR_NO_DATA_SOURCE
, // SqlState = 'IM002'
174 DB_ERR_DRIVER_LOAD_ERROR
, // SqlState = 'IM003'
175 DB_ERR_SQLALLOCENV_FAILED
, // SqlState = 'IM004'
176 DB_ERR_SQLALLOCCONNECT_FAILED
, // SqlState = 'IM005'
177 DB_ERR_SQLSETCONNECTOPTION_FAILED
, // SqlState = 'IM006'
178 DB_ERR_NO_DATA_SOURCE_DLG_PROHIB
, // SqlState = 'IM007'
179 DB_ERR_DIALOG_FAILED
, // SqlState = 'IM008'
180 DB_ERR_UNABLE_TO_LOAD_TRANSLATION_DLL
, // SqlState = 'IM009'
181 DB_ERR_DATA_SOURCE_NAME_TOO_LONG
, // SqlState = 'IM010'
182 DB_ERR_DRIVER_NAME_TOO_LONG
, // SqlState = 'IM011'
183 DB_ERR_DRIVER_KEYWORD_SYNTAX_ERROR
, // SqlState = 'IM012'
184 DB_ERR_TRACE_FILE_ERROR
, // SqlState = 'IM013'
185 DB_ERR_TABLE_OR_VIEW_ALREADY_EXISTS
, // SqlState = 'S0001'
186 DB_ERR_TABLE_NOT_FOUND
, // SqlState = 'S0002'
187 DB_ERR_INDEX_ALREADY_EXISTS
, // SqlState = 'S0011'
188 DB_ERR_INDEX_NOT_FOUND
, // SqlState = 'S0012'
189 DB_ERR_COLUMN_ALREADY_EXISTS
, // SqlState = 'S0021'
190 DB_ERR_COLUMN_NOT_FOUND
, // SqlState = 'S0022'
191 DB_ERR_NO_DEFAULT_FOR_COLUMN
, // SqlState = 'S0023'
192 DB_ERR_GENERAL_ERROR
, // SqlState = 'S1000'
193 DB_ERR_MEMORY_ALLOCATION_FAILURE
, // SqlState = 'S1001'
194 DB_ERR_INVALID_COLUMN_NUMBER
, // SqlState = 'S1002'
195 DB_ERR_PROGRAM_TYPE_OUT_OF_RANGE
, // SqlState = 'S1003'
196 DB_ERR_SQL_DATA_TYPE_OUT_OF_RANGE
, // SqlState = 'S1004'
197 DB_ERR_OPERATION_CANCELLED
, // SqlState = 'S1008'
198 DB_ERR_INVALID_ARGUMENT_VALUE
, // SqlState = 'S1009'
199 DB_ERR_FUNCTION_SEQUENCE_ERROR
, // SqlState = 'S1010'
200 DB_ERR_OPERATION_INVALID_AT_THIS_TIME
, // SqlState = 'S1011'
201 DB_ERR_INVALID_TRANS_OPERATION_CODE
, // SqlState = 'S1012'
202 DB_ERR_NO_CURSOR_NAME_AVAIL
, // SqlState = 'S1015'
203 DB_ERR_INVALID_STR_OR_BUF_LEN
, // SqlState = 'S1090'
204 DB_ERR_DESCRIPTOR_TYPE_OUT_OF_RANGE
, // SqlState = 'S1091'
205 DB_ERR_OPTION_TYPE_OUT_OF_RANGE
, // SqlState = 'S1092'
206 DB_ERR_INVALID_PARAM_NO
, // SqlState = 'S1093'
207 DB_ERR_INVALID_SCALE_VALUE
, // SqlState = 'S1094'
208 DB_ERR_FUNCTION_TYPE_OUT_OF_RANGE
, // SqlState = 'S1095'
209 DB_ERR_INF_TYPE_OUT_OF_RANGE
, // SqlState = 'S1096'
210 DB_ERR_COLUMN_TYPE_OUT_OF_RANGE
, // SqlState = 'S1097'
211 DB_ERR_SCOPE_TYPE_OUT_OF_RANGE
, // SqlState = 'S1098'
212 DB_ERR_NULLABLE_TYPE_OUT_OF_RANGE
, // SqlState = 'S1099'
213 DB_ERR_UNIQUENESS_OPTION_TYPE_OUT_OF_RANGE
, // SqlState = 'S1100'
214 DB_ERR_ACCURACY_OPTION_TYPE_OUT_OF_RANGE
, // SqlState = 'S1101'
215 DB_ERR_DIRECTION_OPTION_OUT_OF_RANGE
, // SqlState = 'S1103'
216 DB_ERR_INVALID_PRECISION_VALUE
, // SqlState = 'S1104'
217 DB_ERR_INVALID_PARAM_TYPE
, // SqlState = 'S1105'
218 DB_ERR_FETCH_TYPE_OUT_OF_RANGE
, // SqlState = 'S1106'
219 DB_ERR_ROW_VALUE_OUT_OF_RANGE
, // SqlState = 'S1107'
220 DB_ERR_CONCURRENCY_OPTION_OUT_OF_RANGE
, // SqlState = 'S1108'
221 DB_ERR_INVALID_CURSOR_POSITION
, // SqlState = 'S1109'
222 DB_ERR_INVALID_DRIVER_COMPLETION
, // SqlState = 'S1110'
223 DB_ERR_INVALID_BOOKMARK_VALUE
, // SqlState = 'S1111'
224 DB_ERR_DRIVER_NOT_CAPABLE
, // SqlState = 'S1C00'
225 DB_ERR_TIMEOUT_EXPIRED
// SqlState = 'S1T00'
232 char Dsn
[SQL_MAX_DSN_LENGTH
+1]; // Data Source Name
233 char Uid
[20+1]; // User ID
234 char AuthStr
[20+1]; // Authorization string (password)
236 char description
[SQL_MAX_DSN_LENGTH
+1]; // Not sure what the max length is
237 char fileType
[SQL_MAX_DSN_LENGTH
+1]; // Not sure what the max length is
239 // Optionals needed for some databases like dBase
240 char defaultDir
[DB_PATH_MAX
]; // Directory that db file resides in
246 char TypeName
[DB_TYPE_NAME_LEN
];
250 // short MinimumScale;
255 class WXDLLEXPORT wxColFor
258 wxString s_Field
; // Formated String for Output
259 wxString s_Format
[7]; // Formated Objects - TIMESTAMP has the biggest (7)
260 wxString s_Menge
[7]; // Formated Objects - amount of things that can be formatted
261 int i_Menge
[7]; // Formated Objects - TT MM YYYY HH MM SS m
262 int i_Nation
; // 0 = timestamp , 1=EU, 2=UK, 3=International, 4=US
263 int i_dbDataType
; // conversion of the 'sqlDataType' to the generic data type used by these classes
269 int Format(int Nation
, int dbDataType
, SWORD sqlDataType
, short columnSize
, short decimalDigits
);
273 class WXDLLEXPORT wxColInf
278 char tableName
[DB_MAX_TABLE_NAME_LEN
+1];
279 char colName
[DB_MAX_COLUMN_NAME_LEN
+1];
281 char typeName
[128+1];
288 int dbDataType
; // conversion of the 'sqlDataType' to the generic data type used by these classes
289 // mj10777.19991224 : new
290 int PkCol
; // Primary key column 0=No; 1= First Key, 2 = Second Key etc.
291 char PkTableName
[DB_MAX_TABLE_NAME_LEN
+1]; // Tables that use this PKey as a FKey
292 int FkCol
; // Foreign key column 0=No; 1= First Key, 2 = Second Key etc.
293 char FkTableName
[DB_MAX_TABLE_NAME_LEN
+1]; // Foreign key table name
294 wxColFor
*pColFor
; // How should this columns be formatted
298 class WXDLLEXPORT wxTableInf
// Description of a Table
301 char tableName
[DB_MAX_TABLE_NAME_LEN
+1];
302 char tableType
[254+1]; // "TABLE" or "SYSTEM TABLE" etc.
303 char tableRemarks
[254+1];
304 int numCols
; // How many Columns does this Table have: GetColumnCount(..);
305 wxColInf
*pColInf
; // pColInf = NULL ; User can later call GetColumns(..);
309 class WXDLLEXPORT wxDbInf
// Description of a Database
314 int numTables
; // How many tables does this database have
315 wxTableInf
*pTableInf
; // pTableInf = new wxTableInf[numTables];
326 // These are the databases currently tested and working with these classes
327 // See the comments in wxDB::Dbms() for exceptions/issues with
328 // each of these database engines
333 dbmsSYBASE_ASA
, // Adaptive Server Anywhere
334 dbmsSYBASE_ASE
, // Adaptive Server Enterprise
344 typedef enum dbms DBMS
;
347 // The wxDB::errorList is copied to this variable when the wxDB object
348 // is closed. This way, the error list is still available after the
349 // database object is closed. This is necessary if the database
350 // connection fails so the calling application can show the operator
351 // why the connection failed. Note: as each wxDB object is closed, it
352 // will overwrite the errors of the previously destroyed wxDB object in
354 extern char DBerrorList
[DB_MAX_ERROR_HISTORY
][DB_MAX_ERROR_MSG_LEN
];
357 // Backward compability for Remstar classes. This
358 // will eventually go away, so the wxColXxxx classes
360 typedef wxColInf CcolInf
;
363 class WXDLLEXPORT wxDB
369 char *dsn
; // Data source name
370 char *uid
; // User ID
371 char *authStr
; // Authorization string (password)
372 FILE *fpSqlLog
; // Sql Log file pointer
373 enum sqlLog sqlLogState
; // On or Off
376 // Private member functions
377 bool getDbInfo(void);
378 bool getDataTypeInfo(SWORD fSqlType
, SqlTypeInfo
&structSQLTypeInfo
);
379 bool setConnectionOptions(void);
380 void logError(const char *errMsg
, const char *SQLState
);
383 // The following structure contains database information gathered from the
384 // datasource when the datasource is first opened.
387 char dbmsName
[40]; // Name of the dbms product
388 char dbmsVer
[64]; // Version # of the dbms product
389 char driverName
[40]; // Driver name
390 char odbcVer
[60]; // ODBC version of the driver
391 char drvMgrOdbcVer
[60]; // ODBC version of the driver manager
392 char driverVer
[60]; // Driver version
393 char serverName
[80]; // Server Name, typically a connect string
394 char databaseName
[128]; // Database filename
395 char outerJoins
[2]; // Indicates whether the data source supports outer joins
396 char procedureSupport
[2]; // Indicates whether the data source supports stored procedures
397 UWORD maxConnections
; // Maximum # of connections the data source supports
398 UWORD maxStmts
; // Maximum # of HSTMTs per HDBC
399 UWORD apiConfLvl
; // ODBC API conformance level
400 UWORD cliConfLvl
; // Indicates whether the data source is SAG compliant
401 UWORD sqlConfLvl
; // SQL conformance level
402 UWORD cursorCommitBehavior
; // Indicates how cursors are affected by a db commit
403 UWORD cursorRollbackBehavior
; // Indicates how cursors are affected by a db rollback
404 UWORD supportNotNullClause
; // Indicates if data source supports NOT NULL clause
405 char supportIEF
[2]; // Integrity Enhancement Facility (Referential Integrity)
406 UDWORD txnIsolation
; // Default transaction isolation level supported by the driver
407 UDWORD txnIsolationOptions
; // Transaction isolation level options available
408 UDWORD fetchDirections
; // Fetch directions supported
409 UDWORD lockTypes
; // Lock types supported in SQLSetPos
410 UDWORD posOperations
; // Position operations supported in SQLSetPos
411 UDWORD posStmts
; // Position statements supported
412 UDWORD scrollConcurrency
; // Concurrency control options supported for scrollable cursors
413 UDWORD scrollOptions
; // Scroll Options supported for scrollable cursors
414 UDWORD staticSensitivity
; // Indicates if additions, deletions and updates can be detected
415 UWORD txnCapable
; // Indicates if the data source supports transactions
416 UDWORD loginTimeout
; // Number seconds to wait for a login request
420 HENV henv
; // ODBC Environment handle
421 HDBC hdbc
; // ODBC DB Connection handle
422 HSTMT hstmt
; // ODBC Statement handle
427 char errorMsg
[SQL_MAX_MESSAGE_LENGTH
];
429 char errorList
[DB_MAX_ERROR_HISTORY
][DB_MAX_ERROR_MSG_LEN
];
432 //Error reporting mode
435 // Number of Ctable objects connected to this db object
436 unsigned int nTables
;
438 // Inf. about logical data types VARCHAR, INTEGER, FLOAT and DATE.
439 // This inf. is obtained from the ODBC driver by use of the
440 // SQLGetTypeInfo() function. The key piece of inf. is the
441 // type name the data source uses for each logical data type.
442 // e.g. VARCHAR; Oracle calls it VARCHAR2.
443 SqlTypeInfo typeInfVarchar
, typeInfInteger
, typeInfFloat
, typeInfDate
;
445 // Public member functions
446 wxDB(HENV
&aHenv
, bool FwdOnlyCursors
=(bool)TRUE
);
447 bool Open(char *Dsn
, char *Uid
, char *AuthStr
); // Data Source Name, User ID, Password
449 bool CommitTrans(void);
450 bool RollbackTrans(void);
451 bool DispAllErrors(HENV aHenv
, HDBC aHdbc
= SQL_NULL_HDBC
, HSTMT aHstmt
= SQL_NULL_HSTMT
);
452 bool GetNextError(HENV aHenv
, HDBC aHdbc
= SQL_NULL_HDBC
, HSTMT aHstmt
= SQL_NULL_HSTMT
);
453 void DispNextError(void);
454 bool CreateView(const char *viewName
, const char *colList
, const char *pSqlStmt
, bool attemptDrop
=TRUE
);
455 bool DropView(const char *viewName
);
456 bool ExecSql(const char *pSqlStmt
);
458 bool GetData(UWORD colNo
, SWORD cType
, PTR pData
, SDWORD maxLen
, SDWORD FAR
*cbReturned
);
459 bool Grant(int privileges
, const char *tableName
, const char *userList
= "PUBLIC");
460 int TranslateSqlState(const char *SQLState
);
461 wxDbInf
*GetCatalog(char *userID
);
462 bool Catalog(const char *userID
=NULL
, const char *fileName
= SQL_CATALOG_FILENAME
);
463 int GetKeyFields(char *tableName
, wxColInf
* colInf
,int nocols
);
464 wxColInf
*GetColumns(char *tableName
[], const char *userID
=NULL
);
465 wxColInf
*GetColumns(char *tableName
, int *numCols
, const char *userID
=NULL
);
466 int GetColumnCount(char *tableName
, const char *userID
=NULL
);
467 char *GetDatabaseName(void) {return dbInf
.dbmsName
;}
468 char *GetDataSource(void) {return dsn
;}
469 char *GetUsername(void) {return uid
;}
470 char *GetPassword(void) {return authStr
;}
471 bool IsOpen(void) {return dbIsOpen
;}
472 HENV
GetHENV(void) {return henv
;}
473 HDBC
GetHDBC(void) {return hdbc
;}
474 HSTMT
GetHSTMT(void) {return hstmt
;}
475 bool TableExists(const char *tableName
, const char *userID
=NULL
, const char *path
=NULL
); // Table name can refer to a table, view, alias or synonym
476 void LogError(const char *errMsg
, const char *SQLState
= 0) {logError(errMsg
, SQLState
);}
477 bool SqlLog(enum sqlLog state
, const char *filename
= SQL_LOG_FILENAME
, bool append
= FALSE
);
478 bool WriteSqlLog(const char *logMsg
);
480 bool FwdOnlyCursors(void) {return fwdOnlyCursors
;}
483 // This structure forms a node in a linked list. The linked list of "DbList" objects
484 // keeps track of allocated database connections. This allows the application to
485 // open more than one database connection through ODBC for multiple transaction support
486 // or for multiple database support.
490 DbList
*PtrPrev
; // Pointer to previous item in the list
491 char Dsn
[SQL_MAX_DSN_LENGTH
+1]; // Data Source Name
492 wxDB
*PtrDb
; // Pointer to the wxDB object
493 bool Free
; // Is item free or in use?
494 DbList
*PtrNext
; // Pointer to next item in the list
499 #include "wx/object.h"
500 class CstructTablesInUse
: public wxObject
503 const char *tableName
;
506 }; // CstructTablesInUse
509 // The following routines allow a user to get new database connections, free them
510 // for other code segments to use, or close all of them when the application has
513 wxDB WXDLLEXPORT
*GetDbConnection(DbStuff
*pDbStuff
, bool FwdOnlyCursors
=(bool)wxODBC_FWD_ONLY_CURSORS
);
514 bool WXDLLEXPORT
FreeDbConnection(wxDB
*pDb
);
515 void WXDLLEXPORT
CloseDbConnections(void);
516 int WXDLLEXPORT
NumberDbConnectionsInUse(void);
519 // This function sets the sql log state for all open wxDB objects
520 bool SqlLog(enum sqlLog state
, const char *filename
= SQL_LOG_FILENAME
);
523 // This routine allows you to query a driver manager
524 // for a list of available datasources. Call this routine
525 // the first time using SQL_FETCH_FIRST. Continue to call it
526 // using SQL_FETCH_NEXT until you've exhausted the list.
527 bool WXDLLEXPORT
GetDataSource(HENV henv
, char *Dsn
, SWORD DsnMax
, char *DsDesc
, SWORD DsDescMax
,
528 UWORD direction
= SQL_FETCH_NEXT
);