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
9 changed files
with
83 additions
and
41 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,37 @@ | ||
The BaseX Node client is asynchronous. Most functions take an option | ||
callback function as last argument. The callback function will be | ||
called when the results are available with two arguments. | ||
The first will contain any error infomation or null if there is no error | ||
the second will hold the result. | ||
The utility function `print` shows the syntax: | ||
|
||
function print(err, reply) { | ||
if (err) { | ||
console.log("Error: " + err); | ||
} else { | ||
console.dir(reply); | ||
} | ||
}; | ||
|
||
## Session | ||
var client=Session(host, port, username, password) | ||
hostname (default="localhost") | ||
port (default=1984) | ||
username (default="admin") | ||
password (default= "admin") | ||
|
||
|
||
## execute | ||
|
||
## create | ||
## add | ||
## replace | ||
## store | ||
## info | ||
## close | ||
|
||
## query | ||
|
||
## Debugging | ||
The basex module variable `debug_mode` can be set to true to | ||
print diagnostic info to the console. |
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 |
---|---|---|
@@ -1,13 +1,21 @@ | ||
|
||
/* | ||
* This example shows how database commands can be executed. | ||
*/ | ||
var basex = require("../index"); | ||
var client = new basex.Session(); | ||
function print(err, reply) { | ||
if (err) { | ||
console.log("Error: " + err); | ||
} else { | ||
console.dir(reply); | ||
var t2=new Date(); | ||
console.log("At close milliseconds:",t2-t0); | ||
} | ||
}; | ||
var t0=new Date(); | ||
client.execute("xquery 1 to 10",basex.print); | ||
client.close(basex.print); | ||
client.close(print); | ||
var t1=new Date(); | ||
// not a true time because basex commands not yet done. | ||
console.log("milliseconds:",t1-t0); |
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