|
|
|
|
|
- Overview
- Configuring the ODBC administrator
- Remark
- Importing the structure of files
- The import steps
- Taking into account the evolution of the Progress database
- Programming
- 1. Establishing the connection
- 2. Running queries
- 3. Retrieving the result
- 4. Closing the connection
Progress Native Connector: Programming with HFSQL functions
Available only with this kind of connection
To use a Progress database with the Native Connector (also called "Native Access"), you must: - Configure the ODBC administrator.
- Import the structure of Progress tables into the WINDEV or WEBDEV analysis.
Differences from SQL programming: To manipulate Progress data, queries are not mandatory. In fact, you can directly use HFSQL functions to read your data, perform searches and filters, etc. However, you need to import the Progress file structure into WINDEV or WEBDEV. Configuring the ODBC administrator To configure the ODBC administrator: - Start the ODBC data administrator (ODBCAD32.EXE) on your computer. To do so, select "Start .. Run" from Windows and type "ODBCAD32.EXE".
- Select the "User database" tab.
- Click the "Add" button.
- Select the ODBC driver for Progress (installed with the client version of Progress).
- Click "Finish".
- Enter the name of the Progress data source. This name will be used to identify the Progress database in your WINDEV programs or in your WEBDEV websites.
- Confirm ("OK" button).
Remark You have the ability to connect to a Progress database without declaring the ODBC source. In this case, all the connection parameters must be supplied by HOpenConnection. For example, to access the "sports" database located on the "Mars" server, using the "srv_sports" service, the syntax of HOpenConnection becomes:
ctProgress is Connection
ctProgress.Server = "Mars"
ctProgress.Database = "Sports"
ctProgress.User = "sysprogress"
ctProgress.Password = "xxxx"
ctProgress.Provider = hNativeAccessProgress
ctProgress.ExtendedInfo = "PORT=srv_sports"
IF NOT HOpenConnection(ctProgress) THEN
Error("Failure connecting to the database", HErrorInfo())
EndProgram()
END
Importing the structure of files The import steps To perform this import: - Launch the data model editor: click on
among the quick access buttons. - On the "Analysis" tab, in the "Creation" group, expand "Import" and select "Import file/table descriptions...".
- The wizard starts. A connection to the Progress database is automatically established and associated with the files imported into the analysis. This connection will be used to handle the Progress data file programmatically.
In the different steps of the wizard, choose the following options: - Database type: Progress.
- Connection features: Data server, User and password, Database.
- The application will access the data in the current format.
- When the connection is established, all you have to do is select the tables that will be imported into the WINDEV/WEBDEV analysis. These tables can be manipulated programmatically using the HyperFileSQL functions in the WLanguage. These tables will be displayed in blue in the data model editor.
If an ODBC source was defined, there is no need to specify all the parameters in the connection (only the data source defined in the ODBC administrator is required). If no ODBC source was defined, you must enter all the parameters in the connection: - Database,
- Number or name of service onto which the database will answer. This information must be entered in the advanced parameters of the connection (extended information), ...
Taking into account the evolution of the Progress database To take account of changes to tables imported into the data model editor, in the "Analysis" pane, in the "Analysis" group, pull down "Synchronization" and select "Update analysis from external databases". A wizard starts, allowing you to: - analyze the differences for the imported tables only.
- analyze the differences for all the Progress tables.
1. Establishing the connection To establish the connection to the Progress database, use HOpenConnection and specify the name of the connection to open. The connection name was defined when importing the structure of files into the analysis. To modify some parameters of this connection (username or password for example), call HConnect. Remark: If you attempt to read the file directly (function HReadFirst, ...), the connection associated with the file description in the analysis will be automatically opened. 2. Running queries - HExecuteQuery: is used to run a preset query with the query editor of WINDEV and WEBDEV.
- HExecuteSQLQuery: is used to run a query by specifying the SQL code of the query and the name that will be assigned to this SQL code.
HExecuteQuery(CUSTOMER_84, "MyProgressDatabase")
HExecuteSQLQuery(QryCustomer, "MyProgressDatabase", hQueryWithoutCorrection, ...
"SELECT NAME FROM CUSTOMER")
4. Closing the connection HCloseConnection is used to close the connection to the database once all the necessary queries have been run.
This page is also available for…
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|