|
|
|
|
|
- Overview
- Importing the structure of files
- The import steps
- Take into account changes in the SQLite database
- Programming
- 1. Opening the connection
- 2. Running queries
- 3. Retrieving the result
- 4. Closing the connection
SQLite: Programming with HFSQL functions
Disponible solo con este tipo de conexión
To use an SQLite database with Native Connector (also called Native Access), the structure of SQLite tables must be imported into the data model editor. Differences from SQL programming: To manipulate SQLite data, queries are not mandatory. In fact, you can directly use HFSQL functions to read your data, perform searches, filters and so on. However, you need to import the structure of the SQLite files into the data model editor. 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 "Análisis" tab, in the "Creación" group, expand "Importar" and select "Import file/table descriptions...".
- The wizard starts. A connection to the SQLite database is automatically established and associated with the files imported into the analysis. This connection will have to be used to handle the SQLite data file programmatically.
In the different steps of the wizard, choose the following options: - Database type: SQLite.
- 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 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.
Take into account changes in the SQLite database To take account of changes to tables imported into the data model editor, in the "Análisis" pane, in the "Análisis" group, pull down "Sincronización " 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 SQLite tables.
1. Opening the connection To establish the connection to the SQLite 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 - HEExecuteQuery: executes a predefined query using the query editor.
- HExecuteQuerySQL: allows you to execute a query by directly specifying the query's SQL code, and the name to be allocated to this SQL code.
HExecuteQuery(CUSTOMER_84, "SQLiteDatabase", hQueryWithoutCorrection)
HExecuteSQLQuery(CustomerQry, "SQLiteDatabase", hQueryWithoutCorrection, "SELECT NAME FROM CUSTOMER")
3. Retrieving the result The records cannot be locked by the lock options of these functions. 4. Closing the connection HCloseConnection is used to close the connection to the database once all the necessary queries have been run.
Esta página también está disponible para…
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|