GearsORM. Fields.js

Contains the fields to be used in the models.

License

MIT-style license.

Summary
Contains the fields to be used in the models.
a meta class for basic field types like varchar,integer,real and timestamp
represent a ManyToOne relation,this isn`t a actual table field.
create a copy of this object
return the sql string for this field
do a SELECT on the related table
do a DELETE on the related table
return the related model class
represent a forigen key relation
create a copy of this object
return the sql string for this field
return the related model class
represent a many to many relation between two tables using a many to many relation table
create a copy of this object
return the related model class
add a relation between this object to another object
return the sql string for this field
create the many to many table
do a SELECT on the related table
delete a relation between this object and other object
drop the many to many table
return the related model class

GearsORM. Field. Primitive

a meta class for basic field types like varchar,integer,real and timestamp

Constructor

Parameters

sqlTypethe sql string for the type

GearsORM. Fields. ManyToOne

represent a ManyToOne relation,this isn`t a actual table field.

Constructor

Parameters

optionsa object that look like this: { related:”name_of_the_related_table”,
onDeleteCascade:true/falseif true this will create triggers to emulate a ON DELETE CASCADE,if this is false it will do ON DELETE RESTRICT }
Summary
create a copy of this object
return the sql string for this field
do a SELECT on the related table
do a DELETE on the related table
return the related model class

Functions

copy

copy:function()

create a copy of this object

toSql

toSql:function()

return the sql string for this field

select

select:function(whereExpression,
params)

do a SELECT on the related table

Parameters

whereExpressionsql where expression
paramsa array of bind parameters to be used in sql query

remove

remove:function(whereExpression,
params)

do a DELETE on the related table

Parameters

whereExpressionsql where expression
paramsa array of bind parameters to be used in sql query

getRelatedClass

getRelatedClass:function()

return the related model class

GearsORM. Fields. OneToMany

represent a forigen key relation

Constructor

Parameters

optionsa object that look like this: { related:”name_of_the_related_table”, onDeleteCascade:if true this will create triggers to emulate a ON DELETE CASCADE,if this is false it will do ON DELETE RESTRICT, allowNull:allow a null value }
Summary
create a copy of this object
return the sql string for this field
return the related model class

Functions

copy

copy:function()

create a copy of this object

toSql

toSql:function()

return the sql string for this field

getRelatedClass

getRelatedClass:function()

return the related model class

GearsORM. Fields. ManyToMany

represent a many to many relation between two tables using a many to many relation table

Constructor

Parameters

optionsa object that look like this: { related:”name_of_the_related_table”, onDeleteCascade:if true this will create triggers to emulate a ON DELETE CASCADE,if this is false it will do ON DELETE RESTRICT }
Summary
create a copy of this object
return the related model class
add a relation between this object to another object
return the sql string for this field
create the many to many table
do a SELECT on the related table
delete a relation between this object and other object
drop the many to many table
return the related model class

Functions

copy

copy:function()

create a copy of this object

getRelatedClass

return the related model class

add

add:function(realtedObject)

add a relation between this object to another object

Parameters

realtedObjecta related model instance or a id of that object

toSql

toSql:function()

return the sql string for this field

createTable

createTable:function()

create the many to many table

select

select:function(whereExpression,
params)

do a SELECT on the related table

Parameters

whereExpressionsql where expression.
paramsa array of bind parameters to be used in sql query.

remove

remove:function(related)

delete a relation between this object and other object

Parameters

realtedObjecta related model instance or a id of that object

dropTable

dropTable:function()

drop the many to many table

getRelatedClass

getRelatedClass:function()

return the related model class

copy:function()
create a copy of this object
toSql:function()
return the sql string for this field
select:function(whereExpression,
params)
do a SELECT on the related table
remove:function(whereExpression,
params)
do a DELETE on the related table
getRelatedClass:function()
return the related model class
copy:function()
create a copy of this object
toSql:function()
return the sql string for this field
getRelatedClass:function()
return the related model class
copy:function()
create a copy of this object
add:function(realtedObject)
add a relation between this object to another object
toSql:function()
return the sql string for this field
createTable:function()
create the many to many table
select:function(whereExpression,
params)
do a SELECT on the related table
remove:function(related)
delete a relation between this object and other object
dropTable:function()
drop the many to many table
getRelatedClass:function()
return the related model class