*08. September 2010, 16:52:02
Welcome, Guest. Please login or register.
08. September 2010, 16:52:02

Login with username, password and session length
857 Posts in 351 Topics by 54 Members - Latest Member: Elias Montoya

Please do not more post here, but use the NEW FORUM:

IT-Consultant-Forum NEW
Search:     Advanced search
IT-Consultant-Forum (IT-Berater)
* Home Help Search Calendar Login Register
0 Members and 1 Guest are viewing this topic. « previous next »
Pages: [1] Go Down Print
Author Topic: SQLDrivers Function  (Read 753 times)
José Roca
Administrator
Hero Member
*****

Forum Reputation: +17/-0
Offline Offline

Gender: Male
Posts: 630



WWW
« on: 14. September 2006, 09:06:21 »

 
SQLDrivers lists driver descriptions and driver attribute keywords. This function is implemented solely by the Driver Manager.

Code:
' ****************************************************************************************
' Example of use of the ODBC raw API functions
' SED_PBCC  -  Use the PBCC compiler
' ****************************************************************************************

#COMPILE EXE
#INCLUDE "ODBCAPI352.INC"

' ========================================================================================
' Main
' ========================================================================================
FUNCTION PBMAIN

   LOCAL r AS INTEGER
   LOCAL hEnv AS DWORD
   LOCAL wDirection AS WORD
   LOCAL DriverAttributes AS STRING * 255
   LOCAL szDriverDescription AS ASCIIZ * 255  ' Driver description
   LOCAL cbDriverDescriptionLen AS INTEGER    ' Driver description total length
   LOCAL szDriverAttributes AS ASCIIZ * 255   ' Driver attributes
   LOCAL cbDriverAttributesLen AS INTEGER     ' Driver attributes total length

   ' Allocates the environment handle
   r = SQLAllocHandle (%SQL_HANDLE_ENV, %SQL_NULL_HENV, hEnv)
   IF ISFALSE SQL_SUCCEEDED(r) OR ISFALSE hEnv THEN EXIT FUNCTION

   ' Tells to the driver manager that is an application that uses the ODBC driver 3.x
   r = SQLSetEnvAttr (hEnv, %SQL_ATTR_ODBC_VERSION, BYVAL %SQL_OV_ODBC3, %SQL_IS_INTEGER)
   IF ISFALSE SQL_SUCCEEDED(r) THEN GOTO Terminate

   wDirection = %SQL_FETCH_FIRST
   DO
      DriverAttributes = ""
      r = SQLDrivers(hEnv, wDirection, szDriverDescription, SIZEOF(szDriverDescription), _
                     cbDriverDescriptionLen, BYVAL VARPTR(DriverAttributes), LEN(DriverAttributes), cbDriverAttributesLen)
      IF r = %SQL_NO_DATA THEN EXIT DO
      IF ISFALSE SQL_SUCCEEDED(r) THEN
         STDOUT SQLGetErrorInfo(%SQL_HANDLE_ENV, hEnv, r)
         EXIT DO
      END IF
      REPLACE CHR$(0,0) WITH ";" IN DriverAttributes
      REPLACE ANY CHR$(0) WITH ";" IN DriverAttributes
      szDriverAttributes = TRIM$(DriverAttributes)
      PRINT "----------------------"
      PRINT "Driver description: " szDriverDescription
      PRINT "Server description len: " cbDriverDescriptionLen
      PRINT "Driver attributes: " szDriverAttributes
      PRINT "Driver attributes len: " cbDriverAttributesLen
      PRINT LEN(szDriverAttributes)
      PRINT "----------------------"
      wDirection = %SQL_FETCH_NEXT
      WAITKEY$
   LOOP

Terminate:

   ' Frees the environment handle
   IF hEnv THEN SQLFreeHandle(%SQL_HANDLE_ENV, hEnv)

   WAITKEY$

END FUNCTION
' ========================================================================================
Logged
Pages: [1] Go Up Print
« previous next »
Jump to:  

Powered by MySQL Powered by PHP IT-Consultant-Forum (IT-Berater) | Powered by SMF 1.1 RC2.
© 2001-2005, Lewis Media. All Rights Reserved.

Themis design by Bloc
Valid XHTML 1.0! Valid CSS!
Page created in 0.089 seconds with 22 queries.