1
0
Fork 0

generated files

This commit is contained in:
Frank Celler 2012-03-09 14:12:20 +01:00
parent 6e12e7e6aa
commit a8ad01e21a
4 changed files with 394 additions and 691 deletions

View File

@ -228,13 +228,6 @@ am_avocado_OBJECTS = Admin/ApplicationAdminServer.$(OBJEXT) \
RestServer/ActionDispatcherThread.$(OBJEXT) \
RestServer/AvocadoHttpServer.$(OBJEXT) \
RestServer/AvocadoServer.$(OBJEXT) \
<<<<<<< HEAD
<<<<<<< HEAD
=======
RestServer/SystemActionDispatcherThread.$(OBJEXT) \
>>>>>>> JS loader for avocsh
=======
>>>>>>> added module doc
RestServer/avocado.$(OBJEXT) \
ResultGenerator/HtmlResultGenerator.$(OBJEXT) \
ResultGenerator/Initialise.$(OBJEXT) \
@ -676,13 +669,6 @@ avocado_SOURCES = \
RestServer/ActionDispatcherThread.cpp \
RestServer/AvocadoHttpServer.cpp \
RestServer/AvocadoServer.cpp \
<<<<<<< HEAD
<<<<<<< HEAD
=======
RestServer/SystemActionDispatcherThread.cpp \
>>>>>>> JS loader for avocsh
=======
>>>>>>> added module doc
RestServer/avocado.cpp \
ResultGenerator/HtmlResultGenerator.cpp \
ResultGenerator/Initialise.cpp \
@ -1663,13 +1649,6 @@ mostlyclean-compile:
-rm -f RestServer/ActionDispatcherThread.$(OBJEXT)
-rm -f RestServer/AvocadoHttpServer.$(OBJEXT)
-rm -f RestServer/AvocadoServer.$(OBJEXT)
<<<<<<< HEAD
<<<<<<< HEAD
=======
-rm -f RestServer/SystemActionDispatcherThread.$(OBJEXT)
>>>>>>> JS loader for avocsh
=======
>>>>>>> added module doc
-rm -f RestServer/avocado.$(OBJEXT)
-rm -f ResultGenerator/HtmlResultGenerator.$(OBJEXT)
-rm -f ResultGenerator/Initialise.$(OBJEXT)
@ -1862,13 +1841,6 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@RestServer/$(DEPDIR)/ActionDispatcherThread.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@RestServer/$(DEPDIR)/AvocadoHttpServer.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@RestServer/$(DEPDIR)/AvocadoServer.Po@am__quote@
<<<<<<< HEAD
<<<<<<< HEAD
=======
@AMDEP_TRUE@@am__include@ @am__quote@RestServer/$(DEPDIR)/SystemActionDispatcherThread.Po@am__quote@
>>>>>>> JS loader for avocsh
=======
>>>>>>> added module doc
@AMDEP_TRUE@@am__include@ @am__quote@RestServer/$(DEPDIR)/avocado.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@ResultGenerator/$(DEPDIR)/HtmlResultGenerator.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@ResultGenerator/$(DEPDIR)/Initialise.Po@am__quote@

File diff suppressed because it is too large Load Diff

View File

@ -102,11 +102,7 @@ static string JS_bootstrap_modules =
" // create a new sandbox and execute\n"
" ModuleCache[path] = module = new Module(path);\n"
"\n"
<<<<<<< HEAD
" content = \"(function (module, exports, require, print) {\" + raw.content + \"\\n/* end-of-file '\" + raw.path + \"' */ });\";\n"
=======
" content = \"(function (module, exports, require, print) {\" + content + \"\\n});\";\n"
>>>>>>> better error handling
"\n"
" try {\n"
" f = SYS_EXECUTE(content, undefined, path);\n"

View File

