Introduction to SQL Record Objects

SQL Yoga has a feature called SQL Record objects. Using SQL Record objects SQL Yoga can create, retrieve, update and delete records from a database for you very easily. SQL Yoga can also create hierarchal SQL Record object arrays that represent the relationships in your database.

A SQL Record object is a simple Revolution array with special keys prefixed with @. These keys help SQL Yoga locate the table in the database that the record represents among other things.

Refer to the API documention for SQL Record objects for all handlers and properties available.

Single Record

A SQL Record object that represents a single record looks something like this:

theRecordA["@table"] = lessons

theRecordA["@connection"] = development

theRecordA["@database"] = default

theRecordA["id"] = 5

theRecordA["name"] = lesson title

theRecordA["description"] = lesson description

Multiple Records

A SQL Record object can also represent many records in the database using multi-dimensional arrays. Here is what a SQL Record object with 3 records might look like:

theRecordA[1]["@table"] = lessons

theRecordA[1]["@connection"] = development

theRecordA[1]["@database"] = default

theRecordA[1]["id"] = 5

theRecordA[1]["name"] = lesson 1 title

theRecordA[1]["description"] = lesson 1 description

theRecordA[2]["@table"] = lessons

theRecordA[2]["@connection"] = development

theRecordA[2]["@database"] = default

theRecordA[2]["id"] = 7

theRecordA[2]["name"] = lesson 2 title

theRecordA[2]["description"] = lesson 2 description

theRecordA[3]["@table"] = lessons

theRecordA[3]["@connection"] = development

theRecordA[3]["@database"] = default

theRecordA[3]["id"] = 8

theRecordA[3]["name"] = lesson 3 title

theRecordA[3]["description"] = lesson 3 description

0 Comments

Add your comment

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.