Hit-Parade .VB Research Center . Compteur
Accueil ~  Code ~  Programmes ~  Api ~  Forum ~  Cours ~  Livres ~  Quiz ~  Annuaire
~ Edito ~
12/03/2006 @ 13:39
Depuis la dernière mise à jour (qui remonte à... oulala plusieurs mois), un petit ménage de printemps s'impose. Ca tombe bien, c'est presque la période.
Au menu, et progressivement sur les jours à venir, rafraîchissement de plusieurs fonctions et procédures, nouvelles APIs et nouveaux programmes.

~ Rechercher ~

  

~ Annuaire VB ~
 Rechercher un site :
  

~ Partenaires ~

Divers : Fonctions ODBC
La totalité des déclarations des fonctions API pour vos appels ODBC (SQL, Oracle, ...)
Origine : Phil
(Consulté 21780 fois.)

Le module suivant regroupe toutes les fonctions API contenues dans la DLL "ODBC32".
A intégrer tout simplement dans vos projets qui en ont besoin. Pour la plupart vous retrouverez toutes les explications détaillées sur leur utilisation dans la rubrique API sur ce site. Quelques exemples sont même là pour vous guider.
Phil!

Attribute VB_Name = "ODBC32"
'****************************************************************
'** Note de Philippe Plançon : **
'** Information sur les déclarations des constantes, des **
'** types et des API gérant les drivers ODBC (ODBC32.DLL) **
'****************************************************************

'----------------------------------------------------------------
'-- Déclaration des types --
'----------------------------------------------------------------
' Déclaration du type paramètre pour obtenir des informations sur un paramètres
Type ParameterType
    paramaddr
As Long
   
paramtype As Long ' Integer
   
paramsql As Long ' Integer
   
paramlen As Long ' Integer
   
paddrhandle As Long ' Integer
End Type

' Déclaration du type colonne pour obtenir des informations sur une colonne
Type ColDesc
    ColNum
As Long ' Integer
   
ColType As Long ' Integer
   
ColLen As Long
   
RetLen As Long
   
MemAddr As Long
   
MemHandle As Long ' Integer
End Type

'----------------------------------------------------------------
'-- Déclaration des constantes --
'----------------------------------------------------------------
Global Const SQL_SUCCESS = 0
Global Const SQL_SUCCESS_WITH_INFO = 1
Global Const SQL_ERROR = -1
Global Const SQL_NULL_DATA = -1
Global Const SQL_NO_DATA_FOUND = 100
Global Const SQL_INVALID_HANDLE = -2
Global Const SQL_DATA_AT_EXEC = -2
Global Const SQL_NEED_DATA = 99
Global Const SQL_STILL_EXECUTING = 2
Global Const SQL_DRIVER_PROMPT = 2
Global Const SQL_COLUMN_TYPE = 2
Global Const SQL_COLUMN_LENGTH = 3
Global Const SQL_COLUMN_PRECISION = 4
Global Const SQL_COLUMN_SCALE = 5

' Constantes généralement utiles
Global Const SQL_NTS = -3 ' NTS = Le dernier caractère est nul
Global Const SQL_SQLSTATE_SIZE = 5 ' Taille de SQLSTATE
Global Const SQL_MAX_MESSAGE_LENGTH = 512 ' Taille du tampon du message
Global Const SQL_MAX_DSN_LENGTH = 32 ' Taille maximum du nom des données sources

' Pour SQLError
Global Const SQL_NULL_HENV = 0
Global Const SQL_NULL_HDBC = 0
Global Const SQL_NULL_HSTMT = 0

' Pour SQLFreeStmt
Global Const SQL_CLOSE = 0
Global Const SQL_DROP = 1
Global Const SQL_UNBIND = 2
Global Const SQL_RESET_PARAMS = 3

' Pour SQLTransact defines
Global Const SQL_COMMIT = 0
Global Const SQL_ROLLBACK = 1

' SQLSetConnectOption ou SQLGetConnectOption
Global Const SQL_ACCESS_MODE = 101
Global Const SQL_AUTOCOMMIT = 102
Global Const SQL_LOGIN_TIMEOUT = 103
Global Const SQL_OPT_TRACE = 104
Global Const SQL_OPT_TRACEFILE = 105
Global Const SQL_TRANSLATE_DLL = 106
Global Const SQL_TRANSLATE_OPTION = 107
Global Const SQL_TXN_ISOLATION = 108
Global Const SQL_CURRENT_QUALIFIER = 109
Global Const SQL_ODBC_CURSORS = 110
Global Const SQL_CONNECT_OPT_DRVR_START = 1000

