24

Oct 2019

Module CRUD - Universal Query

Universal Query

Universal query is a method of using flexible functions, by using universal queries the developer can easily customize the query if he does not want to use an existing CRUD query function provided by Aurora.


Universal Query Builder

Query that can be used for Universal Query:

Query

Description

SELECT FROM

Example: 

.query("SELECT * FROM membersModel").then(function (q) {
}

 

INSERT INTO

Example: 

.query("INSERT INTO membersModel").then(function (q) {
}

 

WHERE

Example: 

.query("SELECT * FROM membersModel  WHERE name = ‘dan’ ").then(function (q) {
}

 

DELETE

Example: 

.query("DELETE FROM membersModel  WHERE name = ‘dan’ ").then(function (q) {
}

 

UPDATE

Example: 

.query(“UPDATE  membersModel SET name =’dan’  WHERE name = ‘dhon’ ").then(function (q) {
}

 

Example of using a query in a function:

function test(){
main.query("SELECT * FROM membersModel").then(function (q) {
try {
return sysaura.query();
}catch(error){

}
},function(err){
try{

}catch(error){

} 
});
};