📄 cvi_db.h
字号:
#define ATTR_DB_USE_COMMAND 1#define ATTR_DB_LOCK_TYPE 2#define ATTR_DB_CURSOR_TYPE 3#define ATTR_DB_COMMAND_TYPE 4#define ATTR_DB_DUMMY_PTR 5#define ATTR_DB_MAX 5#define DB_FAILED_TO_LOAD_DLL -100#define DB_COULD_NOT_FIND_FUNC -101#define DB_COULD_NOT_CREATE_MUTEX -102/* Error constants */#define DB_SMALLER_THAN_COLUMN_WIDTH -99 /* not used */#define DB_ALIAS_NOT_SAVED -98 /* not used */#define DB_STMT_NOT_SAVED -98 /* not used */#define DB_CONNECTION_NOT_SAVED -97 /* not used */#define DB_BETA_EXPIRED -96#define DB_CANT_FIND_ALIAS -94 /* not used */#define DB_CANT_FIND_STMT -94#define DB_CANT_FIND_CONNECTION -93#define DB_CANT_DETERMINE_NUM_RECS -92#define DB_SYNONYM_NOT_SUPPORTED -91#define DB_UNKNOWN_TABLES_FLAG -90#define DB_CANT_FIND_MAP -89#define DB_UNEXPECTED_NULL_PTR -88#define DB_INVALID_ATTRIBUTE -87#define DB_INVALID_COLUMN_NUMBER -86#define DB_UNSUPPORTED_TYPE -85#define DB_CANT_GET_NATIVE_ERROR -84#define DB_INVALID_PARAMETER_ATTRIBUTE -83#define DB_INVALID_COLUMN_ATTRIBUTE -81#define DB_COLUMN_ATTR_READ_ONLY -80#define DB_STMT_ATTR_READ_ONLY -79#define DB_INVALID_STMT_ATTRIBUTE -78#define DB_INVALID_FOR_COMMAND -77#define DB_INVALID_FOR_RECORDSET -76#define DB_REQUIRES_RECORDSET -75#define DB_REQUIRES_COMMAND -74#define DB_CONN_ATTR_READ_ONLY -73#define DB_INVALID_CONN_ATTRIBUTE -72#define DB_FORMAT_ERROR -71#define DB_FORMAT_IGNORE_INCOMPAT -70 /* used internally only */#define DB_FORMAT_IGNORE_NO_DATA_FORMAT -69 /* used internally only */#define DB_START_REC_TOO_BIG -68#define DB_FIELD_NUMBER_TOO_BIG -67#define DB_NOT_ENOUGH_RECORDS -66#define DB_UNSUPPORTED_SOURCE_TYPE -64#define DB_NEGATIVE_SIZE -63#define DB_ALREADY_BOUND -62#define DB_SINGLE_THREAD_INIT_FAILED -61#define DB_ILLEGAL_MULTIPLE_MAP_ACTIVATIONS -60/* These are error codes for the multi-thread critical section stuff */#define DB_CS_OUT_OF_MEMORY -299#define DB_CS_INVALID_PARAMETER -298#define DB_CS_SYSTEM_ERROR -297#define DB_CS_NOT_INIT_OR_DELETED -296#define DB_CS_NOT_OWNED -295#define DB_CS_ALREADY_INIT -294#define DB_ODBC_ERROR -12#define DB_AUTOMATION_ERROR -11 /* Error detected by OLE Automation */#define DB_DBSYS_ERROR -10 /* Error detected by the underlying */ /* database system or driver. */#define DB_LOCK_CHANGE_REC -8 /* Attempt to lock a record and */ /* the lock was obtained, but the */ /* record has been changed since it */ /* was originally read. This can */ /* only occur for DBMSs that require */ /* a log file. */#define DB_LOCK_MULTI_REC -7 /* Attempt to lock a record and */ /* the lock was obtained, but more */ /* than one record was locked. This */ /* occured because the primary key */ /* fields caused more than one */ /* record to be selected. */#define DB_LOCK_NO_REC -6 /* Attempt to lock a record, but */ /* no record in the database was */ /* selected by the primary key, */ /* the record has been deleted by */ /* another user, or another user */ /* has changed the value of a */ /* key field. */#define DB_NO_DATA_CHANGE -9 /* Do not update this column/field */ /* Set the status variable of a */ /* bound variable to this value to */ /* prevent the column/field from */ /* being updated by DBPutRecord */#define DB_LOCK_CHANGE_REC -8 /* Not used */#define DB_LOCK_MULTI_REC -7 /* Not used */#define DB_LOCK_NO_REC -6 /* Not used */#define DB_EOF -5 /* No more records to read. */#define DB_USER_CANCELLED -4 /* User cancelled out of the logon */ /* dialog box. */#define DB_OUT_OF_MEMORY -3 /* Insufficient memory for operation. */#define DB_NULL_DATA -2 /* Null value. Returned as the */ /* length from a qeDataLen call. */#define DB_TRUNCATION -1 /* The buffer passed in to hold */ /* a result is not large */ /* enough to hold the result. */ /* A partial result has been */ /* returned in the buffer. */#define DB_SUCCESS 0 /* Success. */#define DB_SUCCESS_WITH_INFO 1 /* Success with information (warning). */#define DB_NO_DATA_WITH_INFO 2 /* EOF with additional information */ /* (usually ESC during a fetch). */#define DB_LIBSYS_ERROR 5 /* Error that occurs when a library */ /* can't be loaded. Or when the SLM */ /* on the Mac can't be initialized */#define DB_SRC_AVAILABLE 1/* type types for DBTables */#define DB_TBL_TABLE 0x0001#define DB_TBL_VIEW 0x0002#define DB_TBL_PROCEDURE 0x0004#define DB_TBL_SYSTABLE 0x0008#define DB_TBL_SYNONYM 0x0010#define DB_TBL_DATABASE 0x0080#define DB_NO_FLAGS 0x0000#define DB_UNIQUE_INDEXES 0x0001#define DB_ACCURATE_STATS 0x0002#define DB_INDEX_CLUSTERED 1#define DB_INDEX_HASHED 2#define DB_INDEX_OTHER 3#define DB_CASCADE 0#define DB_RESTRICT 1#define DB_SET_NULL 2#ifdef _CVI_#pragma EnableLibraryRuntimeChecking#endif/* connection functions */extern int SQLFUNC DBConnect(char *connectionString);extern int SQLFUNC DBSetAttributeDefaultFromParmInfo(int hdbc, int attribute, va_list parmInfo);extern int SQLCDECL DBSetAttributeDefault(int hdbc, int attribute, ...);extern int SQLFUNC DBDisconnect(int hdbc);extern int SQLFUNC DBSetDatabase(int hdbc, char *database);/* Mapping method functions */extern int SQLFUNC DBBeginMap(int hdbc);extern int SQLFUNC DBMapColumnToChar(int mapHandle, char *colName, unsigned long varMaxLen, char *var, long *varStatus, char *fmt);extern int SQLFUNC DBMapColumnToShort(int mapHandle, char *colName, short *var, long *varStatus);extern int SQLFUNC DBMapColumnToInt(int mapHandle, char *colName, int *var, long *varStatus);extern int SQLFUNC DBMapColumnToFloat(int mapHandle, char *colName,float *var, long *varStatus);extern int SQLFUNC DBMapColumnToDouble(int mapHandle, char *colName, double *var, long *varStatus);extern int SQLFUNC DBMapColumnToBinary(int mapId, char *colName, unsigned long varLen, void *var, long *varStatus);extern int SQLFUNC DBActivateMap(int mapHandle, char *tableName);extern int SQLFUNC DBDeactivateMap(int mapHandle);extern int SQLFUNC DBCreateTableFromMap(int mapHandle, char *tableName);/* Execute SQL statement */extern int SQLFUNC DBActivateSQL(int hdbc, char *sqlStatement);extern int SQLFUNC DBImmediateSQL(int hdbc, char *sqlStatement);/* Bind Columns method functions */extern int SQLFUNC DBBindColChar(int hstmt, int colNum, unsigned long stringSize, char *valPtr, long *varStatus, char *fmt);extern int SQLFUNC DBBindColShort(int hstmt, int colNum, short *valPtr, long *varStatus);extern int SQLFUNC DBBindColInt(int hstmt, int colNum, int *valPtr, long *varStatus);extern int SQLFUNC DBBindColFloat(int hstmt, int colNum, float *valPtr, long *varStatus);extern int SQLFUNC DBBindColDouble(int hstmt, int colNum, double *valPtr, long *varStatus);extern int SQLFUNC DBBindColBinary(int hstmt, int colNum, unsigned long binSize, void* valPtr, long* varStatus);/* direct Get and Put functions */extern int SQLFUNC DBPutColShort(int hstmt, int colNum, short value);extern int SQLFUNC DBPutColFloat(int hstmt, int colNum, float value);extern int SQLFUNC DBPutColDouble(int hstmt, int colNum, double value);extern int SQLFUNC DBPutColInt(int hstmt, int colNum, int value);extern int SQLFUNC DBPutColChar(int hstmt, int colNum, char *valPtr, char* format);extern int SQLFUNC DBPutColNull(int hstmt, int colNum);extern int SQLFUNC DBPutColBinary(int hstmt, int colNum, void* value, unsigned int numBytes);#if ENABLE_VARIANTS extern int SQLFUNC DBPutColVariant(int hstmt, int colNum, VARIANT value);#endifextern int SQLFUNC DBGetColShort(int hstmt, int colNum, short *value);extern int SQLFUNC DBGetColInt(int hstmt, int colNum, int* value);extern int SQLFUNC DBGetColFloat(int hstmt, int colNum, float* value);extern int SQLFUNC DBGetColDouble(int hstmt, int colNum, double* value);extern int SQLFUNC DBGetColChar(int hstmt, int colNum, char **valPtr, char* format);extern int SQLFUNC DBGetColCharBuffer(int hstmt, int colNum, char *buffer, int bufferLen, char* format);extern int SQLFUNC DBGetColBinaryBuffer(int hstmt, int colNum, void* buffer, unsigned int bufferLen);extern int SQLFUNC DBGetColBinary(int hstmt, int colNum, void** value);#if ENABLE_VARIANTS extern int SQLFUNC DBGetColVariant(int hstmt, int colNum, VARIANT* value);#endif/* End Execution of SQL statement (whether started with DBActivateMap *//* or DBActivateSQL. */extern int SQLFUNC DBDeactivateSQL(int hstmt);/* Fetch Functions */extern int SQLFUNC DBFetchNext(int hstmt);extern int SQLFUNC DBFetchPrev(int hstmt);extern int SQLFUNC DBFetchRandom(int hstmt,long recordNumber);extern int SQLFUNC DBAllowFetchAnyDirection(int hdbc, int enable);/* Record operations */extern int SQLFUNC DBCreateRecord(int hstmt);extern int SQLFUNC DBDeleteRecord(int hstmt);extern int SQLFUNC DBPutRecord(int hstmt);extern int SQLFUNC DBCancelRecordChanges(int hstmt);extern int SQLFUNC DBUpdateBatch(int hstmt, tDBAffect affectWhichRecords);/* Information functions */extern int SQLFUNC DBNumberOfRecords(int hstmt);extern int SQLFUNC DBNumberOfModifiedRecords(int hstmt);extern int SQLFUNC DBNumberOfColumns(int hstmt);extern char * SQLFUNC DBColumnName(int hstmt, int columnNumber);extern int SQLFUNC DBColumnType(int hstmt, int columnNumber);extern int SQLFUNC DBColumnWidth(int hstmt, int columnNumber);/* Transactions */extern int SQLFUNC DBBeginTran(int hdbc);extern int SQLFUNC DBCommit(int hdbc);extern int SQLFUNC DBRollback(int hdbc);/* Errors/Warnings */extern int SQLFUNC DBError(void);extern int SQLFUNC DBWarning(void);extern int SQLFUNC DBNativeError(void);extern char * SQLFUNC DBErrorMessage(void);/* information functions */extern int SQLFUNC DBSources(int option);extern int SQLFUNC DBDatabases(int hdbc);extern int SQLFUNC DBTables(int hdbc, char *qualifier_pattern, char *user_pattern, char *table_pattern, int flags);extern int SQLFUNC DBIndexes (int hdbc, char *tableName, short flags);extern int SQLFUNC DBPrimaryKeys (int hdbc, char *tableName);extern int SQLFUNC DBForeignKeys (int hdbc, char *pkTableName, char *fkTableName);#if ENABLE_VARIANTS/* records as an array of variants */extern int SQLFUNC DBGetVariantArray(int hstmt, VARIANT** theArray, unsigned int* numRecs, unsigned int* numFields);extern int SQLFUNC DBGetVariantArrayValue(VARIANT* theArray, unsigned int desiredType, unsigned int numRecs, unsigned int numFields, unsigned int recordNum, unsigned int fieldNum, void* dataValue);extern int SQLFUNC DBGetVariantArrayColumn(VARIANT* theArray, unsigned int numRecs, unsigned int numFields, unsigned int desiredType, unsigned int field, unsigned int startRec, int numRecsToFetch, void* dataValues);extern int SQLFUNC DBFreeVariantArray(VARIANT* theArray, int clearMembers, unsigned int numRecs, unsigned int numFields);extern int SQLFUNC DBOpenSchema(int hdbc, tDBSchemaType schemaType, VARIANT restrictions);#endif/* Parameterised commands */extern int SQLFUNC DBPrepareSQL(int hdbc, char *sqlStatement);extern int SQLFUNC DBRefreshParams(int hstmt);extern int SQLFUNC DBCreateParamInt(int hstmt, char *name, tDBParameterDirection direction, int value);extern int SQLFUNC DBCreateParamShort(int hstmt, char *name, tDBParameterDirection direction, short value);extern int SQLFUNC DBCreateParamFloat(int hstmt, char *name, tDBParameterDirection direction, float value);extern int SQLFUNC DBCreateParamDouble(int hstmt, char *name, tDBParameterDirection direction, double value);extern int SQLFUNC DBCreateParamChar(int hstmt, char *name, tDBParameterDirection direction, char* value, int bufferLen);extern int SQLFUNC DBCreateParamBinary(int hstmt, char *name, tDBParameterDirection direction, void* value, int bufferSize); extern int SQLFUNC DBSetParamInt(int hstmt, int index, int value);extern int SQLFUNC DBSetParamShort(int hstmt, int index, short value);extern int SQLFUNC DBSetParamFloat(int hstmt, int index, float value);extern int SQLFUNC DBSetParamDouble(int hstmt, int index, double value);extern int SQLFUNC DBSetParamChar(int hstmt, int index, char* value, char* format);#if ENABLE_VARIANTS extern int SQLFUNC DBSetParamVariant(int hstmt, int index, VARIANT value);#endifextern int SQLFUNC DBSetParamBinaryBuffer(int hstmt, int index, void* value, unsigned int numBytes);extern int SQLFUNC DBClearParam(int hstmt, int index);extern int SQLFUNC DBGetParamInt(int hstmt, int index, int* value);extern int SQLFUNC DBGetParamShort(int hstmt, int index, short* value);extern int SQLFUNC DBGetParamFloat(int hstmt, int index, float* value);extern int SQLFUNC DBGetParamDouble(int hstmt, int index, double* value);extern int SQLFUNC DBGetParamChar(int hstmt, int index, char** value, char* format);extern int SQLFUNC DBGetParamCharBuffer(int hstmt, int index, char* buffer, int bufferLen, char* format);#if ENABLE_VARIANTS extern int SQLFUNC DBGetParamVariant(int hstmt, int index, VARIANT* value);#endif extern int SQLFUNC DBGetParamBinary(int hstmt, int index, void** value);extern int SQLFUNC DBGetParamBinaryBuffer(int hstmt, int index, void* buffer, unsigned int bufferLen);extern int SQLFUNC DBGetParamAttribute(int hstmt, int index, tDBParamAttr attr, void* value);extern int SQLFUNC DBSetParamAttributeFromParmInfo(int hstmt, int index, int attribute, va_list parmInfo);extern int SQLCDECL DBSetParamAttribute (int hstmt, int index, tDBParamAttr attribute, ...);extern int SQLFUNC DBGetColumnAttribute(int hstmt, int index, tDBColumnAttr attr, void* value);extern int SQLFUNC DBSetColumnAttributeFromParmInfo(int hstmt, int index, int attribute, va_list parmInfo);extern int SQLCDECL DBSetColumnAttribute (int hstmt, int index, tDBColumnAttr attribute, ...);extern int SQLFUNC DBExecutePreparedSQL(int hstmt);extern int SQLFUNC DBClosePreparedSQL(int hstmt);/* Separate new and open statement. Required to set statement attributes */extern int SQLFUNC DBNewSQLStatement(int hdbc, char* sqlStatement);extern int SQLFUNC DBGetStatementAttribute(int hstmt, tDBStatementAttributes attribute, void *value);extern int SQLFUNC DBSetStmtAttributeFromParmInfo(int hstmt, long attribute, va_list parmInfo);extern int SQLCDECL DBSetStatementAttribute(int hstmt, tDBStatementAttributes attribute, ...);extern int SQLFUNC DBOpenSQLStatement(int hstmt);extern int SQLFUNC DBMoreResults(int hstmt);extern int SQLFUNC DBCloseSQLStatement(int hstmt);extern int SQLFUNC DBDiscardSQLStatement(int hstmt);/* Separate new and open connection. Required to set connection attributes */extern int SQLFUNC DBNewConnection(void);extern int SQLFUNC DBOpenConnection(int hdbc);extern int SQLFUNC DBGetConnectionAttribute(int hdbc, tDBConnectionAttr attribute, void *value);extern int SQLFUNC DBSetConnAttributeFromParmInfo(int hdbc, long attribute, va_list parmInfo);extern int SQLCDECL DBSetConnectionAttribute(int hdbc, tDBConnectionAttr attribute, ...);extern int SQLFUNC DBCloseConnection(int hdbc);extern int SQLFUNC DBDiscardConnection(int hdbc);/* Version and compatibility functions */void SQLCDECL DBFree(void *memBlock);extern int SQLFUNC DBGetSQLToolkitVersion(void);extern int SQLFUNC DBSetBackwardCompatibility(int version);extern int SQLFUNC DBInit(int options);/* These functions translate between active X connection, *//* command and recordset objects and SQL Toolkit connection *//* and statement handles. These functions are UNSUPPORTED */typedef int CAObjHandle;/* Get automation object handles from toolkit handles */extern int SQLFUNC DBGetCommandObjAndRecordsetObjFromHStmt(int hstmt, int *commandObj, int *recordsetObj);extern int SQLFUNC DBGetConnectionObjFromHdbc(long hdbc, int* connectionObj);/* Get toolkit handles from automation object handles. If the toolkit *//* handles do not exist, they are created. */extern int SQLFUNC DBConnectionHandleFromConnectionObj(CAObjHandle connectionObj);extern int SQLFUNC DBStatementHandleFromRecordsetObj(CAObjHandle recordsetObj);/* For StatementHandleFromCommandObject, if the command does not have a *//* toolkit handle AND has an associated recordset, you must also supply *//* the recordset object. OTHERWISE you can pass zero as the recordset. */extern int SQLFUNC DBStatementHandleFromCommandObj(CAObjHandle commandObj, CAObjHandle recordsetObj);/* Discard toolkit handles. Use these functions to remove the toolkit *//* handles you create for externally supplied connection, command or *//* recordset objects which will be closed and discarded outside the *//* toolkit. DO NOT call these functions if you use toolkit functions *//* to close or discard the object. */extern int SQLFUNC DBDiscardConnectionHandle(int hdbc);extern int SQLFUNC DBDiscardStatementHandle(int hstmt); extern void SQLFUNC DBDiscardAllObjects(void);#ifdef __cplusplus }#endif#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -