ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / Developing in PHP
  • Overview
  • Handling the MySQL, Oracle or PostgreSQL data files
  • To handle the MySQL, Oracle or PostgreSQL data files in PHP with the HFSQL functions:
  • Remarks
  • The following functions are currently available in PHP:
  • Handling data files via ODBC
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Others
Stored procedures
Overview
WEBDEV allows you to create a PHP site that handles data files:
  • in MySQL format. This data can be handled by the SQL functions of WLanguage or by the HFSQL functions of WLanguage. A MySQL database is required.
  • via ODBC. This data can be handled by the SQL functions of WLanguage. You have the ability to handle a data source in HFSQL Classic or HFSQL Client/Server format defined in the ODBC administrator.
  • in PostgreSQL format. This data can be handled by the SQL functions of WLanguage or by the HFSQL functions of WLanguage. A PostgreSQL database is required and the php_pgsql extension must be enabled in the php.ini file.
  • in Oracle format. This data can be handled by the SQL functions of WLanguage or by the HFSQL functions of WLanguage. An Oracle database is required, the php_oci8 extension must be enabled in the php.ini file and the Oracle client layer must be found on the server.
Remark: Prerequisite:
  • PHP 5 servers: Minimum recommended version: version 5.6.
  • PHP 7 servers: Minimum recommended version: version 7.0.22.
  • PHP 8 servers: Minimum recommended version: version 8.0.10.
Handling the MySQL, Oracle or PostgreSQL data files

To handle the MySQL, Oracle or PostgreSQL data files in PHP with the HFSQL functions:

The type of the data files described in the project analysis must correspond to the targeted database. The connection to the server is described in the analysis.
If this condition is fulfilled, the data files can be directly handled by the HFSQL functions available in PHP.
The browsing Table controls created in the editor are directly linked to the data files described in the data model editor.

Remarks

  • The use of HFSQL functions on queries with the PHP/MySQL access requires a MySQL server version 4.1 or later.
  • When reading records in a query (with HReadFirst and HReadNext, for example), the query may executed multiple times.
  • The names of the files and items found in the database must contain no accented characters and no space characters.
  • Using queries with parameters: If the SQL code of the query was not entirely generated by the query editor, the name of the query parameters must have the following format: {paramX} where X is the number of the parameter in the order of appearance in the query.
    Example: SELECT LastName, FirstName FROM Customer WHERE LastName={Param1} AND FirstName={Param2}

The following functions are currently available in PHP:

FileToPageAutomatically updates the controls of a page with:
  • the values of the bound items in the current record (loaded in memory) of the data file described in the data model editor. This operation is performed regardless of the state of the controls (grayed, inactive or invisible).
  • the values of the bound WLanguage variables. This operation is performed regardless of the state of the controls (grayed, inactive or invisible).
FileToScreenAutomatically updates the controls in a window or page with:
  • the values of the bound items in the current record (loaded in memory) of the data file described in the data model editor.
  • the values of the bound WLanguage variables.
This operation is performed regardless of the state of the controls (grayed, inactive or invisible).
HActivateFilterEnables the filter that was previously created for the specified data file (view or query).
HAddAdds:
  • the record found in memory into the data file (query or view).
  • the record found in a Record variable into the data file (query or view).
HBackwardMoves backward several records from the current position in the data file, according to a specified item.
HBuildKeyValueBuilds the value of a composite key to implement a filter (HFilter) or to perform a search (HReadSeekFirst, HReadSeekLast, etc.).
HCancelDeclarationUsed to:
HCancelSeekCancels the current search criterion.
HChangeConnectionDynamically changes the connection associated with a data file.
HCloseCloses a data file or all the data files opened by the current user: all the corresponding physical data files are closed for the current user.
HCloseConnectionCloses a connection to a database.
HCreationCreates an empty data file (".FIC" extension) with the index file and the memo file if necessary.
HCreationIfNotFoundPerforms the following operations:
  • If the file does not exist, creates an empty data file (".FIC" file) with the index file and the memo file if necessary. The function is equivalent to HCreation.
  • If the file exists, opens the file.
HDeactivateFilterTemporarily disables the filter on a data file (view or query).
HDeleteDeletes a record from a data file (query or view).
HDescribeConnectionDescribes a new connection to an external database.
HErrorReturns the number of the last error triggered by the HFSQL engine.
HErrorDuplicatesUsed to check whether a duplicate error occurred.
HErrorInfoReturns a detailed information about the last error triggered by the HFSQL engine.
HExecuteQueryDeclares a query created in the query editor to the HFSQL engine and runs this query.
HExecuteSQLQueryInitializes a query written in SQL language and declares this query to the HFSQL engine.
HExtractMemoExtracts the content of a binary memo item from an HFSQL file, a query or an HFSQL view to a physical file (on disk).
HFilterDefines and enables a filter on a data file, view or query.
HFilterIdenticalDefines and enables a filter used to find the exact value of a string item.
HFilterStartsWithDefines and enables a "Start with" filter on a file, view or query.
HForwardMoves several records forward from the current position in the data file, according to a specified item.
HFoundChecks whether the current record corresponds to the current filter or search.
HFreePositionDeletes a position saved by HSavePosition.
HGetCurrentPositionReturns the approximate position of current record in the data file.
HLinkMemoUsed to associate a file with a binary memo item or to cancel the existing link between a file and a binary item.
HListConnectionReturns the list of connections currently described in the application.
HListDatabaseLists the Client/Server databases associated with a connection.
HModifyModifies the specified record or the record found in memory in the data file (query or view).
HNbRecReturns the number of records in a file, query or HFSQL view: active records, crossed records, deleted records, etc.
HOpenOpens a data file.
HOpenConnectionOpens a connection to a specific database.
HOutUsed to find out whether the record on which you want to be positioned is located outside the data file, filter, view or query.
HReadFirstSets the position on the first record according to a browse item.
HReadLastSets the position on the last record of a data file according to a browse item.
HReadNextSets the position on the next data file record according to a browse item.
HReadPreviousSets the position on the previous record of a file according to a browse item.
HReadSeekSets the position on the first record whose value for a specific item is greater than or equal to a sought value (generic search).
HReadSeekFirstSets the position on the first record whose value for a specific item is strictly equal to a sought value (exact-match search).
HReadSeekLastSets the position on the last record whose value for a specific item is less than or equal to a sought value (exact-match search).
HResetInitializes:
  • one or all variables of file items with their default values.
  • one or all items of a Record variable with their default values.
HRestorePositionRestores the context of a previously saved file (HSavePosition): current record, filter, pointers.
HSavePositionStores the current file context: current record, filter, pointers.
ScreenToFileAutomatically updates:
  • the values of a data file's items in memory with the values from the controls in the window.
  • the value of the WLanguage variables with the value of the window controls.
This function is also available for WEBDEV pages.
Handling data files via ODBC
To handle data files via ODBC:
  1. Define an ODBC data source.
    To create a data source on HFSQL Classic or Client/Server files, see ODBC driver on HFSQL Classic and Client/Server.
    Remark: To use the SQL functions in PHP, you must define a "system" ODBC data source (and not a "user" ODBC data source).
  2. Use SQLConnect to connect to the database. In this case, the type of the database is "ODBC".
  3. Use the SQL functions to handle your data.
Minimum version required
  • Version 10
Comments
Click [Add] to post a comment

Last update: 05/24/2023

Send a report | Local help