EASYSQL 2024.11.11 (A lot of changes!)
Posted: Mon Nov 11, 2024 7:12 pm
Hi All,
At first, this class must be considered EXPERIMENTAL.
My idea to start this small library, was to have a wrapper for 'Simple SQL Interface' contribution by Mindaugas Kavaliauskas that I've used for many years.
This wrapper should 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
Connect(cServer, cUser, cPassword, cDatabase): Connect to a MySql server.
Select(cCommand,cWorkArea): cCommand must be a MySql SELECT statement.
A recordset is created with the name specified as cWorkArea.
Exec(cCommand): Executes a MySql statement.
Disconnect(): Disconnect from server.
CloseAreas(): Close all workareas open with 'Select' method (if any).
Insert(cTable, aCols): Insert row. aCols, specifies xColumnname => xData pairs.
Delete(cTable, cWhere): Delete rows based on 'cWhere' condition.
Update(cTable,cWhere,aCols): Modify rows based on 'cWhere' condition. aCols, specifies
cColumnname => xData pairs.
AffectedRows(): Returns the number of rows that were modified by the last executed
INSERT, UPDATE, or DELETE
Destroy(): Set all class variables to NIL, closes all workareas created by
'Select' method (if any) and disconnects.
VARIABLES:
lError (Read Only): Returns .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 will be written.
I hope it be util for someone.
At first, this class must be considered EXPERIMENTAL.
My idea to start this small library, was to have a wrapper for 'Simple SQL Interface' contribution by Mindaugas Kavaliauskas that I've used for many years.
This wrapper should 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
Connect(cServer, cUser, cPassword, cDatabase): Connect to a MySql server.
Select(cCommand,cWorkArea): cCommand must be a MySql SELECT statement.
A recordset is created with the name specified as cWorkArea.
Exec(cCommand): Executes a MySql statement.
Disconnect(): Disconnect from server.
CloseAreas(): Close all workareas open with 'Select' method (if any).
Insert(cTable, aCols): Insert row. aCols, specifies xColumnname => xData pairs.
Delete(cTable, cWhere): Delete rows based on 'cWhere' condition.
Update(cTable,cWhere,aCols): Modify rows based on 'cWhere' condition. aCols, specifies
cColumnname => xData pairs.
AffectedRows(): Returns the number of rows that were modified by the last executed
INSERT, UPDATE, or DELETE
Destroy(): Set all class variables to NIL, closes all workareas created by
'Select' method (if any) and disconnects.
VARIABLES:
lError (Read Only): Returns .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 will be written.
I hope it be util for someone.