mirror of https://gitee.com/bigwinds/arangodb
allow bind parameters in db._query()
This commit is contained in:
parent
373639a3b6
commit
c74c80d5ff
|
@ -701,8 +701,13 @@ ArangoDatabase.prototype._createStatement = function (data) {
|
||||||
/// @brief factory method to create and execute a new statement
|
/// @brief factory method to create and execute a new statement
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
ArangoDatabase.prototype._query = function (data) {
|
ArangoDatabase.prototype._query = function (query, bindVars) {
|
||||||
return new ArangoStatement(this, { query: data }).execute();
|
var payload = {
|
||||||
|
query: query,
|
||||||
|
bindVars: bindVars || undefined
|
||||||
|
};
|
||||||
|
|
||||||
|
return new ArangoStatement(this, payload).execute();
|
||||||
};
|
};
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
|
@ -700,8 +700,13 @@ ArangoDatabase.prototype._createStatement = function (data) {
|
||||||
/// @brief factory method to create and execute a new statement
|
/// @brief factory method to create and execute a new statement
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
ArangoDatabase.prototype._query = function (data) {
|
ArangoDatabase.prototype._query = function (query, bindVars) {
|
||||||
return new ArangoStatement(this, { query: data }).execute();
|
var payload = {
|
||||||
|
query: query,
|
||||||
|
bindVars: bindVars || undefined
|
||||||
|
};
|
||||||
|
|
||||||
|
return new ArangoStatement(this, payload).execute();
|
||||||
};
|
};
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
|
@ -73,12 +73,13 @@ function DatabaseSuite () {
|
||||||
},
|
},
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
/// @brief test name function
|
/// @brief test _query function
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
testQuery : function () {
|
testQuery : function () {
|
||||||
assertEqual([ 1 ], internal.db._query("return 1").toArray());
|
assertEqual([ 1 ], internal.db._query("return 1").toArray());
|
||||||
assertEqual([ [ 1, 2, 9, "foo" ] ], internal.db._query("return [ 1, 2, 9, \"foo\" ]").toArray());
|
assertEqual([ [ 1, 2, 9, "foo" ] ], internal.db._query("return [ 1, 2, 9, \"foo\" ]").toArray());
|
||||||
|
assertEqual([ [ 1, 454 ] ], internal.db._query("return [ @low, @high ]", { low : 1, high : 454 }).toArray());
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -111,8 +111,12 @@ ArangoDatabase.prototype._createStatement = function (data) {
|
||||||
/// @brief factory method to create and execute a new statement
|
/// @brief factory method to create and execute a new statement
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
ArangoDatabase.prototype._query = function (data) {
|
ArangoDatabase.prototype._query = function (query, bindVars) {
|
||||||
return new ArangoStatement(this, { query: data }).execute();
|
var payload = {
|
||||||
|
query: query,
|
||||||
|
bindVars: bindVars || undefined
|
||||||
|
};
|
||||||
|
return new ArangoStatement(this, payload).execute();
|
||||||
};
|
};
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
Loading…
Reference in New Issue