AYUDA EN LÍNEA
 WINDEVWEBDEV Y WINDEV MOBILE

Este contenido se ha traducido automáticamente.  Haga clic aquí  para ver la versión en inglés.
Ayuda / WLanguage / Administrar bases de datos / HFSQL / Funciones HFSQL
  • Syntax 1: Using a character string for the OLE DB provider
  • Syntax 1: Pseudo connection to an HFSQL Classic database
  • Differences between HOpenConnection and HDescribeConnection
  • Using the Native xBase Connector with non-Latin character sets
  • UDL file
  • Native MySQL Connector
WINDEV
WindowsLinuxJavaReportes y ConsultasCódigo de Usuario (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Código Navegador
WINDEV Mobile
AndroidWidget Android iPhone/iPadIOS WidgetApple WatchMac Catalyst
Otros
Procedimientos almacenados
Describes a new connection to an external database. This connection is named. Specific parameters can be defined such as the management mode of cursors (if the accessed database allows it).
To associate this connection with a table or a data file, use HChangeConnection.
To open the connection, use HOpenConnection. If the connection parameters described by HDescribeConnection are incorrect, HOpenConnection will return an error.
With HDescribeConnection, an Oracle table description imported into the analysis can be directly used by HFSQL Classic data files. Simply describe a temporary connection to an HFSQL Classic database and associate it with the file description from in the analysis. For more details, see the Examples.
This function is kept for backward compatibility. We recommend that you use a Connection variable and its properties to describe a connection.
PHP Only the access to a MySQL database, MariaDB database or to an AS/400 database is allowed.
WINDEVWEBDEV - Código ServidorReportes y ConsultasCódigo de Usuario (UMC)AjaxHFSQL Client/ServerOLE DBConectores Nativos
HDescribeConnection("MaConnexion", "", "", ...
	"Serveur_SQLServer", "dbo", hNativeAccessSQLServer, hOReadWrite, "")
Sintaxis

Describing a connection programmatically Ocultar los detalles

<Result> = HDescribeConnection(<Connection> , <User> [, <Password>] , <Data source> , <Database> , <OLE DB provider or Native Connector> [, <Access> [, <Extended information>]] , <Additional options>)
<Result>: Boolean
  • True if the operation was performed,
  • False if a problem occurs. HErrorInfo is used to identify the error.
To establish this connection, use HOpenConnection (this function will return an error if the connection parameters are incorrect).
To assign this connection to a data file, use HChangeConnection.
<Connection>: Character string
Name of new connection to define.
If this name is already used by an existing connection, the former connection is replaced with the new one. The former connection (as well as the data files that used it) are automatically closed.
<User>: Character string
Username used for the database. This parameter is returned by the CtUserName property.
<Password>: Optional character string
Connection password (if this password exists). If no password is required, use an empty string ("") or the NULL keyword.
<Data source>: Character string
Full path of the data source. The connection will be created and opened for this data source. This parameter is returned by the CtDatabase property.
Conectores Nativos XML: This parameter corresponds to the name of the XML file.
HFSQL Client/Server This parameter corresponds to the server name. The port number used by the HFSQL server can be specified. The port 4900 will be used by default. If the port number of the HFSQL server is different, use the following notation:
<Nom du poste>: <Numéro de port>
Example: "ComputerName:4901".
For a use via Internet, the ports must be managed by Firewall. For more details, see Managing ports.
You have the ability to specify an IPv6 address by writing the IPv6 address between square brackets. In this case, the port number must be specified after the closing square bracket. For example: [0154:2145:2155::5554]:4900.
Java Access through JDBC:
  • This parameter corresponds to URL for connecting to the database.
  • Depending on the JDBC driver used, the database name must be specified in the connection URL.
AndroidWidget Android For an Android application:
  • Connection to an HFSQL Client/Server database:
    • The database is located on the development workstation and is manipulated from an Android emulator: use IP address 10.0.2.2 with server port. Example: "10.0.2.2:4900"
    • The database is located on the development workstation's network and is manipulated from an Android emulator: use the server's full name with the domain. Example: "posteServeur@domaine.com:4900" (with the WINDEV Mobile simulator, the machine name without the domain may suffice).
  • Connection to an SQLite database:
    Full path of the file containing the SQLite database on the Android device.
    Example: /sdcard/bdd/MaBaseDeDonnees.db
    If the parameter corresponds to an empty string (""), the file containing the database data will be created in the "databases" directory of application and its name will be identical to the application name followed by the ".db" extension.
<Database>: Character string
Name of database that will be used on the data source, empty string ("") if no name must be specified. This parameter can be used if the data source allows you to specify the database that must be used.
For example, on SQL Server, the "Master" database is the default database but other databases can be handled ("dbo" for example).
To specify that the access is performed on a file found in the "dbo" database (that is not the default database), <Database> must correspond to "dbo".
This parameter is returned by the CtInitialCatalog property.
<OLE DB provider or Native Connector>: Character string or constant
  • Name of OLE DB provider used. To easily retrieve the string to use, select "Connection" in the data model editor (see the Notes).

    or
  • one of the following constants:
    hAccessHF7Pseudo-connection to HFSQL Classic database
    hAccessHFClientServerNative Connector to an HFSQL Client/Server database.
    hNativeAccessAS400Native AS/400 Connector (optional module of WINDEV/WEBDEV)
    hNativeAccessDB2Native DB2 Connector (optional module of WINDEV/WEBDEV)
    hNativeAccessInformixNative Informix Connector (optional module of WINDEV/WEBDEV)
    hNativeAccessMariaDBNative MariaDB Connector (optional module of WINDEV/WEBDEV)
    hNativeAccessMySQLNative MySQL Connector (optional module of WINDEV/WEBDEV)
    hNativeAccessOracleNative Oracle Connector (optional module of WINDEV/WEBDEV)
    hNativeAccessOracleLiteNative Oracle Connector (optional module of WINDEV Mobile)
    hNativeAccessPostgreSQLNative PostgreSQL Connector (optional module of WINDEV/WEBDEV)
    hNativeAccessProgressNative Progress Connector (optional module of WINDEV/WEBDEV)
    hNativeAccessSQLAzureNative SQL Azure Connector (optional module of WINDEV/WEBDEV, provided with the Native SQL Server Connector)
    hNativeAccessSQLiteNative SQLite Connector (provided with WINDEV/WEBDEV)
    hNativeAccessSQLServerNative SQL Server Connector (optional module of WINDEV/WEBDEV).
    The former Native Connector is used by default. To use the new Native SQL Server Connector, use the H.SQLServerMode variable.
    hNativeAccessSQLServerMobileNative SQL Server Mobile Connector (optional module of WINDEV Mobile)
    hNativeAccessSybaseNative Sybase Connector (optional module of WINDEV/WEBDEV)
    hNativeAccessXBaseNative xBase Connector (included with WINDEV/WEBDEV)
    hNativeAccessXMLNative XML Connector (provided with WINDEV/WEBDEV)
    hODBCOLE DB provider for ODBC (used to access an ODBC data source declared in the ODBC data sources of Windows)
    hOledbAccess97OLE DB provider for Access 97
    hOledbAccess2000OLE DB provider for Access 2000
    hOledbDBase5OLE DB provider for dBase 5
    hOledbExcel97OLE DB provider for Excel 97
    hOledbExcel2000OLE DB provider for Excel 2000
    hOledbLotus4OLE DB provider for Lotus 4
    hOledbOracleOLE DB provider for Oracle
    hOledbSQLServerOLE DB provider for SQL Server

    AndroidWidget Android The available constants are as follows:
    hNativeAccessSQLiteNative SQLite Connector from an Android application.

    OLE DB Caution: To use an OLE DB connection, you must:
    • install MDAC version 2.6 or later (setup performed by WINDEV/WEBDEV and when creating the client version)
    • install the OLE DB provider corresponding to the database used.
      This parameter is returned by the CtOLEDBProvider property.

    Java The available constants are as follows:
    hAccessHF7Pseudo-connection to HFSQL Mobile database
    hAccessHFClientServerConnection to an HFSQL Client/Server database
    hAccessJDBCMySQLAccess to MySQL database via JDBC
    hAccessJDBCSQLiteAccess to SQLite database via JDBC
    hAccessJDBCSQLServerAccess to SQL Server database via JDBC

PHP This parameter can correspond to one of the following constants:
hNativeAccessAS400Native AS/400 Connector (optional module of WEBDEV)
hNativeAccessMariaDBNative MariaDB Connector (optional module of WINDEV/WEBDEV)
hNativeAccessMySQLNative MySQL Connector (optional module of WEBDEV)
hNativeAccessOracleNative Oracle Connector (optional module of WEBDEV)
hNativeAccessPostgreSQLNative PostgreSQL Connector (optional module of WEBDEV)
<Access>: Optional constant
Configures the type of access to the database.
hOReadThe database can be accessed in read-only. It is only possible to read records. It is not possible to add or remove records.
hOReadWrite
(default value)
The database can be accessed in read/write. It is possible to read and write new records.

This parameter is returned by the CtAccess property.
PHP This parameter is not available.
Java Access through JDBC: This parameter is ignored.
<Extended information>: Optional character string
Optional information inserted into the string for connecting to the database. If specific keywords are recognized, the corresponding information is extracted from the connection string. The rest of the connection string is sent to the database. Then, the extracted parameters are processed by the Native Connector or by the OLE DB connector used.
These keywords must be indicated as follows: "<Mot-clé> = <Valeur>;".
You can for example specify "Trusted_Connection=YES" in order to use a connection with authentication via the NT login.
OLE DBConectores Nativos The keywords recognized by OLE DB and the Native Connectors are presented in the Optional connection information page.
Example of string to use:
"WD Cache Size = 10000; Server Port=3306;"
HFSQL Client/Server Keywords recognized for the access by HFSQL Client/Server:
COMPRESSIONEnables or disables the compression of data exchanged between Client and Server. This keyword can correspond to:
  • TRUE to enable the data compression.
  • FALSE to disable the data compression.
DB_EXISTChecks the existence of the database. If the specified database does not exist, HDescribeConnection returns False.
ENCRYPTIONEnables the encryption of data exchanged between Client and Server. This keyword can take several values:
  • FAST
  • RC5_16 to use 16-round RC5 encryption.
  • AES128 to use 128-bit AES encryption with the OFB mode of operation.
  • AES192 to use 192-bit AES encryption with the OFB mode of operation.
  • AES256 to use 256-bit AES encryption with the OFB mode of operation.

This parameter is returned by the CtExtendedInfo property.
PHP This parameter is ignored.
Java HFSQL database accessed via RMI server: This parameter corresponds to the RMI server address and port used.. The format to be used is: "RMI=<Adresse du serveur>:<Numéro du port>". For example: "RMI=192.168.52.148:1099".
Java JDBC access: This parameter is mandatory. It must correspond to the full name of JDBC driver to use. This name is case sensitive.
<Additional options>: Constant
If this parameter is not specified, the HFSQL engine automatically defines the best parameters to use according to the database accessed and to the OLE DB provider used.
To force some parameters, you have the ability to combine the following constants:
  • Cursor location
    hClientCursorCursor managed by MDAC. Generally, it offers more features than a server-side cursor. A client-side cursor is always static.
    hServerCursorCursor managed by the database. This cursor can easily reflect changes made to data by other users.
  • Cursor type
    hDynamicCursorThis cursor offers many features, but consumes a lot of memory. This cursor supports all types of scrolling. You can access all insert, update and delete operations made by other users.
    hForwardOnlyCursorThis cursor is fast and consumes little memory. The move is performed from the first record to the last one. Changes made by other users are not visible.
    hOpenKeysetCursorThis cursor handles a fixed set of records. Only the key of each record is stored and not the actual record (consumes less memory). Deleted records cannot be accessed. Changes made by other users are visible (but added records are not).
    hStaticCursorMakes a copy of all query records in memory (high memory consumption). All types of scrolling are supported.
  • Lock mode
    hOptimisticCursorThe record is locked when it is updated
    hPessimisticCursorThe record is locked as soon as it is edited.
    hReadOnlyCursorThe record set manipulated cannot be modified.
Please note: not all OLE DB providers support all cursor types.
This parameter is returned by the CtCursorOptions property.
PHP This parameter is ignored.
WINDEVWEBDEV - Código ServidorCódigo de Usuario (UMC)Ajax

Describing a connection from an ADO connection string Ocultar los detalles

<Result> = HDescribeConnection(<Connection> , <ADO connection string> [, <Access>])
<Result>: Boolean
  • True if the operation was performed,
  • False if a problem occurs. HErrorInfo is used to identify the error.
<Connection>: Character string
Name of new connection to define. If this name is already used by an existing connection, the former connection is replaced with the new one. The former connection (as well as the data files that used it) are automatically closed.
<ADO connection string>: Character string
ADO connection string used. For more details on the syntax of this connection string, see the documentation of the OLE DB provider used.
<Access>: Optional constant
Configures the type of access to the database.
hOReadThe database can be accessed in read-only. It is only possible to read records. It is not possible to add or remove records.
hOReadWrite
(default value)
The database can be accessed in read/write. It is possible to read and write new records.
Observaciones
WINDEVWEBDEV - Código ServidorReportes y ConsultasCódigo de Usuario (UMC)PHPAjaxHFSQL Client/ServerOLE DBConectores Nativos

Syntax 1: Using a character string for the OLE DB provider

To easily find the character string that must be used to define the OLE DB provider, we recommend that you proceed as follows:
  1. In the data model editor, display the connection description window: under the "Análisis" pane, in the "Conexiones" group, click on "Conexiones".
  2. Select the provider to use ("Connect via" combo box).
  3. The character string corresponding to the provider is displayed. This character string can be used to define the OLE DB provider used in <OLE DB provider>.
WINDEVWEBDEV - Código ServidorReportes y ConsultasCódigo de Usuario (UMC)PHPAjaxOLE DBConectores Nativos

Syntax 1: Pseudo connection to an HFSQL Classic database

OLE DB data files or native data files are described in the data model editor. To handle these descriptions through programming with an HFSQL database, simply specify the hAccessHF7 constant as provider name.
Then, this connection can be assigned to the data files affected by HChangeConnection.
The data files in HFSQL format corresponding to the description of the OLE DB or native files will be created (if necessary) in the directory defined by <Data source>. By default, these data files are empty when they are created.

Differences between HOpenConnection and HDescribeConnection

Method 1: To open a connection at the beginning of the application and close it at the end, use the HOpenConnection function.. To use this connection when handling data files or tables, simply change this connection with HChangeConnection.
HOpenConnection(MaConnexion, params) // ouverture de la connexion
HChangeConnection(UnFichier, MaConnexion)
Method 2: To programmatically describe a connection and open it automatically when the data file is opened, simply:
  • describe the connection with HDescribeConnection.
  • associate this connection with the desired data file description using HChangeConnection. The connection will only be opened the first time the data file is accessed.
This solution can be useful when an application handles both HFSQL data files and Oracle data files. For example, if the application uses a single Oracle file for a specific process, the connection to the Oracle database will only be made when necessary.
If the first solution is chosen for the same type of application, the connection (that may take quite a long time) will be established whenever the application is started.
Example:
HDescribeConnection(MaConnexion, params)
HChangeConnection(UnFichier, MaConnexion)
...
HReadFirst(UnFichier) // Ouverture de la connexion
...
HClose(UnFichier) // Fermeture de la connexion
WINDEVWEBDEV - Código ServidorConectores Nativos

Using the Native xBase Connector with non-Latin character sets

To use the Native xBase Connector with non-Latin character sets, a standard OEM/ANSI conversion must be performed by the Native Connector. To do so, the following string must be specified in the extended information:
OEMTOANSI=WINDOWS;
Example:
  1. In the initialization code of the project, add the code used to modify the character set:
    ChangeCharset(charsetChinese)
  2. Create an xBase connection:
    HDescribeConnection("CnxxBase", "", "", fExeDir(), "", hNativeAccessXBase, hOReadWrite, ...
    	"OEMTOANSI=WINDOWS;")
    HChangeConnection("*", "CnxxBase")
WINDEVWEBDEV - Código ServidorReportes y ConsultasCódigo de Usuario (UMC)AjaxOLE DB

UDL file

To create a UDL file:
  1. Create a text file whose extension is "UDL".
  2. Double-click this file. The window for the properties of the data links is opened.
  3. Configure the connection.
  4. Run the test of the connection.
  5. Confirm ("OK" button). The UDL file can now be used.
WINDEVWEBDEV - Código ServidorReportes y ConsultasConectores Nativos

Native MySQL Connector

To get the latest MySQL features (e.g. new default access mode), you need to update the MySQL client library (LibMySQL.DLL file).. For more details, see Native MySQL Connector.
Clasificación Lógica de negocio / UI: Lógica de negocio
Componente: wd300hf.dll
Versión mínima requerida
  • Versión 9
Esta página también está disponible para…
Comentarios
Haga clic en [Agregar] para publicar un comentario

Última modificación: 24/09/2024

Señalar un error o enviar una sugerencia | Ayuda local