' Définition des types de données SQL
Global Const SQL_CHAR = 1
Global Const SQL_NUMERIC = 2
Global Const SQL_DECIMAL = 3
Global Const SQL_INTEGER = 4
Global Const SQL_SMALLINT = 5
Global Const SQL_FLOAT = 6
Global Const SQL_REAL = 7
Global Const SQL_DOUBLE = 8
Global Const SQL_VARCHAR = 12
Global Const SQL_DATE = 9
Global Const SQL_TIME = 10
Global Const SQL_TIMESTAMP = 11
Global Const SQL_LONGVARCHAR = -1
Global Const SQL_BINARY = -2
Global Const SQL_BIGINT = -5
Global Const SQL_TINYINT = -6
Global Const SQL_BIT = -7

' Définition des types de données SQL_C
Global Const SQL_C_DEFAULT = 99
Global Const SQL_C_CHAR = 1
Global Const SQL_C_LONG = 4
Global Const SQL_C_SHORT = 5
Global Const SQL_C_FLOAT = 7
Global Const SQL_C_DOUBLE = 8

' SQLSetScrollOptions
Global Const SQL_CONCUR_READ_ONLY = 1
Global Const SQL_CONCUR_LOCK = 2
Global Const SQL_CONCUR_TIMESTAMP = 3
Global Const SQL_CONCUR_VALUES = 4
Global Const SQL_CONCURRENCY = 7
Global Const SQL_SCROLL_FORWARD_ONLY = 0
Global Const SQL_SCROLL_KEYSET_DRIVEN = -1
Global Const SQL_SCROLL_DYNAMIC = -2
Global Const SQL_SCROLL_STATIC = -3

' SQLExtendedFetch : Valeurs "fFetchType"
Global Const SQL_FETCH_NEXT = 1
Global Const SQL_FETCH_FIRST = 2
Global Const SQL_FETCH_LAST = 3
Global Const SQL_FETCH_PREV = 4
Global Const SQL_FETCH_ABSOLUTE = 5
Global Const SQL_FETCH_RELATIVE = 6
Global Const SQL_FETCH_RESUME = 7

' SQLProcedureColumns
Global Const SQL_PARAM_TYPE_UNKNOWN = 0
Global Const SQL_PARAM_INPUT = 1
Global Const SQL_PARAM_INPUT_OUTPUT = 2
Global Const SQL_RESULT_COL = 3
Global Const SQL_PARAM_OUTPUT = 4

'----------------------------------------------------------------
'-- Déclaration des API --
'----------------------------------------------------------------

' Définition des fonctions d'environnement
Declare Function SQLAllocEnv Lib "odbc32" (env As Long) As Long
Declare Function
SQLFreeEnv Lib "odbc32" (ByVal env As Long) As Long
Declare Function
SQLSetConnectOption Lib "odbc32" (ByVal HDBC As Long, ByVal foption As Long, ByVal vparam As Long) As Long
Declare Function
SQLSetStmtOption Lib "odbc32" (ByVal HDBC As Long, ByVal foption As Long, ByVal vparam As Long) As Long

' Définition des fonctions de connections
Declare Function SQLAllocConnect Lib "odbc32" (ByVal env As Long, HDBC As Long) As Long
Declare Function
SQLConnect Lib "odbc32" (ByVal HDBC As Long, ByVal Server As String, ByVal serverlen As Long, ByVal uid As String, ByVal uidlen As Long, ByVal pwd As String, ByVal pwdlen As Long) As Long
Declare Function
SQLDriverConnect Lib "odbc32" (ByVal HDBC As Long, ByVal hwnd As Long, ByVal szCSIn As String, ByVal cbCSIn As Long, ByVal szCSOut As String, ByVal cbCSMax As Long, cbCSOut As Long, ByVal fDriverCompletion As Long) As Long
Declare Function
SQLFreeConnect Lib "odbc32" (ByVal HDBC As Long) As Long
Declare Function
SQLDisconnect Lib "odbc32" (ByVal HDBC As Long) As Long

' Définition des fonctions d'allocations
Declare Function SQLAllocStmt Lib "odbc32" (ByVal HDBC As Long, hstmt As Long) As Long
Declare Function
SQLFreeStmt Lib "odbc32" (ByVal hstmt As Long, ByVal EndOption As Long) As Long

