1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 | import events = require("events");
|
7 |
|
8 | export const OPEN_READONLY: number;
|
9 | export const OPEN_READWRITE: number;
|
10 | export const OPEN_CREATE: number;
|
11 | export const OPEN_FULLMUTEX: number;
|
12 | export const OPEN_SHAREDCACHE: number;
|
13 | export const OPEN_PRIVATECACHE: number;
|
14 | export const OPEN_URI: number;
|
15 |
|
16 | export const VERSION: string;
|
17 | export const SOURCE_ID: string;
|
18 | export const VERSION_NUMBER: number;
|
19 |
|
20 | export const OK: number;
|
21 | export const ERROR: number;
|
22 | export const INTERNAL: number;
|
23 | export const PERM: number;
|
24 | export const ABORT: number;
|
25 | export const BUSY: number;
|
26 | export const LOCKED: number;
|
27 | export const NOMEM: number;
|
28 | export const READONLY: number;
|
29 | export const INTERRUPT: number
|
30 | export const IOERR: number;
|
31 | export const CORRUPT: number
|
32 | export const NOTFOUND: number;
|
33 | export const FULL: number;
|
34 | export const CANTOPEN: number;
|
35 | export const PROTOCOL: number;
|
36 | export const EMPTY: number;
|
37 | export const SCHEMA: number;
|
38 | export const TOOBIG: number
|
39 | export const CONSTRAINT: number
|
40 | export const MISMATCH: number;
|
41 | export const MISUSE: number;
|
42 | export const NOLFS: number;
|
43 | export const AUTH: number
|
44 | export const FORMAT: number;
|
45 | export const RANGE: number
|
46 | export const NOTADB: number;
|
47 |
|
48 | export const LIMIT_LENGTH: number;
|
49 | export const LIMIT_SQL_LENGTH: number;
|
50 | export const LIMIT_COLUMN: number;
|
51 | export const LIMIT_EXPR_DEPTH: number;
|
52 | export const LIMIT_COMPOUND_SELECT: number;
|
53 | export const LIMIT_VDBE_OP: number;
|
54 | export const LIMIT_FUNCTION_ARG: number;
|
55 | export const LIMIT_ATTACHED: number;
|
56 | export const LIMIT_LIKE_PATTERN_LENGTH: number;
|
57 | export const LIMIT_VARIABLE_NUMBER: number;
|
58 | export const LIMIT_TRIGGER_DEPTH: number;
|
59 | export const LIMIT_WORKER_THREADS: number;
|
60 |
|
61 | export const cached: {
|
62 | Database(filename: string, callback?: (this: Database, err: Error | null) => void): Database;
|
63 | Database(filename: string, mode?: number, callback?: (this: Database, err: Error | null) => void): Database;
|
64 | };
|
65 |
|
66 | export interface RunResult extends Statement {
|
67 | lastID: number;
|
68 | changes: number;
|
69 | }
|
70 |
|
71 | export class Statement extends events.EventEmitter {
|
72 | bind(callback?: (err: Error | null) => void): this;
|
73 | bind(...params: any[]): this;
|
74 |
|
75 | reset(callback?: (err: null) => void): this;
|
76 |
|
77 | finalize(callback?: (err: Error) => void): Database;
|
78 |
|
79 | run(callback?: (err: Error | null) => void): this;
|
80 | run(params: any, callback?: (this: RunResult, err: Error | null) => void): this;
|
81 | run(...params: any[]): this;
|
82 |
|
83 | get<T>(callback?: (err: Error | null, row?: T) => void): this;
|
84 | get<T>(params: any, callback?: (this: RunResult, err: Error | null, row?: T) => void): this;
|
85 | get(...params: any[]): this;
|
86 |
|
87 | all<T>(callback?: (err: Error | null, rows: T[]) => void): this;
|
88 | all<T>(params: any, callback?: (this: RunResult, err: Error | null, rows: T[]) => void): this;
|
89 | all(...params: any[]): this;
|
90 |
|
91 | each<T>(callback?: (err: Error | null, row: T) => void, complete?: (err: Error | null, count: number) => void): this;
|
92 | each<T>(params: any, callback?: (this: RunResult, err: Error | null, row: T) => void, complete?: (err: Error | null, count: number) => void): this;
|
93 | each(...params: any[]): this;
|
94 | }
|
95 |
|
96 | export class Database extends events.EventEmitter {
|
97 | constructor(filename: string, callback?: (err: Error | null) => void);
|
98 | constructor(filename: string, mode?: number, callback?: (err: Error | null) => void);
|
99 |
|
100 | close(callback?: (err: Error | null) => void): void;
|
101 |
|
102 | run(sql: string, callback?: (this: RunResult, err: Error | null) => void): this;
|
103 | run(sql: string, params: any, callback?: (this: RunResult, err: Error | null) => void): this;
|
104 | run(sql: string, ...params: any[]): this;
|
105 |
|
106 | get<T>(sql: string, callback?: (this: Statement, err: Error | null, row: T) => void): this;
|
107 | get<T>(sql: string, params: any, callback?: (this: Statement, err: Error | null, row: T) => void): this;
|
108 | get(sql: string, ...params: any[]): this;
|
109 |
|
110 | all<T>(sql: string, callback?: (this: Statement, err: Error | null, rows: T[]) => void): this;
|
111 | all<T>(sql: string, params: any, callback?: (this: Statement, err: Error | null, rows: T[]) => void): this;
|
112 | all(sql: string, ...params: any[]): this;
|
113 |
|
114 | each<T>(sql: string, callback?: (this: Statement, err: Error | null, row: T) => void, complete?: (err: Error | null, count: number) => void): this;
|
115 | each<T>(sql: string, params: any, callback?: (this: Statement, err: Error | null, row: T) => void, complete?: (err: Error | null, count: number) => void): this;
|
116 | each(sql: string, ...params: any[]): this;
|
117 |
|
118 | exec(sql: string, callback?: (this: Statement, err: Error | null) => void): this;
|
119 |
|
120 | prepare(sql: string, callback?: (this: Statement, err: Error | null) => void): Statement;
|
121 | prepare(sql: string, params: any, callback?: (this: Statement, err: Error | null) => void): Statement;
|
122 | prepare(sql: string, ...params: any[]): Statement;
|
123 |
|
124 | serialize(callback?: () => void): void;
|
125 | parallelize(callback?: () => void): void;
|
126 |
|
127 | on(event: "trace", listener: (sql: string) => void): this;
|
128 | on(event: "profile", listener: (sql: string, time: number) => void): this;
|
129 | on(event: "change", listener: (type: string, database: string, table: string, rowid: number) => void): this;
|
130 | on(event: "error", listener: (err: Error) => void): this;
|
131 | on(event: "open" | "close", listener: () => void): this;
|
132 | on(event: string, listener: (...args: any[]) => void): this;
|
133 |
|
134 | configure(option: "busyTimeout", value: number): void;
|
135 | configure(option: "limit", id: number, value: number): void;
|
136 |
|
137 | loadExtension(filename: string, callback?: (err: Error | null) => void): this;
|
138 |
|
139 | wait(callback?: (param: null) => void): this;
|
140 |
|
141 | interrupt(): void;
|
142 | }
|
143 |
|
144 | export function verbose(): sqlite3;
|
145 |
|
146 | export interface sqlite3 {
|
147 | OPEN_READONLY: number;
|
148 | OPEN_READWRITE: number;
|
149 | OPEN_CREATE: number;
|
150 | OPEN_FULLMUTEX: number;
|
151 | OPEN_SHAREDCACHE: number;
|
152 | OPEN_PRIVATECACHE: number;
|
153 | OPEN_URI: number;
|
154 |
|
155 | VERSION: string;
|
156 | SOURCE_ID: string;
|
157 | VERSION_NUMBER: number;
|
158 |
|
159 | OK: number;
|
160 | ERROR: number;
|
161 | INTERNAL: number;
|
162 | PERM: number;
|
163 | ABORT: number;
|
164 | BUSY: number;
|
165 | LOCKED: number;
|
166 | NOMEM: number;
|
167 | READONLY: number;
|
168 | INTERRUPT: number
|
169 | IOERR: number;
|
170 | CORRUPT: number
|
171 | NOTFOUND: number;
|
172 | FULL: number;
|
173 | CANTOPEN: number;
|
174 | PROTOCOL: number;
|
175 | EMPTY: number;
|
176 | SCHEMA: number;
|
177 | TOOBIG: number
|
178 | CONSTRAINT: number
|
179 | MISMATCH: number;
|
180 | MISUSE: number;
|
181 | NOLFS: number;
|
182 | AUTH: number
|
183 | FORMAT: number;
|
184 | RANGE: number
|
185 | NOTADB: number;
|
186 |
|
187 | LIMIT_LENGTH: number;
|
188 | LIMIT_SQL_LENGTH: number;
|
189 | LIMIT_COLUMN: number;
|
190 | LIMIT_EXPR_DEPTH: number;
|
191 | LIMIT_COMPOUND_SELECT: number;
|
192 | LIMIT_VDBE_OP: number;
|
193 | LIMIT_FUNCTION_ARG: number;
|
194 | LIMIT_ATTACHED: number;
|
195 | LIMIT_LIKE_PATTERN_LENGTH: number;
|
196 | LIMIT_VARIABLE_NUMBER: number;
|
197 | LIMIT_TRIGGER_DEPTH: number;
|
198 | LIMIT_WORKER_THREADS: number;
|
199 |
|
200 | cached: typeof cached;
|
201 | RunResult: RunResult;
|
202 | Statement: typeof Statement;
|
203 | Database: typeof Database;
|
204 | verbose(): this;
|
205 | } |
\ | No newline at end of file |