forked from tmotagam/sqlite-electron
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsqlite-electron.d.ts
More file actions
68 lines (56 loc) · 2.82 KB
/
sqlite-electron.d.ts
File metadata and controls
68 lines (56 loc) · 2.82 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
/*
Types for sqlite-electron modules
Copyright (C) 2022 Motagamwala Taha Arif Ali
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/**
* @param {number} dbPath - Path of the database
*/
export declare const dbPath: string
/**
* executeQuery function executes only one query.
*
* @param {string} Query - A string param for SQL query
* @param {string} [fetch] - A optional string param for fetching values from the table
* @param {(string | number | null | Buffer)[]} [values] - A optional array param for values for a SQL query
* @return {Promise<Boolean | []>} Promise of boolean or an array is returned if fetch is defined
*
* @example
*
* executeQuery(Query='SELECT * FROM sqlite_master', fetch='all')
* executeQuery(Query='INSERT INTO sqlite_master (name, email, joining_date, salary) values(?,?,?,?)', fetch='', values=['John Doe','example@sqlite-electron.com','1250-12-19',8000000])
*/
export declare function executeQuery(Query: string, fetch?: string, values?: (string | number | null | Buffer)[]): Promise<Boolean | []>
/**
* executeMany function executes only one query on multiple values useful for bulk write.
*
* @param {string} Query - A string param for SQL query
* @param {(string | number | null | Buffer)[]} v - A array param for values for a SQL query
* @return {Promise<Boolean>} Promise of boolean is returned
*
* @example
*
* executeQuery(Query='INSERT INTO sqlite_master (name, email, joining_date, salary) values(?,?,?,?)', fetch='', v=[['John Doe','example@sqlite-electron.com','1250-12-19',8000000], ['John Doe','example@sqlite-electron.com','1250-12-19',8000000]])
*/
export declare function executeMany(Query: string, v: (string | number | null | Buffer)[]): Promise<boolean>
/**
* executeScript function executes all the queries given in the sql script.
*
* @param {string} scriptName - A path param for sql script or sql script itself
* @return {Promise<Boolean>} Promise of boolean is returned
*
* @example
*
* executeScript(scriptName='./script.sql')
* executeScript(scriptName='CREATE TABLE IF NOT EXISTS comp (ID INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,NAME TEXT NOT NULL,AGE INT NOT NULL,ADDRESS CHAR(50) NOT NULL,SALARY REAL NOT NULL);')
*/
export declare function executeScript(scriptName: string): Promise<Boolean>