#1
authoradam <anton@adamansky.com>
Sat, 3 Nov 2012 16:38:45 +0000 (23:38 +0700)
committeradam <anton@adamansky.com>
Sat, 3 Nov 2012 16:38:45 +0000 (23:38 +0700)
.idea/jsLibraryMappings.xml [new file with mode: 0644]
node/ejdb.js
node/nbproject/configurations.xml
node/tests/t2.js
tcejdb/tcejdb.iml

diff --git a/.idea/jsLibraryMappings.xml b/.idea/jsLibraryMappings.xml
new file mode 100644 (file)
index 0000000..14019d8
--- /dev/null
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="JavaScriptLibraryMappings">
+    <file url="file://$PROJECT_DIR$/node" libraries="{Node.js v0.8.14 Core Library}" />
+    <file url="file://$PROJECT_DIR$/tcejdb" libraries="{Node.js v0.8.14 Core Library}" />
+  </component>
+</project>
+
index 50b9769..451306f 100644 (file)
@@ -72,5 +72,51 @@ EJDB.prototype.load = function(cname, oid, cb) {
 };
 
 
+EJDB.prototype.remove = function(cname, oid, cb) {
+    return this._impl.remove(cname, oid, cb);
+};
+
+/**
+ *
+ * Calling variations:
+ *       - query(cname, qobj, qobjarr, hints, cb)
+ *       - query(cname, qobj, hints, cb)
+ *       - query(cname, qobj, cb)
+ *
+ * @param cname
+ * @param qobj
+ * @param orarr
+ * @param hints
+ * @param cb
+ */
+EJDB.prototype.query = function(cname, qobj, orarr, hints, cb) {
+    if (arguments.length == 4) {
+        hints = orarr;
+        cb = hints;
+        orarr = [];
+    } else if (arguments.length == 3) {
+        cb = orarr;
+        orarr = [];
+        hints = {};
+    }
+    if (typeof cb !== "function") {
+        throw new Error("Callback 'cb' argument must be specified");
+    }
+    if (typeof cname !== "string") {
+        throw new Error("Collection name 'cname' argument must be specified");
+    }
+    if (typeof hints !== "object") {
+        hints = {};
+    }
+    if (typeof qobj !== "object") {
+        qobj = {};
+    }
+    return this._impl.query(cname,
+            [qobj].concat(orarr, hints),
+            (hints["onlycount"] ? ejdblib.JBQRYCOUNT : 0),
+            cb);
+};
+
+
 module.exports = EJDB;
 
index 8e4ba2b..bd5be3b 100644 (file)
@@ -2,14 +2,6 @@
 <configurationDescriptor version="84">
   <logicalFolder name="root" displayName="root" projectFiles="true" kind="ROOT">
     <df name="node" root=".">
-      <df name="build">
-        <df name="Debug">
-          <df name="obj.target">
-            <df name="ejdb_native">
-            </df>
-          </df>
-        </df>
-      </df>
       <df name="nodejs">
         <df name="benchmark">
           <df name="arrays">
index fb40027..3f4b04d 100644 (file)
@@ -10,6 +10,7 @@ module.exports.testSetup = function(test) {
 };
 
 module.exports.testSaveLoad = function(test) {
+    test.ok(jb);
     test.ok(jb.isOpen());
     var parrot1 = {
         "name" : "Grenny",
@@ -45,7 +46,21 @@ module.exports.testSaveLoad = function(test) {
 
 
 module.exports.testQuery1 = function(test) {
-    test.done();
+    test.ok(jb);
+    test.ok(jb.isOpen());
+    jb.query("parrots", {}, function(err, cursor, count) {
+        test.ifError(err);
+        test.equal(count, 2);
+        test.ok(cursor);
+        var c = 0;
+        while (cursor.next()) {
+            ++c;
+        }
+        test.equal(c, 2);
+
+        test.ifError(err);
+        test.done();
+    });
 };
 
 module.exports.testClose = function(test) {
index 9f9a6f2..5fa768d 100644 (file)
@@ -8,6 +8,7 @@
     </content>
     <orderEntry type="jdk" jdkName="1.7" jdkType="JavaSDK" />
     <orderEntry type="sourceFolder" forTests="false" />
+    <orderEntry type="library" name="Node.js v0.8.14 Core Library" level="application" />
   </component>
 </module>