You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Mar 3, 2022. It is now read-only.
There are 3 available promises exposed by the module:
29
34
30
-
-`.query(command)` - Executes a query and returns the result set returned by the query as an array.
31
-
-`.execute(command)` - Executes a query command and returns the number of rows affected.
32
-
-`.scalar(command)` - Executes the query and returns the first column of the first row in the result set returned by the query. All other columns and rows are ignored.
35
+
-`.query(command, parameters)` - Executes a query and returns the result set returned by the query as an `Array`.
36
+
-`.execute(command, parameters)` - Executes a query command and returns the number of rows affected.
37
+
-`.scalar(command, parameters)` - Executes the query and returns the first column of the first row in the result set returned by the query. All other columns and rows are ignored.
33
38
34
-
*Where `command` is the query string.*
39
+
*Where `command` is the query string and `parameters` is an array of parameter values.*
40
+
41
+
## Query Parameters
42
+
Parameters are also supported and uses positional parameters that are marked with a question mark (?) instead of named parameters. Here is an example:
35
43
36
-
## Installation
37
44
```
38
-
npm install oledb --save
45
+
let command = `
46
+
select * from account
47
+
where
48
+
firstname = ?
49
+
and id = ?
50
+
`;
51
+
52
+
let parameters = [ 'Bob', 123 ];
53
+
54
+
db.query(command, parameters)
55
+
.then(function(results) {
56
+
console.log(results[0]);
57
+
},
58
+
function(error) {
59
+
console.error(error);
60
+
});
61
+
```
62
+
63
+
## Multiple Data Sets
64
+
OLE DB provides multiple data sets that can be returned in a single query. Here is an example:
0 commit comments