ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

This content has been translated automatically.  Click here  to view the French version.
Help / WLanguage / Managing databases / HFSQL / HFSQL functions
  • Multiple changes of directory
  • Changing the name of data file
  • Substituting directories
  • Miscellaneous
WINDEV
WindowsLinuxJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac Catalyst
Others
Stored procedures
  • Changes the access path to a data file (i.e. the directory in which the data file will be manipulated). If the data file is opened when using <Source>.ChangeDir, the data file is automatically closed.
    Reminder: By default, the physical file corresponding to the data file described in the analysis is handled in the directory specified in the analysis.
  • Changes the name of database associated with a table. In this case, the database name specified in the connection properties of table (in the data model editor) is ignored.
    To modify the connection parameters of a data file not in HFSQL format, we recommend that you use HDescribeConnection and <Source>.ChangeConnection.
Example
Reports and QueriesHFSQL ClassicHyper File 5.5
// Création du fichier de données HFSQL Classic Stat dans le répertoire
// "C:\Statistiques\Janvier"
Stat.ChangeDir("C:\Statistiques\Janvier")
Stat.Creation()
Reports and QueriesHFSQL Client/Server
// Création du fichier de données HFSQL Client/Serveur Stat dans le répertoire "\Janvier\"
// Ce répertoire est situé à la racine du dossier 
// de la base de données (connexion HFSQL Client/Serveur)
Stat.ChangeDir(".\Janvier\")
Reports and QueriesOLE DBNative Connectors (Native Accesses)
// Fichier de données associé à une connexion par OLE DB. 
// Remplacement de la base de données à utiliser pour la table "Clients"
Client.ChangeRep("C:\Temp\MaDBTest.mdb")
Client.Création()
// La table "Clients" a été créée dans la base de données "c:\temp\madbtest.mdb"
// La table "Clients" de la base ("c:\temp\madborigine.mdb") n'a pas été modifiée
Syntax

With HFSQL data files Hide the details

<Result> = <Source>.ChangeDir(<New data file path>)
<Result>: Boolean
  • True if the operation was performed,
  • False if a problem occurs. HError is used to identify the error.
<Source>: Type corresponding to the specified source
Logical name of the HFSQL data file defined in the analysis.
<New data file path>: Character string
New access path to the data file (up to 260 characters). This path can contain the name of drive and directories, or it can be a relative path.
If the path is a relative path, the "." (or "?") character is used to specify the current directory and the ".." character is used to specify the parent directory.
If this parameter corresponds to an empty string (""), the data file will be handled in the directory specified in the analysis.
HFSQL Client/Server The access path to the data file must be relative to the database found on the server. You cannot specify a path outside the database. A WLanguage error occurs when attempting to access data files outside the database. For example:
Valid path:
NomFichier.ChangeRep("SOUSREP")
//ou 
NomFichier.ChangeRep(".\SOUSREP")

Invalid path:
NomFichier.ChangeRep("C:\BDD\SOUSREP")

The new path will be automatically created if it is valid and if it does not exist.
Reports and QueriesOLE DBNative Connectors (Native Accesses)

With an OLE DB access or a Native Connector (also called Native Access) Hide the details

<Result> = <Source>.ChangeDir(<New database>)
<Result>: Boolean
  • True if the operation was performed,
  • False if a problem occurs. HError is used to identify the error.
<Source>: Type corresponding to the specified source
Logical name of table (defined in the analysis).
<New database>: Character string
Access path to database to use (up to 260 characters). In this case, the database name specified in the connection properties of table in the analysis is ignored.
This path can contain the name of drive and directories, or it can be a relative path.
If the path is a relative path, the "." (or "?") character is used to specify the current directory and the ".." character is used to specify the parent directory.
Remarks

Multiple changes of directory

<Source>.ChangeDir can be called several times with different parameters. When the path is redefined several times for the same data file, the last specified path replaces all the other ones.

Changing the name of data file

<Source>.ChangeDir can only be used to change the access path to the physical data file. To change the physical name of the data file, use <Source>.ChangeName.

Substituting directories

<Source>.ChangeDir is used to associate a directory with a data file. To replace a directory with another one, use HSubstDir.
Caution: Directory substitution by HSubstDir applies to the directory defined by <Source>.ChangeDir. For example:
HSubstDir("C:\Statistiques\Janvier", "C:\Nouveau\StatJanv")
Stat.ChangeDir("C:\Statistiques\Janvier") 
Stat.Creation() // Fichier de données créé dans le répertoire C:\Nouveau\StatJanv

Miscellaneous

  • If the ".REP" file is used (HSetREP), the new path is saved to the ".REP" file (see management of .REP files).
  • Closing the data file stores the new path but does not store a possible password specified when opening the data file.
  • <Source>.ChangeDir is equivalent to HAssign, available in earlier versions.
  • This function can be used when establishing a connection with an HFSQL server.  Caution: The order of use of functions for connecting to an HFSQL Client/Server database is important.. For more details, see Optimizing the connection times to the HFSQL Client/Server databases.
  • Native Connectors (Native Accesses) <Source>.ChangeDir can be used with the Native XML Connector.
Component: wd300hf.dll
Minimum version required
  • Version 25
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 03/27/2025

Send a report | Local help