-
Notifications
You must be signed in to change notification settings - Fork 101
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'bind-params' of https://github.com/gurzgri/node-odbc in…
…to node-v0.5.x-bind-params
- Loading branch information
Showing
4 changed files
with
168 additions
and
5 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/* | ||
* This example demonstrates odbc parameter binding. | ||
* | ||
*/ | ||
|
||
var odbc = require("../odbc.js"), | ||
db = new odbc.Database(); | ||
|
||
|
||
|
||
//open a connection to the database | ||
db.open("DSN=myDsnName;UID=myUserName;PWD=mySuperSecretPassword;DATABASE=myAwesomeDatabase;CHARSET=UTF8", function(err) | ||
{ | ||
|
||
if (err) { | ||
//Something went bad | ||
console.log(err); | ||
|
||
//Let's not go any further | ||
return; | ||
} | ||
|
||
/* | ||
* A quick example of passing some random parameters | ||
* | ||
*/ | ||
|
||
db.query("select ? as a, ? as b, ? as c, ? as d, ? as e", [null, 4711, true, -3.14, 'string'], function (error, result, info) { | ||
console.log("some random parameters"); | ||
if (error) {console.log(error); return false;} | ||
console.log(result); | ||
}); | ||
|
||
/* | ||
* Some non-ASCII-characters (note that db.open above is configured to use utf8 encoding) | ||
* | ||
*/ | ||
|
||
db.query("select ?", ['áäàéêèóöòüßÄÖÜ€'], function (error, result) { | ||
console.log("some non-ASCII characters"); | ||
if (error) {console.log(error); return false;} | ||
console.log(result); | ||
}); | ||
|
||
}); |
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