PC SOFT

ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Home | Sign in | English EN

This content has been translated automatically. Click here to view the French version.
  • Function HDeclareExternal: Use with the Native Connectors and/or the OLE DB provider
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Others
Stored procedures
HDeclareExternal (Function)
In french: HDéclareExterne
ODBCNot 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.
Versions 19 and later
Java This function is now available for Java applications.
New in version 19
Java This function is now available for Java applications.
Java This function is now available for Java applications.
Java This function is available for HFSQL Classic or Client/Server data files only.
Remark: From version 19, HFSQL is the new name of HyperFileSQL.
Reports and QueriesUser code (UMC)Ajax
// Déclaration d'un fichier de données FournisseurWD à partir du chemin complet
// du fichier HFSQL Classic (extension .FIC comprise)
HDeclareExternal("C:\GestCom\Fournisseur.fic", "FournisseurWD")
IF ErrorOccurred = True THEN
// Erreur de déclaration du fichier, on affiche l'erreur
Error(HErrorInfo())
END
Syntax
Reports and QueriesJavaUser code (UMC)AjaxHFSQL

Use with Classic HFSQL files (single-user or multi-user) Hide the details

<Result> = HDeclareExternal(<Full path of HFSQL file> , <Alias> [, <Password>])
<Result>: Boolean
  • True if the operation was performed,
  • False if a problem occurred. HErrorInfo is used to identify the error.
<Full path of HFSQL file>: Character string (with quotes)
Full access path to HFSQL data file whose description will be imported (up to 260 characters). This name must contain the path and extension of data file.
If HDeclareExternal is used in a stored procedure, the file path must be relative to the current database.
<Alias>: Character string (with quotes)
Logical name of data file. This name will be used to handle the data file. This name can also correspond to a Data Source variable.
<Password>: Optional character string (with or without quotes)
  • Password associated with the data file.
  • Empty string ("") if no password is used.
The password is kept if it is specified: there is no need to specify this password again in the next functions for handling the data file.
Reports and QueriesJavaUser code (UMC)AjaxHFSQL Client/ServerOLE DBNative Connectors (Native Accesses)

Use with an OLE DB access, a Native Connector, HFSQL Client/Server and an existing connection Hide the details

<Result> = HDeclareExternal(<Data file> , <Alias> , <Connection>)
<Result>: Boolean
  • True if the operation was performed,
  • False if a problem occurred. HErrorInfo is used to identify the error.
<Data file>: Character string (with quotes)
Name of data file in the external database.
HFSQL Client/Server This parameter corresponds to the physical name of data file, in relation to the database (extension included). Example: "myfile.fic" (or if the database has subdirectories: ".\directory\myfile.fic").
If the data file is password protected, this password must be specified with HPass before using HDeclareExternal.
<Alias>: Character string (with quotes)
Logical name of data file. This name will be used to handle the data file in the current application. This name can also correspond to a Data Source variable.
<Connection>: Character string (with quotes)
Connection to a database. This connection has been defined in the analysis editor or described programmatically with the function HDescribeConnection.
Reports and QueriesUser code (UMC)AjaxOLE DBNative Connectors (Native Accesses)

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>]]]])
<Result>: Boolean
  • True if the operation was performed,
  • False if a problem occurred. HErrorInfo is used to identify the error.
<Data file>: Character string (with quotes)
Name of data file in the external database.
<Alias>: Character string (with quotes)
Logical name of data file. This name will be used to handle the data file in the current application.
<User>: Character string
Name of user of the data source.
<Password>: Optional character string
Password of data file to open (if this password exists).
<Data source>: Optional character string
Full path of data source.
<OLE DB provider or Native Connector>: Optional character string
Name of OLE DB provider or one of the following constants:
hNativeAccessAS400Native AS/400 Connector (optional module)
hNativeAccessDB2Native DB2 Connector (optional module)
hNativeAccessInformixNative Informix Connector (optional module)
Versions 20 and later
hNativeAccessMariaDB
New in version 20
hNativeAccessMariaDB
hNativeAccessMariaDB
Native MariaDB Connector (optional module of WINDEV/WEBDEV)
hNativeAccessMySQLNative MySQL Connector (optional module)
hNativeAccessOracleNative Oracle Connector (optional module)
hNativeAccessPostgreSQLNative PostgreSQL Connector (optional module of WINDEV/WEBDEV)
hNativeAccessProgressNative Progress Connector (optional module)
Versions 16 and later
hNativeAccessSQLAzure
New in version 16
hNativeAccessSQLAzure
hNativeAccessSQLAzure
Native SQL Azure Connector (optional module, supplied with Native SQL Server Connector)
Versions 15 and later
hNativeAccessSQLite
New in version 15
hNativeAccessSQLite
hNativeAccessSQLite
Native SQLite Connector
hNativeAccessSQLServerNative SQL Server Connector (optional module)
hNativeAccessSybaseNative SYBASE Connector (optional module)
hNativeAccessXBaseNative xBase Connector
hNativeAccessXMLNative XML Connector
hODBCOLE DB provider for ODBC. Used to access an ODBC source declared in the ODBC data sources of Windows
hOledbAccess97OLE DB provider for Access 97
hOledbAccess2000OLE DB provider for Access 2000
hOledbAccess2007OLE DB provider for Access 2007
Versions 19 and later
hOledbAccess2010
New in version 19
hOledbAccess2010
hOledbAccess2010
OLE DB provider for Access 2010
hOledbDBase5OLE DB provider for dBase 5
hOledbExcel2000OLE DB provider for Excel 2000
hOledbExcel2007OLE DB provider for Excel 2007
hOledbExcel97OLE DB provider for Excel 97
hOledbLotus4OLE DB provider for Lotus 4
hOledbOracleOLE DB provider for Oracle
hOledbSQLServerOLE DB provider for SQL Server
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.
<Access>: Optional constant
Configures the type of access to the data file.
hOReadWrite
(default value)
The data file can be accessed in read/write. You have the ability to read the records and to write new records.
hOReadThe data file can be accessed in read-only. You only have the ability to read the records. No record can be added or deleted.
Remarks
  • 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.
Reports and QueriesUser code (UMC)AjaxOLE DBNative Connectors (Native Accesses)

Function HDeclareExternal: Use with the Native Connectors and/or the OLE DB provider

By default, the logical name supplied to HDeclareExternal is considered as being the only name of 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 <User name>.<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 change CUSTOMER into DBO.CUSTOMER with HDeclareExternal, you must pass "DBO"."CUSTOMER".
Therefore, the following code must be used:
HDeclareExternal("""DBO"".""CLIENT""", sdClient, "MaConnexion")
Related Examples:
WD External file Training (WINDEV): WD External file
[ + ] This program, powered by WINDEV, explains how to handle files not described in the analysis.
You have the ability ot use the WLanguage functions named HDeclare or HDeclareExternal.
The differences of behavior regarding these two declaration modes of the file are highlighted in this example.
Component: wd260hf.dll
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment