ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / Native Connectors/Native Accesses / Native Sybase Connector
  • Overview
  • Importing the structure of files
  • The import steps
  • Taking into account the evolutions of the Sybase database
  • Programming
  • 1. Establishing the connection
  • 2. Running queries
  • 3. Retrieving the result
  • 4. Closing the connection
  • Optimization
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
Native Sybase Connector: Programming with HFSQL functions
Native Connectors (Native Accesses)Available only with this kind of connection
Overview
To use a Sybase database with Native Connector, the structure of Sybase tables must be imported into the WINDEV or WEBDEV analysis.
Differences compared to SQL programming: The queries are not required to handle the Sybase data. Indeed, the HFSQL functions can be directly used to read data, perform searches, implement filters, ... However, the structure of Sybase files must be imported into the WINDEV or WEBDEV analysis.
Importing the structure of files

The import steps

To perform this import:
  1. Start the data model editor: click Load project analysis in the quick access buttons.
  2. On the "Analysis" tab, in the "Creation" group, expand "Import" and select "Import file/table descriptions...".
  3. The wizard starts. A connection to the Sybase database is automatically established and it is associated with the files imported into the analysis. This connection will be used to handle the Sybase data file by programming.
In the different steps of the wizard, choose the following options:
  • Type of database: Sybase.
  • Characteristics of the connection: 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 or WEBDEV analysis. These tables can be handled through programming with the HFSQL functions of WLanguage. These tables will be displayed in blue in the data model editor.

Taking into account the evolutions of the Sybase database

To take into account the evolutions of the tables imported into the data model editor, go to the "Analysis" tab, "Analysis" group, expand "Synchronization" and select "Update analysis from external databases".
A wizard starts, allowing you to:
  • analyze the differences for the imported tables.
  • analyze the differences for all the Sybase tables.
Programming

1. Establishing the connection

To establish the connection to the Sybase 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 try to read the file directly (HReadFirst, ...), the connection associated with the file description in the analysis will be automatically opened.

2. Running queries

HExecuteQuery and HExecuteSQLQuery are used to run queries on the current database.
  • HExecuteQuery: is used to run a preset query with the query editor.
  • 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.
    // Initialize the "Customer_84" query
    HExecuteQuery(CUSTOMER_84, "SybaseDatabase", hQueryWithoutCorrection)
    HExecuteSQLQuery(CustomerQry, "SybaseDatabase", hQueryWithoutCorrection, ...
    "SELECT NAME FROM CUSTOMER")

3. Retrieving the result

The result is browsed by the standard read functions: HReadFirst, HReadNext, HReadSeek, ...
Remark: The hLockWrite and hLockReadWrite constants are ignored. Indeed, the read and/or write locks are not supported by the Native Connector.

4. Closing the connection

HCloseConnection is used to close the connection to the database once all the necessary queries have been run.

Optimization

  • The "Browsing table" controls based on queries are optimized: the content of the Table control can be sorted by clicking one of its columns.
  • To avoid re-running the same query several times when browsing its result, we advise you to use the hNoRefresh constant (if the data is modified by a single computer for example).
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 05/26/2022

Send a report | Local help