4D v16

ODBC_SQLDrivers

Inicio

 
4D v16
ODBC_SQLDrivers

ODBC_SQLDrivers 


 

ODBC_SQLDrivers ( direccion ; driverDescription ; driverAttributes ) -> Resultado 
Parámetro Tipo   Descripción
direccion  Entero largo in Direction from which to retrieve the drivers
driverDescription  Texto in Description of the driver
driverAttributes  Texto in List of driver attribute value pairs
Resultado  Entero largo in Returns the result of the MS ODBC API function SQLDrivers

The ODBC_SQLDrivers command lists driver descriptions and driver attribute keywords.

The direction parameter determines which driver in the Driver Manager list to retrieve and can be one of the following values:

ConstantDescription
SQL_FETCH_NEXTFetch the next driver description in the list
SQL_FETCH_FIRSTFetch from the beginning of the driver description list

driverDescription is the description of the driver, such as "SQL Server", "Microsoft Access Driver (*.mdb)", and "Microsoft ODBC for Oracle".

driverAttributes returns the list of driver attribute pairs, such as "UsageCount", "SQLLevel", "FileUsage", "DirverODBCVer", "ConnectFunctions", "APILevel", "CPTimeout", and "FileExtns" along with their values, such as "UsageCount=2" and each pair is delimited by a Char(0).

For more information, please see the SQLDrivers function in the MS ODBC API Reference at http://msdn.microsoft.com/en-us/library/ms712400(VS.85).aspx.

SQL_SUCCESS, SQL_SUCCESS_WITH_INFO, SQL_NO_DATA, SQL_ERROR, or SQL_INVALID_HANDLE.

Ejemplo  

The following method puts the driver description in one array and the driver's attribute value pairs into two-dimensional arrays:

 ARRAY TEXT(arDriverDesc;0)
 ARRAY TEXT(arAttrName;0;0) `Two-dimensional arrays to store the attribute pairs
 ARRAY TEXT(arAttrValue;0;0)
 $result:=ODBC_SQLDrivers(SQL_FETCH_FIRST;vDriverDesc;vDriverAttrPair)
 If($result=SQL_SUCCESS)
    Repeat
       APPEND TO ARRAY(arDriverDesc;vDriverDesc)
       $size:=Size of array(arDriverDesc)
       INSERT ELEMENT(arAttrName;$size)
       INSERT ELEMENT(arAttrValue;$size)
       ParseDriverAttributePairs(vDriverAttrPair;->arAttrName{$size};->arAttrValue{$size})
       $result:=ODBC_SQLDrivers(SQL_FETCH_NEXT;vDriverDesc;vDriverAttrPair)
    Until($result=SQL_NO_DATA)
 End if

Here is the code for the ParseDriverAttributePairs method:

  ` Method: ParseDriverAttributePairs
  ` $1 : Text : Input text to parse
  ` $2 : Pointer : A text array to hold the names
  ` $3 : Pointer : A text array to hold the values
 
 C_TEXT($1;$input_t;$valuePair_t)
 C_POINTER($2;$3;$names_aptr;$values_aptr)
 C_LONGINT($position_i)
 $input_t:=$1
 $names_aptr:=$2
 $values_aptr:=$3
 ARRAY TEXT($names_aptr->;0)
 ARRAY TEXT($values_aptr->;0)
 Repeat
    $position_i:=Position(Char(0);$input_t)
    If($position_i>0)
       $valuePair_t:=Substring($input_t;1;$position_i)
       $input_t:=Substring($input_t;$position_i+1)
       $position_i:=Position("=";$valuePair_t)
       If($position_i>0)
          APPEND TO ARRAY($names_aptr->;Substring($valuePair_t;1;$position_i-1))
          APPEND TO ARRAY($values_aptr->;Substring($valuePair_t;$position_i+1))
       End if
    End if
 Until($position_i=0)

 
PROPIEDADES 

Producto: 4D
Tema: ODBC_Information
Número 16989

 
HISTORIA 

Creado por: 4D ODBC Pro 2004

 
ARTICLE USAGE

4D ODBC Pro ( 4D v16)