-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
23 changed files
with
455 additions
and
757 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/* example functions for use as test callbacks | ||
* andy bunce 2011-2012 | ||
*/ | ||
function print(err, reply) { | ||
if (err) { | ||
console.log("Error: " + err); | ||
} else { | ||
console.dir(reply); | ||
} | ||
}; | ||
// show supplied msg then basex server response | ||
function printMsg(msg) { | ||
return function(err, reply){ | ||
console.log("printMsg: ",msg); | ||
if(arguments.length==2) print(err, reply) | ||
} | ||
}; | ||
exports.print = print; | ||
exports.printMsg = printMsg; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/* | ||
* This example shows how to use the event feature. | ||
* | ||
*/ | ||
var basex = require("../index"); | ||
var d = require("../debug"); | ||
|
||
// create sessions | ||
var session1 = new basex.Session("localhost", 1984, "admin", "admin"); | ||
var session2 = new basex.Session("localhost", 1984, "admin", "admin"); | ||
basex.debug_mode = false; | ||
|
||
function watchCallback(name,msg){ | ||
console.log("watch update-----> ",msg) | ||
session2.unwatch("messenger",function(){ | ||
session1.execute("drop event messenger",d.printMsg("S1:drop event")); | ||
// close session | ||
session1.close(d.printMsg("S1:close")); | ||
session2.close(d.printMsg("S2:close")); | ||
}); | ||
|
||
}; | ||
|
||
function afterEvent(err, reply){ | ||
if (err) { | ||
console.log("Error: " + err); | ||
//return; | ||
} | ||
console.dir(reply); | ||
session2.watch("messenger",watchCallback,d.printMsg("S2:watching messenger")); | ||
var xq="for $i in 1 to 1000000 where $i=3 return $i" | ||
session2.query(xq).execute(d.printMsg("S2:execute")); | ||
session1.query("db:event('messenger', 'Hello World!')").execute(d.printMsg("S1:event")); | ||
|
||
}; | ||
|
||
session1.execute("create event messenger",afterEvent); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
info it worked if it ends with ok | ||
verbose cli [ 'node', '/usr/bin/npm', 'test' ] | ||
info using npm@1.0.105 | ||
info using node@v0.6.10 | ||
verbose /usr/bin/node node symlink | ||
verbose config file /home/andy/.npmrc | ||
verbose config file /usr/etc/npmrc | ||
verbose config file /usr/lib/node_modules/npm/npmrc | ||
ERR! Error: ENOENT, no such file or directory '/home/andy/workspace/basex-node/examples/package.json' | ||
ERR! Report this *entire* log at: | ||
ERR! <http://github.com/isaacs/npm/issues> | ||
ERR! or email it to: | ||
ERR! <npm-@googlegroups.com> | ||
ERR! | ||
ERR! System Linux 3.0.0-19-generic | ||
ERR! command "node" "/usr/bin/npm" "test" | ||
ERR! cwd /home/andy/workspace/basex-node/examples | ||
ERR! node -v v0.6.10 | ||
ERR! npm -v 1.0.105 | ||
ERR! path /home/andy/workspace/basex-node/examples/package.json | ||
ERR! code ENOENT | ||
verbose exit [ 1, true ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.