@ -1,5 +1,4 @@
static string JS_client_client =
<<<<<<< HEAD
"////////////////////////////////////////////////////////////////////////////////\n"
"/// @brief AvocadoShell client API\n"
"///\n"
@ -36,8 +35,22 @@ static string JS_client_client =
"// --SECTION-- global variables\n"
"// -----------------------------------------------------------------------------\n"
"\n"
"////////////////////////////////////////////////////////////////////////////////\n"
"/// @brief change internal.output to shell output\n"
"////////////////////////////////////////////////////////////////////////////////\n"
"\n"
"ModuleCache[\"/internal\"].exports.output = TRI_SYS_OUTPUT;\n"
"\n"
"////////////////////////////////////////////////////////////////////////////////\n"
"/// @brief default collection for saving queries\n"
"////////////////////////////////////////////////////////////////////////////////\n"
"\n"
"var DEFAULT_QUERY_COLLECTION = \"query\";\n"
"\n"
"////////////////////////////////////////////////////////////////////////////////\n"
"/// @brief help texts\n"
"////////////////////////////////////////////////////////////////////////////////\n"
"\n"
"var HELP = \"\";\n"
"var helpQueries = \"\";\n"
"var helpAvocadoDatabase = \"\";\n"
@ -193,18 +206,14 @@ static string JS_client_client =
"////////////////////////////////////////////////////////////////////////////////\n"
"\n"
"function getHeadline (text) {\n"
" var x = parseInt((78 - text.length) / 2);\n"
" var x = parseInt(Math.abs(78 - text.length) / 2);\n"
" \n"
" var p = \"\";\n"
" for (var i = 0; i < x; ++i) {\n"
" p += \"-\";\n"
" }\n"
" \n"
" if ( typeof(COLOR_BRIGHT) != \"undefined\" ) {\n"
" return COLOR_BRIGHT + p + \" \" + text + \" \" + p + COLOR_OUTPUT_RESET + \"\\n\";\n"
" }\n"
"\n"
" return p + \" \" + text + \" \" + p + \"\\n\";\n"
" return \"\\n\" + p + \" \" + text + \" \" + p + \"\\n\";\n"
"}\n"
"\n"
"////////////////////////////////////////////////////////////////////////////////\n"
@ -231,7 +240,7 @@ static string JS_client_client =
"////////////////////////////////////////////////////////////////////////////////\n"
"\n"
"ModuleCache[\"/internal\"].exports.log = function(level, msg) {\n"
" internal.output(msg, \"\\n\");\n"
" internal.output(level, \": \", msg, \"\\n\");\n"
"}\n"
"\n"
"// -----------------------------------------------------------------------------\n"
@ -240,79 +249,6 @@ static string JS_client_client =
"\n"
"////////////////////////////////////////////////////////////////////////////////\n"
"/// @brief constructor\n"
=======
"////////////////////////////////////////////////////////////////////////////////////\n"
"//\n"
"// global variables\n"
"//\n"
"////////////////////////////////////////////////////////////////////////////////\n"
"\n"
"var DEFAULT_QUERY_COLLECTION = \"query\";\n"
"\n"
"////////////////////////////////////////////////////////////////////////////////\n"
"//\n"
"// Helper functions\n"
"//\n"
"////////////////////////////////////////////////////////////////////////////////\n"
"\n"
"function throwIfError (requestResult) {\n"
" \n"
" if (requestResult == undefined) { \n"
" throw \"Result is empty\";\n"
" }\n"
" \n"
" if (requestResult[\"error\"] != undefined && requestResult[\"error\"]) {\n"
" if (requestResult[\"errorMessage\"] == undefined) {\n"
" throw \"Unknown error\"; \n"
" }\n"
" throw requestResult[\"errorMessage\"];\n"
" } \n"
"}\n"
"\n"
"function help () {\n"
" print(\"--------------- HELP -----------------------------------------------\");\n"
" print(\"predefined objects:\");\n"
" print(\" advocado: AdvocadoConnection\");\n"
" print(\" db: AdvocadoDatabase\");\n"
" print(\"examples:\");\n"
" print(\" > db._collections(); list all collections\");\n"
" print(\" > db.<coll_name>.all(); list all documents\");\n"
" print(\" > id = db.<coll_name>.save({ ... }); save a document\");\n"
" print(\" > db.<coll_name>.delete(<_id>); delete a document\");\n"
" print(\" > db.<coll_name>.document(<_id>); get a document\");\n"
" print(\" > helpQueries(); query help\");\n"
" print(\" > exit\"); \n"
" print(\"--------------------------------------------------------------------\");\n"
"}\n"
"\n"
"function helpQueries () {\n"
" print(\"--------------- HELP -----------------------------------------------\");\n"
" print(\"create query template:\");\n"
" print(\" > qt1 = db.createQueryTemplate(\\\"select ...\\\"); simple query\");\n"
" print(\" > qt2 = db.createQueryTemplate( complex query\");\n"
" print(\" {query:\\\"select...\\\",\");\n"
" print(\" name:\\\"qname\\\",\");\n"
" print(\" collection:\\\"q\\\"\");\n"
" print(\" ... });\");\n"
" print(\" > qt3 = db.getQueryTemplate(\\\"4334:2334\\\"); query by id\");\n"
" print(\" > qt1.update(\\\"select ...\\\"); update\"); \n"
" print(\" > qt1.delete(\\\"4334:2334\\\"); delete\");\n"
" print(\"create query instance:\");\n"
" print(\" > qi1 = qt1.getInstance(); from tmplate\");\n"
" print(\" > qi2 = db.createQueryInstance(\\\"select...\\\"); without template\");\n"
" print(\" > qi2.bind(\\\"a\\\":\\\"b\\\")\");\n"
" print(\"execute query:\");\n"
" print(\" > cu1 = qi1.execute(); returns cursor\");\n"
" print(\"loop over all results:\");\n"
" print(\" > while (cu1.hasNext()) { print( cu1.next() ); }\");\n"
" print(\"--------------------------------------------------------------------\");\n"
"}\n"
"\n"
"////////////////////////////////////////////////////////////////////////////////\n"
"//\n"
"// AvocadoCollection\n"
"//\n"
>>>>>>> JS loader for avocsh
"////////////////////////////////////////////////////////////////////////////////\n"
"\n"
"function AvocadoCollection (database, data) {\n"
@ -328,13 +264,10 @@ static string JS_client_client =
" }\n"
"}\n"
"\n"
<<<<<<< HEAD
"////////////////////////////////////////////////////////////////////////////////\n"
"/// @brief return all documents from the collection\n"
"////////////////////////////////////////////////////////////////////////////////\n"
"\n"
=======
>>>>>>> JS loader for avocsh
"AvocadoCollection.prototype.all = function () {\n"
" var str = this._database._connection.get(\"/_api/documents/\" + encodeURIComponent(this.name));\n"
"\n"
@ -343,7 +276,6 @@ static string JS_client_client =
" requestResult = JSON.parse(str);\n"
" }\n"
" \n"
<<<<<<< HEAD
" if (isErrorResult(requestResult)) {\n"
" return undefined;\n"
" }\n"
@ -355,16 +287,6 @@ static string JS_client_client =
"/// @brief return a single document from the collection, identified by its id\n"
"////////////////////////////////////////////////////////////////////////////////\n"
"\n"
=======
" throwIfError(requestResult);\n"
"\n"
" if (requestResult[\"documents\"] != undefined ) {\n"
" return requestResult[\"documents\"]; \n"
" }\n"
" return undefined;\n"
"}\n"
"\n"
>>>>>>> JS loader for avocsh
"AvocadoCollection.prototype.document = function (id) {\n"
" var str = this._database._connection.get(\"/_api/document/\" + encodeURIComponent(this.name) + \"/\" + encodeURIComponent(id));\n"
" \n"
@ -373,7 +295,6 @@ static string JS_client_client =
" requestResult = JSON.parse(str);\n"
" }\n"
"\n"
<<<<<<< HEAD
" if (isErrorResult(requestResult)) {\n"
" return undefined;\n"
" }\n"
@ -385,16 +306,6 @@ static string JS_client_client =
"/// @brief save a document in the collection, return its id\n"
"////////////////////////////////////////////////////////////////////////////////\n"
"\n"
=======
" throwIfError(requestResult);\n"
" \n"
" if (requestResult[\"document\"] != undefined) {\n"
" return requestResult[\"document\"];\n"
" }\n"
" return requestResult;\n"
"}\n"
"\n"
>>>>>>> JS loader for avocsh
"AvocadoCollection.prototype.save = function (data) { \n"
" var str = this._database._connection.post(\"/_api/document/\" + encodeURIComponent(this.name), JSON.stringify(data));\n"
" \n"
@ -403,7 +314,6 @@ static string JS_client_client =
" requestResult = JSON.parse(str);\n"
" }\n"
" \n"
<<<<<<< HEAD
" if (isErrorResult(requestResult)) {\n"
" return undefined;\n"
" }\n"
@ -415,16 +325,6 @@ static string JS_client_client =
"/// @brief delete a document in the collection, identified by its id\n"
"////////////////////////////////////////////////////////////////////////////////\n"
"\n"
=======
" throwIfError(requestResult);\n"
" \n"
" if (requestResult[\"_id\"] != undefined) {\n"
" return requestResult[\"_id\"];\n"
" }\n"
" return requestResult;\n"
"}\n"
"\n"
>>>>>>> JS loader for avocsh
"AvocadoCollection.prototype.delete = function (id) { \n"
" var str = this._database._connection.delete(\"/_api/document/\" + encodeURIComponent(this.name) + \"/\" + encodeURIComponent(id));\n"
" \n"
@ -433,7 +333,6 @@ static string JS_client_client =
" requestResult = JSON.parse(str);\n"
" }\n"
"\n"
<<<<<<< HEAD
" return !isErrorResult(requestResult);\n"
"}\n"
"\n"
@ -441,13 +340,6 @@ static string JS_client_client =
"/// @brief update a document in the collection, identified by its id\n"
"////////////////////////////////////////////////////////////////////////////////\n"
"\n"
=======
" throwIfError(requestResult);\n"
" \n"
" return true;\n"
"}\n"
"\n"
>>>>>>> JS loader for avocsh
"AvocadoCollection.prototype.update = function (id, data) { \n"
" var str = this._database._connection.put(\"/_api/document/\" + encodeURIComponent(this.name) + \"/\" + encodeURIComponent(id), JSON.stringify(data));\n"
" \n"
@ -456,7 +348,6 @@ static string JS_client_client =
" requestResult = JSON.parse(str);\n"
" }\n"
"\n"
<<<<<<< HEAD
" return !isErrorResult(requestResult);\n"
"}\n"
"\n"
@ -485,21 +376,6 @@ static string JS_client_client =
"////////////////////////////////////////////////////////////////////////////////\n"
"\n"
"function AvocadoQueryCursor (database, data) {\n"
=======
" throwIfError(requestResult);\n"
"\n"
" return true;\n"
"}\n"
"\n"
"\n"
"////////////////////////////////////////////////////////////////////////////////\n"
"//\n"
"// QueryCursor\n"
"//\n"
"////////////////////////////////////////////////////////////////////////////////\n"
"\n"
"function QueryCursor (database, data) {\n"
>>>>>>> JS loader for avocsh
" this._database = database;\n"
" this.data = data;\n"
" this._hasNext = false;\n"
@ -521,7 +397,6 @@ static string JS_client_client =
" }\n"
"}\n"
"\n"
<<<<<<< HEAD
"////////////////////////////////////////////////////////////////////////////////\n"
"/// @brief return whether there are more results available in the cursor\n"
"////////////////////////////////////////////////////////////////////////////////\n"
@ -548,15 +423,6 @@ static string JS_client_client =
"\n"
" if (!this._hasNext) {\n"
" throw \"No more results\";\n"
=======
"QueryCursor.prototype.hasNext = function () {\n"
" return this._hasNext;\n"
"}\n"
"\n"
"QueryCursor.prototype.next = function () {\n"
" if (!this._hasNext) {\n"
" throw \"No more results\";\n"
>>>>>>> JS loader for avocsh
" }\n"
" \n"
" var result = this.data.result[this._pos];\n"
@ -573,22 +439,14 @@ static string JS_client_client =
" \n"
" // load more results \n"
" var str = this._database._connection.put(\"/_api/cursor/\"+ encodeURIComponent(this.data._id), \"\");\n"
<<<<<<< HEAD
=======
"\n"
>>>>>>> JS loader for avocsh
" var requestResult = undefined;\n"
" if (str != undefined) {\n"
" requestResult = JSON.parse(str);\n"
" }\n"
" \n"
<<<<<<< HEAD
" if (isErrorResult(requestResult)) {\n"
" return undefined;\n"
" }\n"
=======
" throwIfError(requestResult);\n"
>>>>>>> JS loader for avocsh
" \n"
" this.data = requestResult;\n"
" this._count = requestResult.result.length;\n"
@ -606,7 +464,6 @@ static string JS_client_client =
" return result;\n"
"}\n"
"\n"
<<<<<<< HEAD
"////////////////////////////////////////////////////////////////////////////////\n"
"/// @brief return all remaining result documents from the cursor\n"
"///\n"
@ -699,29 +556,12 @@ static string JS_client_client =
" this._database = database;\n"
" this.doCount = false;\n"
" this.maxResults = null;\n"
=======
"\n"
"////////////////////////////////////////////////////////////////////////////////\n"
"//\n"
"// QueryInstance\n"
"//\n"
"////////////////////////////////////////////////////////////////////////////////\n"
"\n"
"function QueryInstance (database, data) {\n"
" this._database = database;\n"
" this.doCount = false;\n"
>>>>>>> JS loader for avocsh
" this.bindVars = {};\n"
" \n"
" if (typeof data === \"string\") {\n"
" this.query = data;\n"
" }\n"
<<<<<<< HEAD
" else if (data instanceof AvocadoQueryTemplate) {\n"
=======
" else if (data instanceof QueryTemplate) {\n"
" this.queryTemplate = data;\n"
>>>>>>> JS loader for avocsh
" if (data.document.query == undefined) {\n"
" data.load();\n"
" if (data.document.query == undefined) {\n"
@ -732,7 +572,6 @@ static string JS_client_client =
" } \n"
"}\n"
"\n"
<<<<<<< HEAD
"////////////////////////////////////////////////////////////////////////////////\n"
"/// @brief bind a parameter to the query instance\n"
"///\n"
@ -778,45 +617,22 @@ static string JS_client_client =
"////////////////////////////////////////////////////////////////////////////////\n"
"\n"
"AvocadoQueryInstance.prototype.execute = function () {\n"
=======
"QueryInstance.prototype.bind = function (key, value) {\n"
" this.bindVars[key] = value;\n"
"}\n"
"\n"
"QueryInstance.prototype.setCount = function (bool) {\n"
" if (bool) {\n"
" this.doCount = true;\n"
" }\n"
" else {\n"
" this.doCount = false; \n"
" }\n"
"}\n"
"\n"
"QueryInstance.prototype.execute = function () {\n"
>>>>>>> JS loader for avocsh
" var body = {\n"
" query : this.query,\n"
" count : this.doCount,\n"
" bindVars : this.bindVars\n"
" }\n"
<<<<<<< HEAD
"\n"
" if (this.maxResults) {\n"
" body[\"maxResults\"] = this.maxResults;\n"
" }\n"
" \n"
" var str = this._database._connection.post(\"/_api/cursor\", JSON.stringify(body));\n"
=======
" \n"
" var str = this._database._connection.post(\"/_api/cursor\", JSON.stringify(body));\n"
"\n"
>>>>>>> JS loader for avocsh
" var requestResult = undefined;\n"
" if (str != undefined) {\n"
" requestResult = JSON.parse(str);\n"
" }\n"
" \n"
<<<<<<< HEAD
" if (isErrorResult(requestResult)) {\n"
" return undefined;\n"
" }\n"
@ -849,20 +665,6 @@ static string JS_client_client =
"////////////////////////////////////////////////////////////////////////////////\n"
"\n"
"function AvocadoQueryTemplate (database, data) {\n"
=======
" throwIfError(requestResult);\n"
" \n"
" return new QueryCursor(this._database, requestResult);\n"
"}\n"
"\n"
"////////////////////////////////////////////////////////////////////////////////\n"
"//\n"
"// QueryTemplate\n"
"//\n"
"////////////////////////////////////////////////////////////////////////////////\n"
"\n"
"function QueryTemplate (database, data) {\n"
>>>>>>> JS loader for avocsh
" this._database = database;\n"
"\n"
" this.document = {\n"
@ -894,7 +696,6 @@ static string JS_client_client =
" }\n"
" \n"
" if (this.document.query == undefined && this.document._id == undefined) {\n"
<<<<<<< HEAD
" throw \"AvocadoQueryTemplate needs query or _id.\";\n"
" }\n"
"}\n"
@ -904,18 +705,10 @@ static string JS_client_client =
"////////////////////////////////////////////////////////////////////////////////\n"
"\n"
"AvocadoQueryTemplate.prototype.getInstance = function () {\n"
=======
" throw \"QueryTemplate needs query or _id.\";\n"
" }\n"
"}\n"
"\n"
"QueryTemplate.prototype.getInstance = function () {\n"
>>>>>>> JS loader for avocsh
" if (this.document._id == undefined) {\n"
" throw \"no _id found\"; \n"
" }\n"
" \n"
<<<<<<< HEAD
" return new AvocadoQueryInstance(this._database, this);\n"
"}\n"
"\n"
@ -924,12 +717,6 @@ static string JS_client_client =
"////////////////////////////////////////////////////////////////////////////////\n"
"\n"
"AvocadoQueryTemplate.prototype.update = function (data) {\n"
=======
" return new QueryInstance(this._database, this);\n"
"}\n"
"\n"
"QueryTemplate.prototype.update = function (data) {\n"
>>>>>>> JS loader for avocsh
" if (this.document._id == undefined) {\n"
" throw \"no _id found\"; \n"
" }\n"
@ -958,15 +745,11 @@ static string JS_client_client =
" return false;\n"
"}\n"
"\n"
<<<<<<< HEAD
"////////////////////////////////////////////////////////////////////////////////\n"
"/// @brief delete a query template, identified by its id\n"
"////////////////////////////////////////////////////////////////////////////////\n"
"\n"
"AvocadoQueryTemplate.prototype.delete = function () {\n"
=======
"QueryTemplate.prototype.delete = function () {\n"
>>>>>>> JS loader for avocsh
" if (this.document._id == undefined) {\n"
" throw \"no _id found\"; \n"
" }\n"
@ -980,7 +763,6 @@ static string JS_client_client =
" return false;\n"
"}\n"
"\n"
<<<<<<< HEAD
"////////////////////////////////////////////////////////////////////////////////\n"
"/// @brief load a query template, identified by its id\n"
"////////////////////////////////////////////////////////////////////////////////\n"
@ -988,11 +770,6 @@ static string JS_client_client =
"AvocadoQueryTemplate.prototype.load = function () {\n"
" if (this.document._id == undefined) {\n"
" throw \"AvocadoQueryTemplate needs _id for loading\"; \n"
=======
"QueryTemplate.prototype.load = function () {\n"
" if (this.document._id == undefined) {\n"
" throw \"QueryTemplate needs _id for loading\"; \n"
>>>>>>> JS loader for avocsh
" }\n"
"\n"
" var coll = this.document.collection;\n"
@ -1013,7 +790,6 @@ static string JS_client_client =
" \n"
" return true;\n"
" }\n"
<<<<<<< HEAD
"\n"
" return false; \n"
"}\n"
@ -1023,13 +799,6 @@ static string JS_client_client =
"////////////////////////////////////////////////////////////////////////////////\n"
"\n"
"AvocadoQueryTemplate.prototype.save = function () {\n"
=======
" return false; \n"
"\n"
"}\n"
"\n"
"QueryTemplate.prototype.save = function () {\n"
>>>>>>> JS loader for avocsh
" if (this.document._id != undefined) {\n"
" throw \"use update to save changes\"; \n"
" }\n"
@ -1047,7 +816,6 @@ static string JS_client_client =
" return false; \n"
"}\n"
"\n"
<<<<<<< HEAD
"////////////////////////////////////////////////////////////////////////////////\n"
"/// @brief print the help for AvocadoQueryTemplate\n"
"////////////////////////////////////////////////////////////////////////////////\n"
@ -1070,32 +838,16 @@ static string JS_client_client =
"\n"
"////////////////////////////////////////////////////////////////////////////////\n"
"/// @brief constructor\n"
=======
"\n"
"////////////////////////////////////////////////////////////////////////////////\n"
"//\n"
"// AvocadoDatabase\n"
"//\n"
>>>>>>> JS loader for avocsh
"////////////////////////////////////////////////////////////////////////////////\n"
"\n"
"function AvocadoDatabase (connection) {\n"
" this._connection = connection;\n"
<<<<<<< HEAD
"}\n"
"\n"
"////////////////////////////////////////////////////////////////////////////////\n"
"/// @brief return all collections from the database\n"
"////////////////////////////////////////////////////////////////////////////////\n"
"\n"
=======
" \n"
" // defaults\n"
" this.queryCollection = \"query\";\n"
" \n"
"}\n"
"\n"
>>>>>>> JS loader for avocsh
"AvocadoDatabase.prototype._collections = function () {\n"
" var str = this._connection.get(\"/_api/collections\");\n"
" \n"
@ -1104,15 +856,10 @@ static string JS_client_client =
" requestResult = JSON.parse(str);\n"
" }\n"
" \n"
<<<<<<< HEAD
" if (isErrorResult(requestResult)) {\n"
" return undefined;\n"
" }\n"
"\n"
=======
" throwIfError(requestResult);\n"
" \n"
>>>>>>> JS loader for avocsh
" if (requestResult[\"collections\"] != undefined) {\n"
" \n"
" // add all collentions to object\n"
@ -1126,13 +873,10 @@ static string JS_client_client =
" return undefined;\n"
"}\n"
"\n"
<<<<<<< HEAD
"////////////////////////////////////////////////////////////////////////////////\n"
"/// @brief return a single collection, identified by its id\n"
"////////////////////////////////////////////////////////////////////////////////\n"
"\n"
=======
>>>>>>> JS loader for avocsh
"AvocadoDatabase.prototype._collection = function (id) {\n"
" var str = this._connection.get(\"/_api/collection/\" + encodeURIComponent(id));\n"
" \n"
@ -1141,15 +885,10 @@ static string JS_client_client =
" requestResult = JSON.parse(str);\n"
" }\n"
" \n"
<<<<<<< HEAD
" if (isErrorResult(requestResult)) {\n"
" return undefined;\n"
" }\n"
"\n"
=======
" throwIfError(requestResult);\n"
" \n"
>>>>>>> JS loader for avocsh
" if (requestResult[\"name\"] != undefined) {\n"
" \n"
" this[requestResult[\"name\"]] = new AvocadoCollection(this, requestResult);\n"
@ -1160,17 +899,12 @@ static string JS_client_client =
" return undefined;\n"
"}\n"
"\n"
<<<<<<< HEAD
"////////////////////////////////////////////////////////////////////////////////\n"
"/// @brief factory method to create a new query template\n"
"////////////////////////////////////////////////////////////////////////////////\n"
"\n"
"AvocadoDatabase.prototype.createQueryTemplate = function (queryData) { \n"
"AvocadoDatabase.prototype._createQueryTemplate = function (queryData) { \n"
" var qt = new AvocadoQueryTemplate(this, queryData);\n"
=======
"AvocadoDatabase.prototype.createQueryTemplate = function (queryData) { \n"
" var qt = new QueryTemplate(this, queryData);\n"
>>>>>>> JS loader for avocsh
" if (qt.save()) {\n"
" return qt;\n"
" }\n"
@ -1178,17 +912,8 @@ static string JS_client_client =
" return undefined;\n"
"}\n"
"\n"
<<<<<<< HEAD
"AvocadoDatabase.prototype.getQueryTemplate = function (id) { \n"
"AvocadoDatabase.prototype._getQueryTemplate = function (id) { \n"
" var qt = new AvocadoQueryTemplate(this, {\"_id\" : id});\n"
=======
"AvocadoDatabase.prototype.createQueryInstance = function (queryData) { \n"
" return new QueryInstance(this, queryData);\n"
"}\n"
"\n"
"AvocadoDatabase.prototype.getQueryTemplate = function (id) { \n"
" var qt = new QueryTemplate(this, {\"_id\" : id});\n"
>>>>>>> JS loader for avocsh
" if (qt.load()) {\n"
" return qt;\n"
" }\n"
@ -1196,12 +921,11 @@ static string JS_client_client =
" return undefined;\n"
"}\n"
"\n"
<<<<<<< HEAD
"////////////////////////////////////////////////////////////////////////////////\n"
"/// @brief factory method to create a new query instance\n"
"////////////////////////////////////////////////////////////////////////////////\n"
"\n"
"AvocadoDatabase.prototype.createQueryInstance = function (queryData) { \n"
"AvocadoDatabase.prototype._createQueryInstance = function (queryData) { \n"
" return new AvocadoQueryInstance(this, queryData);\n"
"}\n"
"\n"
@ -1247,13 +971,13 @@ static string JS_client_client =
"helpQueries = \n"
"getHeadline(\"Simple queries help\") +\n"
"'Create query template: ' + \"\\n\" +\n"
"' > qt1 = db.createQueryTemplate(\"select ...\"); simple query ' + \"\\n\" +\n"
"' > qt2 = db.createQueryTemplate( complex query ' + \"\\n\" +\n"
"' > qt1 = db._createQueryTemplate(\"select ...\"); simple query ' + \"\\n\" +\n"
"' > qt2 = db._createQueryTemplate( complex query ' + \"\\n\" +\n"
"' {query:\"select...\", ' + \"\\n\" +\n"
"' name:\"qname\", ' + \"\\n\" +\n"
"' collection:\"q\" ' + \"\\n\" +\n"
"' ... } ' + \"\\n\" +\n"
"' > qt3 = db.getQueryTemplate(\"4334:2334\"); query by id ' + \"\\n\" +\n"
"' > qt3 = db._getQueryTemplate(\"4334:2334\"); query by id ' + \"\\n\" +\n"
"' > qt1.update(\"select ...\"); update ' + \"\\n\" +\n"
"' > qt1.delete(\"4334:2334\"); delete ' + \"\\n\" +\n"
"'Create query instance: ' + \"\\n\" +\n"
@ -1326,7 +1050,7 @@ static string JS_client_client =
"getHeadline(\"AvocadoQueryInstance help\") +\n"
"'AvocadoQueryInstance constructor: ' + \"\\n\" +\n"
"' > qi1 = qt1.getInstance(); ' + \"\\n\" +\n"
"' > qi2 = db.createQueryInstance(\"select ....\"); ' + \"\\n\" +\n"
"' > qi2 = db._createQueryInstance(\"select ....\"); ' + \"\\n\" +\n"
"'Functions: ' + \"\\n\" +\n"
"' bind(<key>, <value>); bind vars ' + \"\\n\" +\n"
"' setCount(true); ' + \"\\n\" +\n"
@ -1341,7 +1065,7 @@ static string JS_client_client =
"' maxResults maximum number of results ' + \"\\n\" +\n"
"' query the query string ' + \"\\n\" +\n"
"'Example: ' + \"\\n\" +\n"
"' > qi2 = db.createQueryInstance(\"select a from colA a ' + \"\\n\" +\n"
"' > qi2 = db._createQueryInstance(\"select a from colA a ' + \"\\n\" +\n"
"' where a.x = @a@ and a.y = @b@\"); ' + \"\\n\" +\n"
"' > qi2.bind(\"a\", \"hello\"); ' + \"\\n\" +\n"
"' > qi2.bind(\"b\", \"world\"); ' + \"\\n\" +\n"
@ -1350,8 +1074,8 @@ static string JS_client_client =
"helpAvocadoQueryTemplate = \n"
"getHeadline(\"AvocadoQueryTemplate help\") +\n"
"'AvocadoQueryTemplate constructor: ' + \"\\n\" +\n"
"' > qt1 = db.createQueryTemplate(\"select ...\"); simple query ' + \"\\n\" +\n"
"' > qt2 = db.createQueryTemplate( complex query ' + \"\\n\" +\n"
"' > qt1 = db._createQueryTemplate(\"select ...\"); simple query ' + \"\\n\" +\n"
"' > qt2 = db._createQueryTemplate( complex query ' + \"\\n\" +\n"
"' {query:\"select...\", ' + \"\\n\" +\n"
"' name:\"qname\", ' + \"\\n\" +\n"
"' collection:\"q\" ' + \"\\n\" +\n"
@ -1367,7 +1091,7 @@ static string JS_client_client =
"' _id template id ' + \"\\n\" +\n"
"' name collection name ' + \"\\n\" +\n"
"'Example: ' + \"\\n\" +\n"
"' > qt1 = db.getQueryTemplate(\"4334:2334\"); ' + \"\\n\" +\n"
"' > qt1 = db._getQueryTemplate(\"4334:2334\"); ' + \"\\n\" +\n"
"' > qt1.update(\"select a from collA a\"); ' + \"\\n\" +\n"
"' > qi1 = qt1.getInstance(); ' + \"\\n\" +\n"
"' > qt1.delete(\"4334:2334\"); ';\n"
@ -1414,28 +1138,4 @@ static string JS_client_client =
"// mode: outline-minor\n"
"// outline-regexp: \"^\\\\(/// @brief\\\\|/// @addtogroup\\\\|// --SECTION--\\\\|/// @page\\\\|/// @}\\\\)\"\n"
"// End:\n"
=======
"\n"
"try {\n"
"\n"
" //\n"
" // default database\n"
" // \n"
" db = new AvocadoDatabase(avocado);\n"
"\n"
" //\n"
" // load collection data\n"
" // \n"
" db._collections();\n"
"\n"
<<<<<<< HEAD
"help();\n"
>>>>>>> JS loader for avocsh
=======
" help();\n"
"}\n"
"catch (err) {\n"
" print(COLOR_RED + \"connection failure: \" + err + COLOR_BLACK);\n"
"}\n"
>>>>>>> better error handling
;