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
Copy file name to clipboardExpand all lines: README.md
+38-22Lines changed: 38 additions & 22 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,12 +1,14 @@
1
1
# Sqlite Electron
2
2
3
-
Sqlite Electron is a module for electron to use sqlite3 database without rebuilding it supports Windows (x64, x32) and Linux (x64, arm64). It supports ESM and CJS.
3
+
Sqlite Electron is a module for electron to use sqlite3 database without rebuilding it supports Windows (x64, x32, arm64), Linux (x64, arm64), and MacOS (x64, arm64). ESM and CJS modules are supported.
4
4
5
5
Changes:
6
6
7
-
*iterdump function to generate an iterable of SQL commands that can recreate the entire database schema and data*
7
+
*MacOS is now Supported :tada:*
8
8
9
-
*Added autocommit option in setdbPath to make the commit and rollback either auto or manual*
9
+
*Can use objects as well as arrays when binding the values with the sql statement using named parameters*
10
+
11
+
*Use env var **SQEL_PLATFORM_ARCH_IDENTIFIER** to download any platform binaries on any other platform eg. create electron app for macOS on the windows the sqlite-electron will install the macOS related binary when used the env var. For valid options see below*
10
12
11
13
## Installation
12
14
@@ -24,15 +26,23 @@ Use the package manager [yarn](https://yarnpkg.com/package/sqlite-electron) to i
24
26
yarn add sqlite-electron
25
27
```
26
28
27
-
## Notes
29
+
**SQEL_PLATFORM_ARCH_IDENTIFIER**
30
+
31
+
The valid options for this env variable are as follows
32
+
33
+
*1. win32-x64, win32-ia32, win32-arm64*
34
+
35
+
*2. linux-x64, linux-arm64*
28
36
29
-
*1. Due to package building issues the sqlite3 prebuilt for x32 windows system is currently unavailable for version 3.3.5 it will be available as soon as issues are resolved.*
37
+
*3. darwin-x64, darwin-arm64*
30
38
31
-
*2. The package installs the prebuilt binaries of the sqlite on your system (if your system is supported) if you want any other platform binaries for a specific version go to https://github.com/tmotagam/sqlite-electron/releases.*
39
+
## Notes
40
+
41
+
*1. The package installs the prebuilt binaries of the sqlite on your system (if your system is supported)*
32
42
33
-
*3. The example written for this library disregards the required security for the electron apps so do not use it as starting point in your applications.*
43
+
*2. The example written for this library disregards the required security for the electron apps so do not use it as starting point in your applications.*
34
44
35
-
*4. Never give values in the query string use values array for giving the values for the query not taking this precaution will result in SQL injection attacks !.*
45
+
*3. Never give values in the query string use values array for giving the values for the query not taking this precaution will result in SQL injection attacks !.*
| setdbPath(path='', isuri=false, autocommit=true) | It opens or creates the database for operation supports the InMemory databases and also SQLite URI format also the database path can be relative or absolute. Added autocommit to make the sql transaction either commit or rollback automatically or manually |
61
-
| executeQuery(query = '', values = []) | It Executes single query with values they must be array |
71
+
| executeQuery(query = '', values = []) | It Executes single query with values they can be array or object|
62
72
| executeMany(query = '', values = []) | It executes single query with multiple values |
63
73
| executeScript(scriptname = '') | It execute the SQL script scriptName must be name of the script or the script itself |
64
-
| fetchAll(query = '', values = []) | It fetches all the values that matches the query. The values can also be given for the query using values array |
65
-
| fetchOne(query = '', values = []) | It fetches only one value that matches the query. The values can also be given for the query using values array |
66
-
| fetchMany(query = '', size = 5 values = []) | It fetches as many values as defined in size parameter that matches the query. The values can also be given for the query using values array
74
+
| fetchAll(query = '', values = []) | It fetches all the values that matches the query. The values can also be given for the query using values array or object |
75
+
| fetchOne(query = '', values = []) | It fetches only one value that matches the query. The values can also be given for the query using values array or object |
76
+
| fetchMany(query = '', size = 5 values = []) | It fetches as many values as defined in size parameter that matches the query. The values can also be given for the query using values arrays or array of object
67
77
| load_extension(path = '') | It loads SQLite extension from the given path for the connected database. |
68
78
| backup(target='', pages=-1, name='main', sleep=0.250) | It backs up the database to the target database. The pages can be used if the database is very big. The name is used for the database to backup. Sleep is used to pause the operation for the specified seconds between backup of the specified number of pages. |
69
79
| iterdump(file='', filter=null) | It generates an iterable of SQL commands that can recreate the entire database schema and data. The file parameter is used to save all the generated SQL commands. The filter is used to filter the databases to be generated as SQL commands the default is null which means the entire database is to be generated. |
This is the function for fetching all the rows that can be retrived using the given query eg: 'SELECT \* from tutorial' you can give values through the values array they will return the data in the Object format like this [{name: 'b', ...}, {name: 'a', ...}, {name: 'c', ...}].
228
+
This is the function for fetching all the rows that can be retrived using the given query eg: 'SELECT \* from tutorial' you can give values array or object it will return the data in the Object format like this [{name: 'b', ...}, {name: 'a', ...}, {name: 'c', ...}].
This is the function for fetching only one row that can be retrived using the given query eg: 'SELECT \* from tutorial WHERE ID=?' you can give values through the values array they will return the data in the Object format like this {name: 'a', ...}.
256
+
This is the function for fetching only one row that can be retrived using the given query eg: 'SELECT \* from tutorial WHERE ID=?' you can give values array or object it will return the data in the Object format like this {name: 'a', ...}.
This is the function for fetching as many rows as the size parameter allows that can be retrived using the given query eg: 'SELECT \* from tutorial WHERE name=?' you can give values through the values array they will return the data in the Object format like this [{name: 'a', ...}, {name: 'a', ...}, {name: 'a', ...}].
284
+
This is the function for fetching as many rows as the size parameter allows that can be retrived using the given query eg: 'SELECT \* from tutorial WHERE name=?' you can give values through the values arrays or array of object it will return the data in the Object format like this [{name: 'a', ...}, {name: 'a', ...}, {name: 'a', ...}].
0 commit comments