Skip to content

Commit bad9339

Browse files
danielgindikewde
authored andcommitted
Allow custom magic to be specified through --sqlite_magic (#1144)
1 parent ae93b50 commit bad9339

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,17 @@ This uses the npm_config_python config, so values in .npmrc will be honoured:
9999

100100
python=/usr/bin/python2
101101

102+
## Custom file header (magic)
103+
104+
The default sqlite file header is "SQLite format 3".
105+
You can specify a different magic, though this will make standard tools and libraries unable to work with your files.
106+
107+
108+
npm install --build-from-source --sqlite_magic="MyCustomMagic15"
109+
110+
111+
Note that the magic *must* be exactly 15 characters long (16 bytes including null terminator).
112+
102113
## Building for node-webkit
103114

104115
Because of ABI differences, `sqlite3` must be built in a custom to be used with [node-webkit](https://github.com/rogerwang/node-webkit).

deps/sqlite3.gyp

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
{
22
'includes': [ 'common-sqlite.gypi' ],
3+
4+
'variables': {
5+
'sqlite_magic%': '',
6+
},
7+
38
'target_defaults': {
49
'default_configuration': 'Release',
510
'cflags':[
@@ -101,7 +106,14 @@
101106
],
102107
'export_dependent_settings': [
103108
'action_before_build',
104-
]
109+
],
110+
'conditions': [
111+
["sqlite_magic != ''", {
112+
'defines': [
113+
'SQLITE_FILE_HEADER="<(sqlite_magic)"'
114+
]
115+
}]
116+
],
105117
}
106118
]
107119
}

0 commit comments

Comments
 (0)