Class nextdb.Query
Object
|
+--nextdb.Query
- class
nextdb.Query
Query is a class that represents a 'named' query
Queries are for retrieving data from your database.
Queries to your databases are made by referencing the queries that you developed
on the NextDB admin pages.
For obvious security reasons, the query language syntax is not exposed at the
JavaScript level. Executing SQL from the browser would pose obvious security problems.
Rather, you reference a query by its name. The query request is sent
asynchronously to the server, and your callback function handles the response--
standard AJAX programming.
Behind the scenes we are using a communication mechanism that side
steps the 'server of origin' policy
of the XMLHTTPRequest. So you can access NextDB from a page loaded
from a server different than www.nextdb. This enables mashups in the true
sense of the word.
var conn = new nextdb.Connection("accountName","databaseName");
var query = new nextdb.Query("QUERY1");
conn.executeQuery(query,
function(rows,error){
if(error){
alert(error.message);
} else {
alert(rows);
}
});
Defined in api.docs.js
|
Method Summary |
void
|
setPageSize(<int> num)
must be no greater than 100
|
void
|
setParameters(<Object> map)
required collection of name/value pairs, this is a plain old javascript object
for example query.setParameters({fname:"Brent",lname:"Jones"});
|
void
|
setStartAfter(num)
To move forward to the next page of query results call setStartAfter with the value of the last PK on the current page, then re-execute the query.
|
void
|
setStartAfterValue(<object> val)
If you have an ORDERBY clause in the query you can set the value to start after with this field.
|
nextdb.Query
nextdb.Query(<String> name)
setPageSize
void setPageSize(<int> num)
must be no greater than 100
setParameters
void setParameters(<Object> map)
required collection of name/value pairs, this is a plain old javascript object
for example query.setParameters({fname:"Brent",lname:"Jones"});
var parameters = new Object();
parameters.fname="Brent";
parameters.lname="Jones";
parameters.email="brenthamby@someserver.com";
query.setParameters(parameters);
or as one line: query.setParameters({fname:"Brent",lname:"Jones",email:"brenthamby@someserver.com"});
setStartAfter
void setStartAfter(num)
To move forward to the next page of query results call setStartAfter with the value of the last PK on the current page, then re-execute the query.
Parameters:
SURID - -required PK used for paging
setStartAfterValue
void setStartAfterValue(<object> val)
If you have an ORDERBY clause in the query you can set the value to start after with this field.
Documentation generated by
JSDoc on Fri Apr 1 10:54:23 2011