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 table
  • 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 table (i.e. the directory in which the table will be manipulated). If the table is opened when using <Source>.ChangeDir, the table is automatically closed.
    Reminder: By default, the physical file corresponding to the table described in the database schema is handled in the directory specified in the database schema.
  • 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 table not in HFSQL format, we recommend that you use HDescribeConnection and <Source>.ChangeConnection.
Example
WEBDEV - Server codeAjaxHFSQL ClassicHyper File 5.5
// Create the HFSQL Classic Stat table in
// "C:\Statistics\January"
Stat.ChangeDir("C:\Statistics\January")
Stat.Creation()
WEBDEV - Server codeAjaxHFSQL Client/Server
// Create the HFSQL Client/Server Stat table in "\January\"
// This directory is at the root 
// of database folder (HFSQL Client/Server connection)
Stat.ChangeDir(".\January\")
WEBDEV - Server codeAjaxOLE DBNative Connectors (Native Accesses)
// Table associated with a connection by OLE DB. 
// Replace the database that will be used for the "Customers" table
Customer.ChangeDir("C:\Temp\MyTestDB.mdb")
Customer.Creation()
// The "Customers" table was created in the "c:\temp\mytestdb.mdb" database
// The "Customers" table of database ("c:\temp\myinitialdb.mdb") was not modified
Syntax

With HFSQL tables Hide the details

<Result> = <Source>.ChangeDir(<New table 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 table defined in the database schema.
<New table path>: Character string
New access path to the table (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 table will be handled in the directory specified in the database schema.
HFSQL Client/Server The access path to the table must be relative to the database schema found on the server. You cannot specify a path outside the database. A WLanguage error occurs when attempting to access tables outside the database. For example:
Valid path:
FileName.ChangeDir("SUBDIR")
//or 
FileName.ChangeDir(".\SUBDIR")

Invalid path:
FileName.ChangeDir("C:\DB\SUBDIR")

The new path will be automatically created if it is valid and if it does not exist.
WEBDEV - Server codeAjaxOLE 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 database schema).
<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 database schema 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 table, the last specified path replaces all the other ones.

Changing the name of table

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

Substituting directories

<Source>.ChangeDir is used to associate a directory with a table. 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:\Statistics\January", "C:\New\JanStats")
Stat.ChangeDir("C:\Statistics\January") 
Stat.Creation // Table created in C:\New\JanStats

Miscellaneous

  • If the ".REP" file is used (HSetREP), the new path is saved to the ".REP" file (see management of .REP files).
  • Closing the table stores the new path but does not store a possible password specified when opening the table.
  • <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