- HDeclareExternal function: Use with the Native Connectors and/or the OLE DB provider
In french: HDéclareExterne
Not available with this kind of connection
Temporarily imports into the current analysis the description of a data file from an existing HFSQL data file. This data file is opened. To no longer use this File Description, call HCancelDeclaration
Use with an OLE DB access or a Native Connector Hide the details
<Result> = HDeclareExternal(<Data file> , <Alias> , <User> [, <Password> [, <Data source> [, <OLE DB provider or Native Connector> [, <Access>]]]])
- True if the operation was performed,
- False if a problem occurs. HErrorInfo is used to identify the error.
<Data file>: Character string
Name of the data file in the external database.
<Alias>: Character string
Logical name of the data file. This name will be used to handle the data file in the current application.
<User>: Character string
Name of the user of the data source.
<Password>: Optional character string
Password of the data file to open (if there is a password).
<Data source>: Optional character string
Full path of the data source.
<OLE DB provider or Native Connector>: Optional character string
Name of the OLE DB provider or one of the following constants:
Caution: To use an OLE DB connection, you must:
|hNativeAccessAS400||Native AS/400 Connector (optional module)|
|hNativeAccessDB2||Native DB2 Connector (optional module)|
|hNativeAccessInformix||Native Informix Connector (optional module)|
|hNativeAccessMariaDB||Native MariaDB Connector (optional module of WINDEV/WEBDEV)|
|hNativeAccessMySQL||Native MySQL Connector (optional module)|
|hNativeAccessOracle||Native Oracle Connector (optional module)|
|hNativeAccessPostgreSQL||Native PostgreSQL Connector (optional module of WINDEV/WEBDEV)|
|hNativeAccessProgress||Native Progress Connector (optional module)|
|hNativeAccessSQLAzure||Native SQL Azure Connector (optional module, supplied with Native SQL Server Connector)|
|hNativeAccessSQLite||Native SQLite Connector|
|hNativeAccessSQLServer||Native SQL Server Connector (optional module)|
|hNativeAccessSybase||Native SYBASE Connector (optional module)|
|hNativeAccessXBase||Native xBase Connector|
|hNativeAccessXML||Native XML Connector|
|hODBC||OLE DB provider for ODBC. Allows you to access an ODBC source declared in the ODBC data sources of Windows|
|hOledbAccess97||OLE DB provider for Access 97|
|hOledbAccess2000||OLE DB provider for Access 2000|
|hOledbAccess2007||OLE DB provider for Access 2007|
|hOledbAccess2010||OLE DB provider for Access 2010|
|hOledbDBase5||OLE DB provider for dBase 5|
|hOledbExcel2000||OLE DB provider for Excel 2000|
|hOledbExcel2007||OLE DB provider for Excel 2007|
|hOledbExcel97||OLE DB provider for Excel 97|
|hOledbLotus4||OLE DB provider for Lotus 4|
|hOledbOracle||OLE DB provider for Oracle|
|hOledbSQLServer||OLE DB provider for SQL Server|
- 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.
<Access>: Optional constant
Configures the type of access to the data file.
|hORead||The data file can be accessed in read-only. You only have the ability to read the records. No record can be added or deleted.|
|The data file can be accessed in read/write. You have the ability to read the records and to write new records.|
- All the HFSQL functions can be used on the imported data file except for the integrity management.
- You can import as many descriptions as necessary.
- This function can be used with data files in XML format.
- The second syntax of this function cannot be used during an access to a database via Remote access.
- To use HDeclareExternal in a stored procedure:
- the relative path of the data file must be specified in relation to the directory of the database containing the stored procedure. The path must include the name and extension of the data file.
- no connection must be used: the current database on which the stored procedure is found will be used.
- By default, if the current project:
- is associated with an analysis, the lock mode applied to the data files is the multi-user mode (the files are not locked when they are opened and they can be accessed by the other applications).
- is not associated with an analysis, the lock mode performed on the data files is the single-user mode: the files are locked in read/write mode as soon as they are opened. This mode prevents the other applications from accessing the files already opened by the current application.
HDeclareExternal function: Use with the Native Connectors and/or the OLE DB provider
By default, the logical name passed to HDeclareExternal is considered as the only name in the table. It is encapsulated by using the encapsulation characters corresponding to the database or specified by the OLE DB provider before being sent to the database (this is used to manage the table names containing special characters).
To provide a file name composed of <Username>.<Table name> (or depending on the database, <Schema name>.<Table name>) in HDeclareExternal, these names must be already formatted (using encapsulation characters corresponding to the database, or specified by the OLE DB provider).
Example for SQLServer:
The encapsulation characters are " ".
To rename CUSTOMER as DBO.CUSTOMER using HDeclareExternal
, you must pass "DBO"."CUSTOMER".
Therefore, the following code must be used:
HDeclareExternal("""DBO"".""CUSTOMER""", dsCustomer, "MyConnection")
This page is also available for…