Contains GearsORM.Model a metaclass used to define models
MIT-style license.
| GearsORM. Model.js | Contains GearsORM.Model a metaclass used to define models |
| GearsORM. Model | a metaclass to define models that represent database tables. |
| GearsORM. Model. model | represent a model instance |
| Functions | |
| remove | remove the instance from the database |
| save | |
| update | update instance into database,use save instead. |
| insert | insert instance into database,use save instead. |
| _updateInsert | do the actual insert/update,used by insert and update methods. |
| refresh | refresh the model data from database. |
| _populateFromResult | populate the instance from a ResultSet. |
| select | do a SELECT on the model |
| remove | do a DELETE on the model |
| createTable | create the table for this model,creating triggers for forigenkeys and creating many-to-many tables if needed. |
| dropTable | drop the table and all associate triggers. |
| createTriggers | create triggers to inforce forigenkeys. |
| dropTriggers | drop triggers related to the table. |
| load | load objects from a array to the database. |
a metaclass to define models that represent database tables. a metaclass is a class in which the instances are also classes.
| options | a object used to describe the model look like this: { name : “Name of the model table”, fields: { name_of_the_field:a_instance_of_GearsORM.Fields.* } } |
represent a model instance
| valuesOrRowID | (optional)a object used to initialize the model instance with values or it can be the id of the row,in that case it will do a select to retrive the model data. |
| Functions | |
| remove | remove the instance from the database |
| save | |
| update | update instance into database,use save instead. |
| insert | insert instance into database,use save instead. |
| _updateInsert | do the actual insert/update,used by insert and update methods. |
| refresh | refresh the model data from database. |
| _populateFromResult | populate the instance from a ResultSet. |
| select | do a SELECT on the model |
| remove | do a DELETE on the model |
| createTable | create the table for this model,creating triggers for forigenkeys and creating many-to-many tables if needed. |
| dropTable | drop the table and all associate triggers. |
| createTriggers | create triggers to inforce forigenkeys. |
| dropTriggers | drop triggers related to the table. |
| load | load objects from a array to the database. |
save:function()
| save the instance to the database,if the instance is not in the database | it will be created. if it is already in the database it will be updated. |
_updateInsert:function( update )
do the actual insert/update,used by insert and update methods.
_populateFromResult:function( result )
populate the instance from a ResultSet.
| result | a ResultSet that used to populate the instance. |
select:function( whereExpression, params )
do a SELECT on the model
| whereExpression | a SQL expression to be used as the WHERE clause. |
| params | bind parameters used in the SQL expression. |
a new ResultIterator to iterate the ResultSet
remove:function( whereExpression, params )
do a DELETE on the model
| whereExpression | a SQL expression to be used as the WHERE clause. |
| params | bind parameters used in the SQL expression. |
remove the instance from the database
remove:function()
save:function()
update instance into database,use save instead.
update:function()
insert instance into database,use save instead.
insert:function()
do the actual insert/update,used by insert and update methods.
_updateInsert:function( update )
refresh the model data from database.
refresh:function()
populate the instance from a ResultSet.
_populateFromResult:function( result )
do a SELECT on the model
select:function( whereExpression, params )
create the table for this model,creating triggers for forigenkeys and creating many-to-many tables if needed.
createTable:function()
drop the table and all associate triggers.
dropTable:function()
create triggers to inforce forigenkeys.
createTriggers:function()
drop triggers related to the table.
dropTriggers:function()
load objects from a array to the database.
load:function( objects, save )