better-sqlite3-multiple-ciphers 7.6.3-beta.0 → 8.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -17,16 +17,16 @@ The fastest and simplest library for SQLite3 in Node.js. This particular fork su
17
17
  ## Current versions
18
18
 
19
19
  - ### Stable
20
- - **better-sqlite3-multiple-ciphers** - [`7.6.2`](https://github.com/m4heshd/better-sqlite3-multiple-ciphers/releases/tag/v7.6.2)
21
- - **better-sqlite3** - [`7.6.2`](https://github.com/JoshuaWise/better-sqlite3/releases/tag/v7.6.2)
22
- - **SQLite** - [`3.39.1`](https://www.sqlite.org/releaselog/3_39_1.html)
23
- - **SQLite3 Multiple Ciphers** - [`1.4.6`](https://github.com/utelle/SQLite3MultipleCiphers/releases/tag/v1.4.6)
20
+ - **better-sqlite3-multiple-ciphers** - [`8.0.0`](https://github.com/m4heshd/better-sqlite3-multiple-ciphers/releases/tag/v8.0.0)
21
+ - **better-sqlite3** - [`8.0.0`](https://github.com/JoshuaWise/better-sqlite3/releases/tag/v8.0.0)
22
+ - **SQLite** - [`3.40.0`](https://www.sqlite.org/releaselog/3_40_0.html)
23
+ - **SQLite3 Multiple Ciphers** - [`1.5.4`](https://github.com/utelle/SQLite3MultipleCiphers/releases/tag/v1.5.4)
24
24
 
25
25
  - ### Beta
26
- - **better-sqlite3-multiple-ciphers** - [`7.6.3-beta.0`](https://github.com/m4heshd/better-sqlite3-multiple-ciphers/releases/tag/v7.6.3-beta.0)
26
+ - **better-sqlite3-multiple-ciphers** - [`7.6.3-beta.1`](https://github.com/m4heshd/better-sqlite3-multiple-ciphers/releases/tag/v7.6.3-beta.1)
27
27
  - **better-sqlite3** - [`7.6.2`](https://github.com/JoshuaWise/better-sqlite3/releases/tag/v7.6.2)
28
- - **SQLite** - [`3.39.2`](https://www.sqlite.org/releaselog/3_39_2.html)
29
- - **SQLite3 Multiple Ciphers** - [`1.4.8`](https://github.com/utelle/SQLite3MultipleCiphers/releases/tag/v1.4.8)
28
+ - **SQLite** - [`3.39.4`](https://www.sqlite.org/releaselog/3_39_4.html)
29
+ - **SQLite3 Multiple Ciphers** - [`1.5.3`](https://github.com/utelle/SQLite3MultipleCiphers/releases/tag/v1.5.3)
30
30
 
31
31
  ## Help this project stay strong! 💪
32
32
 
@@ -65,9 +65,7 @@ npm install better-sqlite3-multiple-ciphers
65
65
  npm install better-sqlite3-multiple-ciphers@beta
66
66
  ```
67
67
 
68
- > You must be using Node.js v10.20.1 or above. Prebuilt binaries are available for Node.js [LTS versions](https://nodejs.org/en/about/releases/) and Electron. If you have trouble installing, check the [troubleshooting guide](./docs/troubleshooting.md).
69
-
70
- > If you have trouble installing, check the [troubleshooting guide](./docs/troubleshooting.md).
68
+ > You must be using Node.js v14.21.1 or above. Prebuilt binaries are available for Node.js [LTS versions](https://nodejs.org/en/about/releases/) and Electron. If you have trouble installing, check the [troubleshooting guide](./docs/troubleshooting.md).
71
69
 
72
70
  ## Usage
73
71
 
@@ -78,18 +76,25 @@ const row = db.prepare('SELECT * FROM users WHERE id = ?').get(userId);
78
76
  console.log(row.firstName, row.lastName, row.email);
79
77
  ```
80
78
 
79
+ Though not required, [it is generally important to set the WAL pragma for performance reasons](https://github.com/WiseLibs/better-sqlite3/blob/master/docs/performance.md).
80
+
81
+ ```js
82
+ db.pragma('journal_mode = WAL');
83
+ ```
84
+
81
85
  ##### In ES6 module notation:
82
86
 
83
87
  ```js
84
88
  import Database from 'better-sqlite3-multiple-ciphers';
85
89
  const db = new Database('foobar.db', options);
90
+ db.pragma('journal_mode = WAL');
86
91
  ```
87
92
 
88
93
  ### Encryption
89
94
 
90
95
  A database can be encrypted and decrypted simply using `key` and `rekey` `PRAGMA` statements.
91
96
 
92
- Running this will encrypt the database using the default cipher:
97
+ **Running this will encrypt the database using the default cipher:**
93
98
 
94
99
  ```js
95
100
  const db = require('better-sqlite3-multiple-ciphers')('foobar.db', options);
@@ -98,17 +103,30 @@ db.pragma("rekey='secret-key'");
98
103
  db.close();
99
104
  ```
100
105
 
101
- To read an encrypted database (assuming default cipher):
106
+ **To read an encrypted database (assuming default cipher):**
107
+
108
+ ```js
109
+ const db = require('better-sqlite3-multiple-ciphers')('foobar.db', options);
110
+
111
+ db.pragma("key='secret-key'");
112
+ const row = db.prepare("SELECT * FROM users WHERE id = ?").get(userId);
113
+ console.log(row.firstName, row.lastName, row.email);
114
+ ```
115
+
116
+ **To read an encrypted database _(legacy SQLCipher)_ created by tools like [DB Browser for SQLite](https://github.com/sqlitebrowser/sqlitebrowser):**
102
117
 
103
118
  ```js
104
119
  const db = require('better-sqlite3-multiple-ciphers')('foobar.db', options);
105
120
 
121
+ db.pragma(`cipher='sqlcipher'`)
122
+ db.pragma(`legacy=4`)
106
123
  db.pragma("key='secret-key'");
107
124
  const row = db.prepare("SELECT * FROM users WHERE id = ?").get(userId);
108
125
  console.log(row.firstName, row.lastName, row.email);
109
126
  ```
127
+ The same method should be used if you want to create a new encrypted database that can be opened using DB Browser for SQLite.
110
128
 
111
- Read more about encryption at [SQLite3MultipleCiphers documentation](https://utelle.github.io/SQLite3MultipleCiphers/).
129
+ ### Read more about encryption at [SQLite3MultipleCiphers documentation](https://utelle.github.io/SQLite3MultipleCiphers/).
112
130
 
113
131
  ## Why should I use this instead of [node-sqlite3](https://github.com/mapbox/node-sqlite3)?
114
132
 
package/binding.gyp CHANGED
@@ -9,9 +9,16 @@
9
9
  'target_name': 'better_sqlite3',
10
10
  'dependencies': ['deps/sqlite3.gyp:sqlite3'],
11
11
  'sources': ['src/better_sqlite3.cpp'],
12
- 'cflags': ['-std=c++14'],
12
+ 'cflags_cc': ['-std=c++17'],
13
13
  'xcode_settings': {
14
- 'OTHER_CPLUSPLUSFLAGS': ['-std=c++14', '-stdlib=libc++'],
14
+ 'OTHER_CPLUSPLUSFLAGS': ['-std=c++17', '-stdlib=libc++'],
15
+ },
16
+ 'msvs_settings': {
17
+ 'VCCLCompilerTool': {
18
+ 'AdditionalOptions': [
19
+ '/std:c++17'
20
+ ]
21
+ }
15
22
  },
16
23
  'conditions': [
17
24
  ['OS=="linux"', {
package/deps/defines.gypi CHANGED
@@ -1,42 +1,42 @@
1
- # THIS FILE IS AUTOMATICALLY GENERATED (DO NOT EDIT)
1
+ # THIS FILE IS AUTOMATICALLY GENERATED BY deps/download.sh (DO NOT EDIT)
2
2
 
3
3
  {
4
4
  'defines': [
5
- 'SQLITE_DQS=0',
6
- 'SQLITE_LIKE_DOESNT_MATCH_BLOBS',
7
- 'SQLITE_THREADSAFE=2',
8
- 'SQLITE_USE_URI=0',
9
- 'SQLITE_DEFAULT_MEMSTATUS=0',
10
- 'SQLITE_OMIT_DEPRECATED',
11
- 'SQLITE_OMIT_GET_TABLE',
12
- 'SQLITE_OMIT_TCL_VARIABLE',
13
- 'SQLITE_OMIT_PROGRESS_CALLBACK',
14
- 'SQLITE_OMIT_SHARED_CACHE',
15
- 'SQLITE_TRACE_SIZE_LIMIT=32',
5
+ 'HAVE_INT16_T=1',
6
+ 'HAVE_INT32_T=1',
7
+ 'HAVE_INT8_T=1',
8
+ 'HAVE_STDINT_H=1',
9
+ 'HAVE_UINT16_T=1',
10
+ 'HAVE_UINT32_T=1',
11
+ 'HAVE_UINT8_T=1',
16
12
  'SQLITE_DEFAULT_CACHE_SIZE=-16000',
17
13
  'SQLITE_DEFAULT_FOREIGN_KEYS=1',
14
+ 'SQLITE_DEFAULT_MEMSTATUS=0',
18
15
  'SQLITE_DEFAULT_WAL_SYNCHRONOUS=1',
19
- 'SQLITE_ENABLE_MATH_FUNCTIONS',
20
- 'SQLITE_ENABLE_DESERIALIZE',
16
+ 'SQLITE_DQS=0',
21
17
  'SQLITE_ENABLE_COLUMN_METADATA',
22
- 'SQLITE_ENABLE_UPDATE_DELETE_LIMIT',
23
- 'SQLITE_ENABLE_STAT4',
24
- 'SQLITE_ENABLE_FTS3_PARENTHESIS',
18
+ 'SQLITE_ENABLE_DESERIALIZE',
25
19
  'SQLITE_ENABLE_FTS3',
20
+ 'SQLITE_ENABLE_FTS3_PARENTHESIS',
26
21
  'SQLITE_ENABLE_FTS4',
27
22
  'SQLITE_ENABLE_FTS5',
23
+ 'SQLITE_ENABLE_GEOPOLY',
28
24
  'SQLITE_ENABLE_JSON1',
25
+ 'SQLITE_ENABLE_MATH_FUNCTIONS',
29
26
  'SQLITE_ENABLE_RTREE',
30
- 'SQLITE_ENABLE_GEOPOLY',
27
+ 'SQLITE_ENABLE_STAT4',
28
+ 'SQLITE_ENABLE_UPDATE_DELETE_LIMIT',
31
29
  'SQLITE_INTROSPECTION_PRAGMAS',
30
+ 'SQLITE_LIKE_DOESNT_MATCH_BLOBS',
31
+ 'SQLITE_OMIT_DEPRECATED',
32
+ 'SQLITE_OMIT_GET_TABLE',
33
+ 'SQLITE_OMIT_PROGRESS_CALLBACK',
34
+ 'SQLITE_OMIT_SHARED_CACHE',
35
+ 'SQLITE_OMIT_TCL_VARIABLE',
32
36
  'SQLITE_SOUNDEX',
33
- 'HAVE_STDINT_H=1',
34
- 'HAVE_INT8_T=1',
35
- 'HAVE_INT16_T=1',
36
- 'HAVE_INT32_T=1',
37
- 'HAVE_UINT8_T=1',
38
- 'HAVE_UINT16_T=1',
39
- 'HAVE_UINT32_T=1',
37
+ 'SQLITE_THREADSAFE=2',
38
+ 'SQLITE_TRACE_SIZE_LIMIT=32',
40
39
  'SQLITE_USER_AUTHENTICATION=0',
40
+ 'SQLITE_USE_URI=0',
41
41
  ],
42
42
  }
package/deps/download.sh CHANGED
@@ -1,111 +1,114 @@
1
- #!/usr/bin/env bash
2
-
3
- # ===
4
- # This script defines and generates the bundled SQLite3 unit (sqlite3.c).
5
- #
6
- # The following steps are taken:
7
- # 1. populate the shell environment with the defined compile-time options.
8
- # 2. download and extract the SQLite3 source code into a temporary directory.
9
- # 3. run "sh configure" and "make sqlite3.c" within the source directory.
10
- # 4. copy the generated amalgamation into the output directory (./sqlite3).
11
- # 5. export the defined compile-time options to a gyp file (./defines.gypi).
12
- # 6. update the docs (../docs/compilation.md) with details of this distribution.
13
- #
14
- # When a user builds better-sqlite3, the following steps are taken:
15
- # 1. node-gyp loads the previously exported compile-time options (defines.gypi).
16
- # 2. the copy.js script copies the bundled amalgamation into the build folder.
17
- # 3. node-gyp compiles the copied sqlite3.c along with better_sqlite3.cpp.
18
- # 4. node-gyp links the two resulting binaries to generate better_sqlite3.node.
19
- # ===
20
-
21
- YEAR="2022"
22
- VERSION="3380200"
23
-
24
- DEFINES="
25
- SQLITE_DQS=0
26
- SQLITE_LIKE_DOESNT_MATCH_BLOBS
27
- SQLITE_THREADSAFE=2
28
- SQLITE_USE_URI=0
29
- SQLITE_DEFAULT_MEMSTATUS=0
30
- SQLITE_OMIT_DEPRECATED
31
- SQLITE_OMIT_GET_TABLE
32
- SQLITE_OMIT_TCL_VARIABLE
33
- SQLITE_OMIT_PROGRESS_CALLBACK
34
- SQLITE_OMIT_SHARED_CACHE
35
- SQLITE_TRACE_SIZE_LIMIT=32
36
- SQLITE_DEFAULT_CACHE_SIZE=-16000
37
- SQLITE_DEFAULT_FOREIGN_KEYS=1
38
- SQLITE_DEFAULT_WAL_SYNCHRONOUS=1
39
- SQLITE_ENABLE_MATH_FUNCTIONS
40
- SQLITE_ENABLE_DESERIALIZE
41
- SQLITE_ENABLE_COLUMN_METADATA
42
- SQLITE_ENABLE_UPDATE_DELETE_LIMIT
43
- SQLITE_ENABLE_STAT4
44
- SQLITE_ENABLE_FTS3_PARENTHESIS
45
- SQLITE_ENABLE_FTS3
46
- SQLITE_ENABLE_FTS4
47
- SQLITE_ENABLE_FTS5
48
- SQLITE_ENABLE_JSON1
49
- SQLITE_ENABLE_RTREE
50
- SQLITE_ENABLE_GEOPOLY
51
- SQLITE_INTROSPECTION_PRAGMAS
52
- SQLITE_SOUNDEX
53
- HAVE_STDINT_H=1
54
- HAVE_INT8_T=1
55
- HAVE_INT16_T=1
56
- HAVE_INT32_T=1
57
- HAVE_UINT8_T=1
58
- HAVE_UINT16_T=1
59
- HAVE_UINT32_T=1
60
- SQLITE_USER_AUTHENTICATION=0
61
- "
62
-
63
- # ========== START SCRIPT ========== #
64
-
65
- echo "setting up environment..."
66
- DEPS="$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)"
67
- TEMP="$DEPS/temp"
68
- OUTPUT="$DEPS/sqlite3"
69
- rm -rf "$TEMP"
70
- rm -rf "$OUTPUT"
71
- mkdir -p "$TEMP"
72
- mkdir -p "$OUTPUT"
73
- export CFLAGS=`echo $(echo "$DEFINES" | sed -e "/^\s*$/d" -e "s/^/-D/")`
74
-
75
- echo "downloading source..."
76
- curl -#f "https://www.sqlite.org/$YEAR/sqlite-src-$VERSION.zip" > "$TEMP/source.zip" || exit 1
77
-
78
- echo "extracting source..."
79
- unzip "$TEMP/source.zip" -d "$TEMP" > /dev/null || exit 1
80
- cd "$TEMP/sqlite-src-$VERSION" || exit 1
81
-
82
- echo "configuring amalgamation..."
83
- sh configure > /dev/null || exit 1
84
-
85
- echo "building amalgamation..."
86
- make sqlite3.c > /dev/null || exit 1
87
-
88
- echo "copying amalgamation..."
89
- cp sqlite3.c sqlite3.h sqlite3ext.h "$OUTPUT/" || exit 1
90
-
91
- echo "updating gyp configs..."
92
- GYP="$DEPS/defines.gypi"
93
- printf "# THIS FILE IS AUTOMATICALLY GENERATED (DO NOT EDIT)\n\n{\n 'defines': [\n" > "$GYP"
94
- printf "$DEFINES" | sed -e "/^\s*$/d" -e "s/\(.*\)/ '\1',/" >> "$GYP"
95
- printf " ],\n}\n" >> "$GYP"
96
-
97
- echo "updating docs..."
98
- DOCS="$DEPS/../docs/compilation.md"
99
- MAJOR=`expr "${VERSION:0:1}" + 0`
100
- MINOR=`expr "${VERSION:1:2}" + 0`
101
- PATCH=`expr "${VERSION:3:2}" + 0`
102
- sed -Ei "" -e "s/version [0-9]+\.[0-9]+\.[0-9]+/version $MAJOR.$MINOR.$PATCH/g" "$DOCS"
103
- sed -i "" -e "/^SQLITE_/,\$d" "$DOCS"
104
- printf "$DEFINES" | sed -e "/^\s*$/d" >> "$DOCS"
105
- printf "\`\`\`\n" >> "$DOCS"
106
-
107
- echo "cleaning up..."
108
- cd - > /dev/null || exit 1
109
- rm -rf "$TEMP"
110
-
111
- echo "done!"
1
+ #!/usr/bin/env bash
2
+
3
+ # ===
4
+ # This script defines and generates the bundled SQLite3 unit (sqlite3.c).
5
+ #
6
+ # The following steps are taken:
7
+ # 1. populate the shell environment with the defined compile-time options.
8
+ # 2. download and extract the SQLite3 source code into a temporary directory.
9
+ # 3. run "sh configure" and "make sqlite3.c" within the source directory.
10
+ # 4. copy the generated amalgamation into the output directory (./sqlite3).
11
+ # 5. export the defined compile-time options to a gyp file (./defines.gypi).
12
+ # 6. update the docs (../docs/compilation.md) with details of this distribution.
13
+ #
14
+ # When a user builds better-sqlite3, the following steps are taken:
15
+ # 1. node-gyp loads the previously exported compile-time options (defines.gypi).
16
+ # 2. the copy.js script copies the bundled amalgamation into the build folder.
17
+ # 3. node-gyp compiles the copied sqlite3.c along with better_sqlite3.cpp.
18
+ # 4. node-gyp links the two resulting binaries to generate better_sqlite3.node.
19
+ # ===
20
+
21
+ YEAR="2022"
22
+ VERSION="3380200"
23
+
24
+ # Defines below are sorted alphabetically
25
+ DEFINES="
26
+ HAVE_INT16_T=1
27
+ HAVE_INT32_T=1
28
+ HAVE_INT8_T=1
29
+ HAVE_STDINT_H=1
30
+ HAVE_UINT16_T=1
31
+ HAVE_UINT32_T=1
32
+ HAVE_UINT8_T=1
33
+ SQLITE_DEFAULT_CACHE_SIZE=-16000
34
+ SQLITE_DEFAULT_FOREIGN_KEYS=1
35
+ SQLITE_DEFAULT_MEMSTATUS=0
36
+ SQLITE_DEFAULT_WAL_SYNCHRONOUS=1
37
+ SQLITE_DQS=0
38
+ SQLITE_ENABLE_COLUMN_METADATA
39
+ SQLITE_ENABLE_DESERIALIZE
40
+ SQLITE_ENABLE_FTS3
41
+ SQLITE_ENABLE_FTS3_PARENTHESIS
42
+ SQLITE_ENABLE_FTS4
43
+ SQLITE_ENABLE_FTS5
44
+ SQLITE_ENABLE_GEOPOLY
45
+ SQLITE_ENABLE_JSON1
46
+ SQLITE_ENABLE_MATH_FUNCTIONS
47
+ SQLITE_ENABLE_RTREE
48
+ SQLITE_ENABLE_STAT4
49
+ SQLITE_ENABLE_UPDATE_DELETE_LIMIT
50
+ SQLITE_INTROSPECTION_PRAGMAS
51
+ SQLITE_LIKE_DOESNT_MATCH_BLOBS
52
+ SQLITE_OMIT_DEPRECATED
53
+ SQLITE_OMIT_GET_TABLE
54
+ SQLITE_OMIT_PROGRESS_CALLBACK
55
+ SQLITE_OMIT_SHARED_CACHE
56
+ SQLITE_OMIT_TCL_VARIABLE
57
+ SQLITE_SOUNDEX
58
+ SQLITE_THREADSAFE=2
59
+ SQLITE_TRACE_SIZE_LIMIT=32
60
+ SQLITE_USER_AUTHENTICATION=0
61
+ SQLITE_USE_URI=0
62
+ "
63
+
64
+ # ========== START SCRIPT ========== #
65
+
66
+ echo "setting up environment..."
67
+ DEPS="$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)"
68
+ TEMP="$DEPS/temp"
69
+ OUTPUT="$DEPS/sqlite3"
70
+ rm -rf "$TEMP"
71
+ rm -rf "$OUTPUT"
72
+ mkdir -p "$TEMP"
73
+ mkdir -p "$OUTPUT"
74
+ export CFLAGS=`echo $(echo "$DEFINES" | sed -e "/^\s*$/d" -e "s/^/-D/")`
75
+
76
+ echo "downloading source..."
77
+ curl -#f "https://www.sqlite.org/$YEAR/sqlite-src-$VERSION.zip" > "$TEMP/source.zip" || exit 1
78
+
79
+ echo "extracting source..."
80
+ unzip "$TEMP/source.zip" -d "$TEMP" > /dev/null || exit 1
81
+ cd "$TEMP/sqlite-src-$VERSION" || exit 1
82
+
83
+ echo "configuring amalgamation..."
84
+ sh configure > /dev/null || exit 1
85
+
86
+ echo "building amalgamation..."
87
+ make sqlite3.c > /dev/null || exit 1
88
+
89
+ echo "copying amalgamation..."
90
+ cp sqlite3.c sqlite3.h sqlite3ext.h "$OUTPUT/" || exit 1
91
+
92
+ echo "updating gyp configs..."
93
+ GYP="$DEPS/defines.gypi"
94
+ printf "# THIS FILE IS AUTOMATICALLY GENERATED BY deps/download.sh (DO NOT EDIT)\n\n{\n 'defines': [\n" > "$GYP"
95
+ printf "$DEFINES" | sed -e "/^\s*$/d" -e "s/\(.*\)/ '\1',/" >> "$GYP"
96
+ printf " ],\n}\n" >> "$GYP"
97
+
98
+ echo "updating docs..."
99
+ DOCS="$DEPS/../docs/compilation.md"
100
+ MAJOR=`expr "${VERSION:0:1}" + 0`
101
+ MINOR=`expr "${VERSION:1:2}" + 0`
102
+ PATCH=`expr "${VERSION:3:2}" + 0`
103
+ sed -Ei.bak -e "s/version [0-9]+\.[0-9]+\.[0-9]+/version $MAJOR.$MINOR.$PATCH/g" "$DOCS"
104
+ sed -i.bak -e "/^SQLITE_/,\$d" "$DOCS"
105
+ sed -i.bak -e "/^HAVE_/,\$d" "$DOCS"
106
+ rm "$DOCS".bak
107
+ printf "$DEFINES" | sed -e "/^\s*$/d" >> "$DOCS"
108
+ printf "\`\`\`\n" >> "$DOCS"
109
+
110
+ echo "cleaning up..."
111
+ cd - > /dev/null || exit 1
112
+ rm -rf "$TEMP"
113
+
114
+ echo "done!"
package/deps/setup.ps1 CHANGED
@@ -2,7 +2,7 @@
2
2
  $ErrorActionPreference = "Stop"
3
3
 
4
4
  # SQLite Info
5
- $SQLITEMC_VER = "v1.4.8"
5
+ $SQLITEMC_VER = "v1.5.4"
6
6
  $API_URL = "https://api.github.com/repos/utelle/SQLite3MultipleCiphers/releases/tags/" + $SQLITEMC_VER
7
7
 
8
8
  # Paths