-
Notifications
You must be signed in to change notification settings - Fork 4
Home
Database library for LiveCode
SQL Yoga is a database library for LiveCode built on top of RevDB or Valentina. Using the database schema and information from you, the developer, SQL Yoga allows you to write less code when querying and updating an application's database. It also provides additional callbacks and opportunities to validate the data.
While the library can be used independently of any framework, SQL Yoga is distributed as a Helper for the Levure framework. Levure makes using SQL Yoga much easier from a configuration and customization perspective.
SQL Yoga works with LiveCode 8 or newer.
Here are examples of some of the features in SQL Yoga.
Generate queries by creating and setting properties on SQL Query objects or SQL Record objects.
put sqlquery_createObject("news_releases") into tQueryA
sqlquery_set tQueryA, "sort by", "published_date"
sqlquery_retrieveAsData tQueryA, tNewsReleases
Easily update records.
put 2 into tRecId
put true into tTaskA["complete"]
sqlquery_update "task", tRecId, tTaskA
Chain together predefined search conditions using scope obects.
put sqlquery_createObject("todo_items") into tQueryA
sqlquery_addScope tQueryA, "not complete"
sqlquery_addScope tQueryA, "name contains", \
sqlyoga_splitUserSearchString(the text of field "Search")
sqlquery_retrieveAsArray tQueryA, tFilteredToDosA
Leverage relationships between tables.
put sqlquery_createObject("todo_items") into tQueryA
sqlquery_set tQueryA, "related table joins", "people"
sqlquery_retrieveAsArray tQueryA, tToDosWithAssignedPeopleA
For an example of a Levure application that uses SQL Yoga check out the sql-yoga-levure repository.
- Add the SQL Yoga helper to an existing Levure application
- Import the existing database schema into the databse schema YAML file
- Update the database schema YAML file whenever you update your database schema
- Add the SQL Yoga helper to an existing Levure application
- Create and run a migration file using YAML to describe your database
- Create additional migration files as needed
- Read about error handling
- Connect to your database
- Start querying your database using SQL Query objects and SQL Record objects
- Review the rest of the documentation to learn about all of the possibilites.
SQL Yoga USER GUIDE
- Home
- SQL Yoga Objects
- Database Objects
- Connection Objects
- SQL Query Objects
- SQL Record Objects
- Table Objects
- Table Object Behaviors
- Relationships
- Scopes
- Schema
- Working with User Search Strings
- SQL Query Template Objects
- Error Handling
- Migrating from SQL Yoga 1.x
- Integrating with the Levure Application Framework