AYUDA EN LÍNEA
 WINDEVWEBDEV Y WINDEV MOBILE

Este contenido se ha traducido automáticamente.  Haga clic aquí  para ver la versión en inglés.
Ayuda / Conectores Nativos/Accesos Nativos / Conector Nativo MySQL
  • Overview
  • Programming
  • 1. Establishing the connection
  • 2. Running queries
  • 3. Retrieving the result
  • 4. Closing the connection
WINDEV
WindowsLinuxJavaReportes y ConsultasCódigo de Usuario (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Código Navegador
WINDEV Mobile
AndroidWidget Android iPhone/iPadIOS WidgetApple WatchMac Catalyst
Otros
Procedimientos almacenados
Overview
The SQL functions can be used to handle the MySQL database.
Differences from HFSQL programming: Using SQL functions to manipulate MySQL data does not imply importing the file structure into the analysis.. However, the data must be handled by queries only. The content of MySQL files cannot be read directly.
Programming

1. Establishing the connection

SQLConnect opens a connection to a MySQL database via the Native Connector. The type of database used (MySQL in this case) must be passed as parameter to SQLConnect.
Remark: The name of the MySQL data source (here "BaseMySQL") is the name of the workstation where the database is available or its IP address.. In any case, the name of the "Database" must be specified.
ConnectionNum = SQLConnect("MySQLDatabase", "", "", "", "MySQL")
// or ConnectionNum = SQLConnect("MySQLDatabase", "User", "Password", "MyDatabase", "MySQL")
 
// Connection to a remote MySQL database
ConnectionNum = SQLConnect("192.168.1.51", "User", "Password", "test", "MySQL")

2. Running queries

The queries are run by SQLExec. SQLExec expects the text of the SQL query as parameter, as well as the name that will be given to this query.
SQLExec("SELECT LASTNAME, FIRSTNAME, EXTENSION, PHOTO FROM CUSTOMER", "QRY1")

3. Retrieving the result

Several methods can be used to retrieve the result:
  • SQLFirst: Gets the result and starts an iteration with SQLFirst/SQLCol.
  • SQLTable: Retrieves the result of the query in a Table control populated programmatically in the WINDEV application or WEBDEV website. The result of the query can be retrieved by partial Fetch.
  • SQLFetch: Used to read the different lines of the query result. The iteration over the query result is performed with SQLFetch/SQLGetCol.
SQLLock is used to lock the table records or the records selected by the query. The timeout to lock or modify a locked record is set to 50s by default on MySQL. The database will return an error when the timeout is reached.

4. Closing the connection

SQLClose is used to close the connection to the database once all the necessary queries have been run.
Versión mínima requerida
  • Versión 9
Esta página también está disponible para…
Comentarios
Haga clic en [Agregar] para publicar un comentario

Última modificación: 05/12/2024

Señalar un error o enviar una sugerencia | Ayuda local