-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaps-sql.d.ts
More file actions
70 lines (64 loc) · 2.95 KB
/
aps-sql.d.ts
File metadata and controls
70 lines (64 loc) · 2.95 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
/************************************************
* *
* aps-sql v0.3.0 API *
* *
************************************************/
declare module "aps-sql" {
/**
* Must be called first.
* Sets the connection string to be used by all other calls to the aps-sql library.
*
* @param {string} str The connection string to use.
*/
export function connectionString(str: string): void;
/**
* Executes a query and returns the result. Must have called 'connectionString()' first.
*
* *Important Note: converts all results from the database into JS. Don't just return everything otherwise you may run out of memory.
*
* @param {string} command The SQL command string to run
* @param {object} params An optional object containing a list of @ parameters & values that are used in the previous command string.
* @returns An array of arrays. First element contains the header row, all remaining arrays contain the data for the row.
*/
export function executeQuery(command: string, params?: {}): any;
/**
* Executes a query that does not have a result. Must have called 'connectionString()' first.
*
* @param {string} command The SQL command string to run
* @param {object} params An optional object containing a list of @ parameters & values that are used in the previous command string.
*/
export function executeNonQuery(command: string, params?: {}): void;
/**
* Begins a new transaction. Must have called 'connectionString()' first.
*
* @returns A Transaction object which can be used to execute queries, and commit or cancel the transaction.
*/
export function beginTransaction() : Transaction;
export interface Transaction {
/**
* Executes a query and returns the result.
*
* *Important Note: converts all results from the database into JS. Don't just return everything otherwise you may run out of memory.
*
* @param {string} command The SQL command string to run
* @param {object} params An optional object containing a list of @ parameters & values that are used in the previous command string.
* @returns An array of arrays. First element contains the header row, all remaining arrays contain the data for the row.
*/
executeQuery(command: string, params?: {}): any
/**
* Executes a query that does not have a result.
*
* @param {string} command The SQL command string to run
* @param {object} params An optional object containing a list of @ parameters & values that are used in the previous command string.
*/
executeNonQuery(command: string, params?: {}): any
/**
* Commits the transaction and closes the database connection.
*/
commit(): void
/**
* Rolls back the transaction and closes the database connection.
*/
cancel(): void
}
}