Hi All,
Changes on this Version (2025.08.23):
- New: Methods for transaction support: StartTransaction(), Commit() and RollBack().
- New: Use(cDatabase) method. It selects the default database. Useful when connecting without
specifying a database or when working with multiple databases.
- Modified: Demo. Database and needed tables can be created from demo now. Various changes to show new library features.
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:
New(): Object Initialization
Returns: SELF (refers to the instance of the class that is being constructed).
Connect(cServer, cUser, cPassword [, cDatabase]): Connect to a MySql server.
Returns: .T. if connection was successful (.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).
Exec(cCommand): Executes a MySql command.
Returns: .T. if command was successfully executed (.F. otherwise).
Disconnect(): Disconnect from server.
Returns: NIL
CloseAreas(): Close all workareas open with 'Select' method (if any).
Returns: Number of workareas closed.
Insert(cTable, aCols): Insert row. aCols, specifies cColumnname => xData pairs (hash array).
Returns: .T. if command was successfully executed (.F. otherwise).
Delete( cTable, cWhere ): Delete rows based on 'cWhere' condition.
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).
AffectedRows(): Returns the number of rows modified by the last executed
INSERT, UPDATE, or DELETE command.
Destroy(): Set all object variables to NIL, closes all workareas used by
'Select' method (if any) and disconnects.
Returns: NIL
StartTransaction(): Executes 'START TRANSACTION' command.
Commit(): Executes 'COMMIT' command.
RollBack(): Executes 'ROLLBACK' command.
Use(cDatabase): Selects the default database. Useful when connecting without
specifying a database or when working with multiple databases.
VARIABLES:
lError (Read Only): .T. if an error occurred on last operation (.F. otherwise).
cErrorDesc (Read Only): Error description (Empty if no error).
lShowMsgs: Determines if error/progress messages will be shown.
lTrace: When set to .T., a file called 'trace.log' containing last command
executed.
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 '@').
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.
EASY.SQL.2025.08.23
Moderator: Rathinagiri
- Roberto Lopez
- HMG Founder
- Posts: 4022
- Joined: Wed Jul 30, 2008 6:43 pm
EASY.SQL.2025.08.23
- Attachments
-
- hmg.easy.sql.2025.08.23.zip
- (1.71 MiB) Downloaded 25 times
Regards/Saludos,
Roberto
(Veritas Filia Temporis)
Roberto
(Veritas Filia Temporis)
Re: EASY.SQL.2025.08.23
Merci beaucoup ; je vais l'etudier car j'utilise DBF et je voudrais m'initier au aux bases SQL
L'Algerie vous salut
Y.TABET
Y.TABET
- Roberto Lopez
- HMG Founder
- Posts: 4022
- Joined: Wed Jul 30, 2008 6:43 pm
Re: EASY.SQL.2025.08.23
I hope that this library can be useful for you.
Regards/Saludos,
Roberto
(Veritas Filia Temporis)
Roberto
(Veritas Filia Temporis)