' Définition des fonctions de d'extractions ou de paramètrages des données
Declare Function SQLPrepare Lib "odbc32" (ByVal hstmt As Long, ByVal SQLString As String, ByVal sqlstrlen As Long) As Long
Declare Function
SQLNumParams Lib "odbc32" (ByVal hstmt As Long, pcPar As Long) As Long
Declare Function
SQLBindCol Lib "odbc32" (ByVal hstmt As Long, ByVal icol As Long, ByVal fCtype As Long, rgbValue As Any, ByVal cbValueMax As Long, pcbValue As Long) As Long
Declare Function
SQLBindParameter Lib "odbc32" (ByVal hstmt As Long, ByVal ipar As Long, ByVal fParamType As Long, ByVal fCtype As Long, ByVal fSqlType As Long, ByVal cbColDef As Long, ByVal ibScale As Long, rgbValue As Any, ByVal pcbValueMax As Long, pcbValue As Long) As Long
Declare Function
SQLSetPos Lib "odbc32" (ByVal hstmt As Long, ByVal irow As Long, ByVal fRefresh As Long, ByVal fLock As Long) As Long
Declare Function
SQLExecute Lib "odbc32" (ByVal hstmt As Long) As Long
Declare Function
SQLExecDirect Lib "odbc32" (ByVal hstmt As Long, ByVal SQLString As String, ByVal sqlstrlen As Long) As Long
Declare Function
SQLNumResultCols Lib "odbc32" (ByVal hstmt As Long, NumCols As Long) As Long
Declare Function
SQLColAttributes Lib "odbc32" (ByVal hstmt As Long, ByVal icol As Long, ByVal fDescType As Long, ByVal rgbDesc As Long, ByVal cbDescMax As Long, pcbDesc As Long, pfDesc As Long) As Long
Declare Function
SQLExtendedFetch Lib "odbc32" (ByVal hstmt As Long, ByVal fFetchType As Long, ByVal irow As Long, pcrow As Long, rgfRowStatus As Long) As Long
Declare Function
SQLFetch Lib "odbc32" (ByVal hstmt As Long) As Long
Declare Function
SQLGetData Lib "odbc32" (ByVal hstmt As Long, ByVal col As Long, ByVal fConvType As Long, ByVal rgbValue As Any, ByVal cbValueMax As Long, pcbValue As Long) As Long
Declare Function
SQLGetInfo Lib "odbc32" (ByVal HDBC As Long, ByVal hwnd As Long, ByVal szInfo As String, ByVal cbInfoMax As Long, cbInfoOut As Long) As Long
Declare Function
SQLGetCursorName Lib "odbc32" (ByVal hstmt As Long, ByVal cursor As String, ByVal cbCursorMax As Long, cbCursor As Long) As Long
Declare Function
SQLSetCursorName Lib "odbc32" (ByVal hstmt As Long, ByVal cursor As String, ByVal cbCursor As Long) As Long
Declare Function
SQLSetScrollOptions Lib "odbc32" (ByVal hstmt As Long, ByVal fConcurrency As Long, ByVal crowKeyset As Long, ByVal crowRowset As Long) As Long
Declare Function
SQLParamOptions Lib "odbc32" (ByVal hstmt As Long, ByVal crow As Long, pirow As Long) As Long
Declare Function
SQLParamData Lib "odbc32" (ByVal hstmt As Long, prgbValue As Long) As Long
Declare Function
SQLPutData Lib "odbc32" (ByVal hstmt As Long, rgbValue As Any, ByVal cbValue As Long) As Long
Declare Function
SQLError Lib "odbc32" (ByVal env As Long, ByVal HDBC As Long, ByVal hstmt As Long, ByVal SQLSTATE As String, NativeError As Long, ByVal buffer As String, ByVal Buflen As Long, Outlen As Long) As Long
Declare Function
SQLMoreResults Lib "odbc32" (ByVal hstmt As Long) As Long
Declare Function
SQLRowCount Lib "odbc32.dll" (ByVal hstmt As Long, pcrow As Long) As Long
Declare Function
SQLTransact Lib "odbc32" (ByVal env As Long, ByVal HDBC As Long, ByVal ftype As Long) As Long
Declare Function
SQLTables Lib "odbc32.dll" (ByVal hstmt As Long, ByVal q As Long, ByVal cbq As Long, ByVal o As Long, ByVal cbo As Long, ByVal t As Long, ByVal cbt As Long, ByVal tt As Long, ByVal cbtt As Long) As Long
Declare Function
SQLDescribeCol Lib "odbc32.dll" (ByVal hstmt As Long, ByVal ColNum As Long, ByVal colname As String, ByVal Buflen As Long, colnamelen As Long, dtype As Long, dl As Long, ds As Long, n As Long) As Long


Visual Basic Research Center - (c) 2000/2002 -  Webmaster : docvb (chez) free (point) fr