Class nextdb.Insert
Object
|
+--nextdb.Insert
- class
nextdb.Insert
A simple insert just takes the table name in the constructor, then an
object of name/value pairs as the data to insert into that table. The fields
of the object must correspond to the columns of the database. The values for
the fields are the values that will make up the new row. Your callback function is passed
an encrypted key (PK) referencing the row that you have inserted. A very simple insert
looks like this:
var conn = new nextdb.Connection("accountName","databaseName");
var insert = new nextdb.Insert("TABLE1");
var params = {
first_name : "John",
last_name : "Doe"
}
insert.setParameters(params);
conn.executeInsert(insert,
function(rowId,error){
if(error){
alert(error.message);
} else {
alert("success! "+rowId)
}
});
Defined in api.docs.js
|
Method Summary |
void
|
setParameters(<Object> map)
|
void
|
setPermalinkHandler(<Function> callback)
|
void
|
setRelationship(<Relationship> relationship)
Set the rowId and relationship name to automatically link this inserted row to another
row in a different table according to the named relationship.
|
map
Object map
table
Object table
nextdb.Insert
nextdb.Insert(<String> tableName)
setParameters
void setParameters(<Object> map)
Parameters:
map - -required collection of name/value pairs, this is a plain old javascript object.
example:
var parameters = new Object();
parameters.fname="Brent";
parameters.lname="Hamby";
parameters.email="brenthamby@someserver.com";
insert.setParameters(parameters);
setPermalinkHandler
void setPermalinkHandler(<Function> callback)
Parameters:
callback - -in the case of binary data inserts, this callback will be passed a permalink to the data.
setRelationship
void setRelationship(<Relationship> relationship)
Set the rowId and relationship name to automatically link this inserted row to another
row in a different table according to the named relationship.
Parameters:
relationship - -optional used to relate the new row to existing row in another table.
Documentation generated by
JSDoc on Fri Apr 1 10:54:23 2011