Changes on this Version (2025.08.26):
- New: SetLang(cLangId) method. Set library information messages language.
Useful when you do not want to use default language for messages
(current hb_langselect() setting).
Accepted values for <cLangId> are the following:
'EN' -> English
'ES' -> Spanish
'PT' -> Portuguese
'FR' -> French
'DE' -> German
'IT' -> Italian
'NL' -> Dutch
'SV' -> Swedish
'DA' -> Danish
'FI' -> Finnish
'NO' -> Norwegian
'HU' -> Hungarian
- New: 'lAutoReconnect' variable. When set to .T. (the default) operations that
requires connection to the server, on error, will check if the connection is still alive,
if not, reconnection will be attempted.
One BIG problem when working with some shared AMP hostings, are unexpected
disconnections. So, you could get frequent (and very frustrating)
'MySQL server has gone away' error messages.
To address this, I've added support for automatic handling of reconnections
to the library, so (hopefully) you should not care about this annoyance

- New: IsConnected() method. Returns .T. if the current connection still alive,
.F. if not.
- New: Reconnect() method. Attempts to re-connect using the current parameters.
This class must be considered EXPERIMENTAL.
My idea to start this library, was to have a wrapper for 'Simple SQL Interface' contribution by Mindaugas Kavaliauskas that I've used for many years.
This wrapper aims to have the following features:
- Handle all possible runtime error situations (bad parameters, connection, SQL syntax, etc.).
- Show all required progress information and error messages to the user.
- Handle simultaneous connections in an easy/intuitive way.
This is a very very basic documentation:
METHODS:
AffectedRows(): Returns the number of rows modified by the last executed
INSERT, UPDATE, or DELETE command.
CloseAreas(): Close all workareas open with 'Select' method (if any).
Returns: Number of workareas closed.
Commit(): Executes 'COMMIT' command.
Returns: .T. if command was successfully executed (.F. otherwise).
Connect(cServer, cUser, cPassword [, cDatabase]): Connect to a MySql server.
Returns: .T. if connection was successful (.F. otherwise).
Delete( cTable, cWhere ): Delete rows based on 'cWhere' condition.
Returns: .T. if command was successfully executed (.F. otherwise).
Destroy(): Set all object variables to NIL, closes all workareas used by
'Select' method (if any) and disconnects.
Returns: NIL
Disconnect(): Disconnect from server.
Returns: NIL
Exec(cCommand): Executes a MySql command.
Returns: .T. if command was successfully executed (.F. otherwise).
Insert(cTable, aCols): Insert row. aCols, specifies cColumnname => xData pairs (hash array).
Returns: .T. if command was successfully executed (.F. otherwise).
IsConnected(): Returns .T. if the current connection still alive, .F. if not.
New(): Object Initialization.
Returns: SELF (refers to the instance of the class that is being constructed).
Reconnect(). Attempts to re-connect using the current parameters.
RollBack(): Executes 'ROLLBACK' command.
Returns: .T. if command was successfully executed (.F. otherwise).
Select(cSelect,cWorkArea): cSelect must be a MySql SELECT statement.
A recordset is created with the name specified as cWorkArea.
Returns: .T. if query was successful (.F. otherwise).
StartTransaction(): Executes 'START TRANSACTION' command.
Returns: .T. if command was successfully executed (.F. otherwise).
Update(cTable,cWhere,aCols): Modify rows based on 'cWhere' condition. aCols, specifies
cColumnname => xData pairs (hash array).
Returns: .T. if command was successfully executed (.F. otherwise).
Use(cDatabase): Selects the default database. Useful when connecting without
specifying a database or when working with multiple databases.
Returns: .T. if command was successfully executed (.F. otherwise).
VARIABLES:
cErrorDesc (Read Only): Error description (Empty if no error).
cMsgLang (Read Only): Current language for error/progress messages.
cNoQuoteChar: Set leftmost character indicator to instruct Update and Insert
methods to not quote a character value on aColumns
(cColumnName,xColumnValue) array (default value is '@').
lAutoReconnect: When set to .T. (the default value) operations that requires
connection to the server, will check if the connection still alive, if not,
reconnection will be attempted.
lError (Read Only): .T. if an error occured on last operation (.F. otherwise).
lShowMsgs: Determines if error/progress messages will be shown.
lTrace: When set to .T., a file called 'trace.log' containing last command
executed.
MariaDB:
Last years, for new projects (even local-data ones), I've used portable MariaDB.
It is compact, fast, reliable, secure and requires no installation.
You can download it at https://mariadb.org/download/ and select 'ZIP file' on
'Package Type'. You can unpack it at any place (<base_folder>).
For newer versions, prior to start MariaDB, you must initialize data directory:
<base_folder>\bin\mysql_install_db.exe --datadir=<base_folder>\data
Then you can run MariaDB:
<base_folder>\bin\mysqld.exe.
The default user is root with no password.
Best database utility: HeidiSQL (https://www.heidisql.com/)
I hope this be useful for someone.
Roberto.