Using MySQL from Hyperlambda
This is the MySQL data adapter for Magic. This project allows you to provide a semantic lambda structure to its slots, which in turn will dynamically create a MySQL dialect SQL statement for you, for all basic types of CRUD SQL statements. In addition, it provides slots to open a MySQL database connection, and such allows you to declare your own SQL statements to be executed towards a MySQL database. Slots this project contains are as follows.
- [mysql.connect] - Connects to a database
- [mysql.create] - Creates a single record in the specified table
- [mysql.read] - Reads multiple records from the specified table
- [mysql.update] - Updates a single record in the specified table
- [mysql.delete] - Deletes a single record in the specified table
- [mysql.select] - Executes an arbitrary SQL statement, and returns results of reader as lambda objects to caller
- [mysql.scalar] - Executes an arbitrary SQL statement, and returns the result as a scalar value to caller
- [mysql.execute] - Executes an aribitrary SQL statement
- [mysql.transaction.create] - Creates a new transaction
- [mysql.transaction.commit] - Explicitly commits an open transaction
- [mysql.transaction.rollback] - Explicitly rolls back an open transaction
Notice - If you use any of the CRUD slots from above, the whole idea is that you can polymorphistically use the same lambda object, towards any of the underlaying database types, and the correct specific syntax for your particular database vendor’s SQL syntax will be automatically generated. This allows you to transparently use the same lambda object, towards any of the database types Magic supports, without having to change it in any ways.
All of the slots in this project are documented in the documentation for the “magic.data.common” project. If you replace the [data.xxx] or [sql.xxx] slots with [mysql.xxx], you will use the MySQL specific slots, instead of the generic, and/or polymorphistic slots. Hence, please refer to the documentation for “magic.data.common” to see the complete documentation for this project.
The source code for this repository can be found at github.com/polterguy/magic.lambda.mysql, and you can provide feedback, provide bug reports, etc at the same place.