1
0
Fork 0

added module org/arangodb, added convinient functions

This commit is contained in:
Frank Celler 2012-10-18 15:39:00 +02:00
parent 9e4dad83d9
commit c1b0c37480
7 changed files with 143 additions and 1 deletions

View File

@ -149,6 +149,7 @@ GeneralArrayCursor.prototype._PRINT = function () {
/// @brief returns all elements of the cursor /// @brief returns all elements of the cursor
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
GeneralArrayCursor.prototype.toArray =
GeneralArrayCursor.prototype.elements = function () { GeneralArrayCursor.prototype.elements = function () {
return this._documents; return this._documents;
} }

View File

@ -599,6 +599,7 @@ function ArangoQueryCursor (database, data) {
/// server. Calling this function will also fully exhaust the cursor. /// server. Calling this function will also fully exhaust the cursor.
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
ArangoQueryCursor.prototype.toArray =
ArangoQueryCursor.prototype.elements = function () { ArangoQueryCursor.prototype.elements = function () {
var result = []; var result = [];
@ -2067,6 +2068,7 @@ function ArangoDatabase (connection) {
' ' + "\n" + ' ' + "\n" +
'Query Functions: ' + "\n" + 'Query Functions: ' + "\n" +
' _createStatement(<data>); create and return select query ' + "\n" + ' _createStatement(<data>); create and return select query ' + "\n" +
' _query(<query>); create, execute and return query ' + "\n" +
' ' + "\n" + ' ' + "\n" +
'Attributes: ' + "\n" + 'Attributes: ' + "\n" +
' <collection names> collection with the given name '; ' <collection names> collection with the given name ';
@ -2531,6 +2533,14 @@ function ArangoDatabase (connection) {
return new ArangoStatement(this, data); return new ArangoStatement(this, data);
}; };
////////////////////////////////////////////////////////////////////////////////
/// @brief factory method to create and execute a new statement
////////////////////////////////////////////////////////////////////////////////
ArangoDatabase.prototype._query = function (data) {
return new ArangoStatement(this, { query: data }).execute();
};
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @} /// @}
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////

View File

@ -0,0 +1,61 @@
/*jslint indent: 2,
nomen: true,
maxlen: 100,
sloppy: true,
vars: true,
white: true,
plusplus: true */
/*global require, exports */
////////////////////////////////////////////////////////////////////////////////
/// @brief JavaScript base module
///
/// @file
///
/// DISCLAIMER
///
/// Copyright 2012 triagens GmbH, Cologne, Germany
///
/// Licensed under the Apache License, Version 2.0 (the "License");
/// you may not use this file except in compliance with the License.
/// You may obtain a copy of the License at
///
/// http://www.apache.org/licenses/LICENSE-2.0
///
/// Unless required by applicable law or agreed to in writing, software
/// distributed under the License is distributed on an "AS IS" BASIS,
/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
/// See the License for the specific language governing permissions and
/// limitations under the License.
///
/// Copyright holder is triAGENS GmbH, Cologne, Germany
///
/// @author Dr. Frank Celler
/// @author Copyright 2012, triAGENS GmbH, Cologne, Germany
////////////////////////////////////////////////////////////////////////////////
var internal = require("internal");
// -----------------------------------------------------------------------------
// --SECTION-- MODULE EXPORTS
// -----------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////////
/// @addtogroup Arango
/// @{
////////////////////////////////////////////////////////////////////////////////
exports.db = internal.db;
////////////////////////////////////////////////////////////////////////////////
/// @}
////////////////////////////////////////////////////////////////////////////////
// -----------------------------------------------------------------------------
// --SECTION-- END-OF-FILE
// -----------------------------------------------------------------------------
// Local Variables:
// mode: outline-minor
// outline-regexp: "\\(/// @brief\\|/// @addtogroup\\|// --SECTION--\\|/// @page\\|/// @\\}\\)"
// End:

View File

@ -148,6 +148,7 @@ GeneralArrayCursor.prototype._PRINT = function () {
/// @brief returns all elements of the cursor /// @brief returns all elements of the cursor
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
GeneralArrayCursor.prototype.toArray =
GeneralArrayCursor.prototype.elements = function () { GeneralArrayCursor.prototype.elements = function () {
return this._documents; return this._documents;
} }

View File

@ -0,0 +1,61 @@
/*jslint indent: 2,
nomen: true,
maxlen: 100,
sloppy: true,
vars: true,
white: true,
plusplus: true */
/*global require, exports */
////////////////////////////////////////////////////////////////////////////////
/// @brief JavaScript base module
///
/// @file
///
/// DISCLAIMER
///
/// Copyright 2012 triagens GmbH, Cologne, Germany
///
/// Licensed under the Apache License, Version 2.0 (the "License");
/// you may not use this file except in compliance with the License.
/// You may obtain a copy of the License at
///
/// http://www.apache.org/licenses/LICENSE-2.0
///
/// Unless required by applicable law or agreed to in writing, software
/// distributed under the License is distributed on an "AS IS" BASIS,
/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
/// See the License for the specific language governing permissions and
/// limitations under the License.
///
/// Copyright holder is triAGENS GmbH, Cologne, Germany
///
/// @author Dr. Frank Celler
/// @author Copyright 2012, triAGENS GmbH, Cologne, Germany
////////////////////////////////////////////////////////////////////////////////
var internal = require("internal");
// -----------------------------------------------------------------------------
// --SECTION-- MODULE EXPORTS
// -----------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////////
/// @addtogroup Arango
/// @{
////////////////////////////////////////////////////////////////////////////////
exports.db = internal.db;
////////////////////////////////////////////////////////////////////////////////
/// @}
////////////////////////////////////////////////////////////////////////////////
// -----------------------------------------------------------------------------
// --SECTION-- END-OF-FILE
// -----------------------------------------------------------------------------
// Local Variables:
// mode: outline-minor
// outline-regexp: "\\(/// @brief\\|/// @addtogroup\\|// --SECTION--\\|/// @page\\|/// @\\}\\)"
// End:

View File

@ -8,7 +8,7 @@
/*global require, exports */ /*global require, exports */
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief JavaScript actions modules /// @brief JavaScript actions module
/// ///
/// @file /// @file
/// ///

View File

@ -206,6 +206,14 @@
return new ArangoStatement(this, data); return new ArangoStatement(this, data);
}; };
////////////////////////////////////////////////////////////////////////////////
/// @brief factory method to create and execute a new statement
////////////////////////////////////////////////////////////////////////////////
ArangoDatabase.prototype._query = function (data) {
return new ArangoStatement(this, { query: data }).execute();
};
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief drops a collection /// @brief drops a collection
/// ///