@gristlabs/sqlite3 4.1.1-grist.4 → 4.1.1-grist.5

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@gristlabs/sqlite3",
3
3
  "description": "Asynchronous, non-blocking SQLite3 bindings",
4
- "version": "4.1.1-grist.4",
4
+ "version": "4.1.1-grist.5",
5
5
  "homepage": "https://github.com/mapbox/node-sqlite3",
6
6
  "author": {
7
7
  "name": "MapBox",
package/src/database.cc CHANGED
@@ -365,6 +365,22 @@ Napi::Value Database::Configure(const Napi::CallbackInfo& info) {
365
365
  baton->status = info[1].As<Napi::Number>().Int32Value();
366
366
  db->Schedule(SetBusyTimeout, baton);
367
367
  }
368
+ else if (info[0].StrictEquals( Napi::String::New(env, "limit"))) {
369
+ REQUIRE_ARGUMENTS(3);
370
+ if (!info[1].IsNumber()) {
371
+ Napi::TypeError::New(env, "limit id must be an integer").ThrowAsJavaScriptException();
372
+ return env.Null();
373
+ }
374
+ if (!info[2].IsNumber()) {
375
+ Napi::TypeError::New(env, "limit value must be an integer").ThrowAsJavaScriptException();
376
+ return env.Null();
377
+ }
378
+ Napi::Function handle;
379
+ int id = info[1].As<Napi::Number>().Int32Value();
380
+ int value = info[2].As<Napi::Number>().Int32Value();
381
+ Baton* baton = new LimitBaton(db, handle, id, value);
382
+ db->Schedule(SetLimit, baton);
383
+ }
368
384
  else {
369
385
  Napi::TypeError::New(env, (StringConcat(
370
386
  #if V8_MAJOR_VERSION > 6
@@ -409,6 +425,15 @@ void Database::SetBusyTimeout(Baton* baton) {
409
425
  delete baton;
410
426
  }
411
427
 
428
+ void Database::SetLimit(Baton* b) {
429
+ std::unique_ptr<LimitBaton> baton(static_cast<LimitBaton*>(b));
430
+
431
+ assert(baton->db->open);
432
+ assert(baton->db->_handle);
433
+
434
+ sqlite3_limit(baton->db->_handle, baton->id, baton->value);
435
+ }
436
+
412
437
  void Database::RegisterTraceCallback(Baton* baton) {
413
438
  assert(baton->db->open);
414
439
  assert(baton->db->_handle);
package/src/database.h CHANGED
@@ -71,6 +71,13 @@ public:
71
71
  Baton(db_, cb_), filename(filename_) {}
72
72
  };
73
73
 
74
+ struct LimitBaton : Baton {
75
+ int id;
76
+ int value;
77
+ LimitBaton(Database* db_, Napi::Function cb_, int id_, int value_) :
78
+ Baton(db_, cb_), id(id_), value(value_) {}
79
+ };
80
+
74
81
  typedef void (*Work_Callback)(Baton* baton);
75
82
 
76
83
  struct Call {
@@ -160,6 +167,7 @@ protected:
160
167
  Napi::Value Interrupt(const Napi::CallbackInfo& info);
161
168
 
162
169
  static void SetBusyTimeout(Baton* baton);
170
+ static void SetLimit(Baton* baton);
163
171
 
164
172
  static void RegisterTraceCallback(Baton* baton);
165
173
  static void TraceCallback(void* db, const char* sql);
@@ -61,6 +61,19 @@ Napi::Object RegisterModule(Napi::Env env, Napi::Object exports) {
61
61
  DEFINE_CONSTANT_INTEGER(exports, SQLITE_FORMAT, FORMAT)
62
62
  DEFINE_CONSTANT_INTEGER(exports, SQLITE_RANGE, RANGE)
63
63
  DEFINE_CONSTANT_INTEGER(exports, SQLITE_NOTADB, NOTADB)
64
+
65
+ DEFINE_CONSTANT_INTEGER(exports, SQLITE_LIMIT_LENGTH, LIMIT_LENGTH)
66
+ DEFINE_CONSTANT_INTEGER(exports, SQLITE_LIMIT_SQL_LENGTH, LIMIT_SQL_LENGTH)
67
+ DEFINE_CONSTANT_INTEGER(exports, SQLITE_LIMIT_COLUMN, LIMIT_COLUMN)
68
+ DEFINE_CONSTANT_INTEGER(exports, SQLITE_LIMIT_EXPR_DEPTH, LIMIT_EXPR_DEPTH)
69
+ DEFINE_CONSTANT_INTEGER(exports, SQLITE_LIMIT_COMPOUND_SELECT, LIMIT_COMPOUND_SELECT)
70
+ DEFINE_CONSTANT_INTEGER(exports, SQLITE_LIMIT_VDBE_OP, LIMIT_VDBE_OP)
71
+ DEFINE_CONSTANT_INTEGER(exports, SQLITE_LIMIT_FUNCTION_ARG, LIMIT_FUNCTION_ARG)
72
+ DEFINE_CONSTANT_INTEGER(exports, SQLITE_LIMIT_ATTACHED, LIMIT_ATTACHED)
73
+ DEFINE_CONSTANT_INTEGER(exports, SQLITE_LIMIT_LIKE_PATTERN_LENGTH, LIMIT_LIKE_PATTERN_LENGTH)
74
+ DEFINE_CONSTANT_INTEGER(exports, SQLITE_LIMIT_VARIABLE_NUMBER, LIMIT_VARIABLE_NUMBER)
75
+ DEFINE_CONSTANT_INTEGER(exports, SQLITE_LIMIT_TRIGGER_DEPTH, LIMIT_TRIGGER_DEPTH)
76
+ DEFINE_CONSTANT_INTEGER(exports, SQLITE_LIMIT_WORKER_THREADS, LIMIT_WORKER_THREADS)
64
77
  });
65
78
 
66
79
  return exports;
@@ -1,16 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="CsvFileAttributes">
4
- <option name="attributeMap">
5
- <map>
6
- <entry key="/README.md">
7
- <value>
8
- <Attribute>
9
- <option name="separator" value=":" />
10
- </Attribute>
11
- </value>
12
- </entry>
13
- </map>
14
- </option>
15
- </component>
16
- </project>
@@ -1,154 +0,0 @@
1
- <component name="InspectionProjectProfileManager">
2
- <profile version="1.0">
3
- <option name="myName" value="Project Default" />
4
- <inspection_tool class="CheckEmptyScriptTag" enabled="false" level="WARNING" enabled_by_default="false" />
5
- <inspection_tool class="DuplicatedCode" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
6
- <inspection_tool class="ES6ConvertVarToLetConst" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
7
- <inspection_tool class="ExceptionCaughtLocallyJS" enabled="false" level="WARNING" enabled_by_default="false" />
8
- <inspection_tool class="GrazieInspection" enabled="false" level="TYPO" enabled_by_default="false" />
9
- <inspection_tool class="HtmlUnknownTag" enabled="true" level="WARNING" enabled_by_default="true">
10
- <option name="myValues">
11
- <value>
12
- <list size="7">
13
- <item index="0" class="java.lang.String" itemvalue="nobr" />
14
- <item index="1" class="java.lang.String" itemvalue="noembed" />
15
- <item index="2" class="java.lang.String" itemvalue="comment" />
16
- <item index="3" class="java.lang.String" itemvalue="noscript" />
17
- <item index="4" class="java.lang.String" itemvalue="embed" />
18
- <item index="5" class="java.lang.String" itemvalue="script" />
19
- <item index="6" class="java.lang.String" itemvalue="turbo-frame" />
20
- </list>
21
- </value>
22
- </option>
23
- <option name="myCustomValuesEnabled" value="true" />
24
- </inspection_tool>
25
- <inspection_tool class="HttpUrlsUsage" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
26
- <inspection_tool class="JSCommentMatchesSignature" enabled="false" level="WARNING" enabled_by_default="false" />
27
- <inspection_tool class="JSIgnoredPromiseFromCall" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
28
- <inspection_tool class="JSObjectNullOrUndefined" enabled="false" level="WARNING" enabled_by_default="false" />
29
- <inspection_tool class="PointlessArithmeticExpressionJS" enabled="false" level="WARNING" enabled_by_default="false" />
30
- <inspection_tool class="PyAttributeOutsideInitInspection" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
31
- <inspection_tool class="PyBroadExceptionInspection" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
32
- <inspection_tool class="PyCompatibilityInspection" enabled="true" level="WARNING" enabled_by_default="true">
33
- <option name="ourVersions">
34
- <value>
35
- <list size="1">
36
- <item index="0" class="java.lang.String" itemvalue="3.8" />
37
- </list>
38
- </value>
39
- </option>
40
- </inspection_tool>
41
- <inspection_tool class="PyDecoratorInspection" enabled="false" level="WARNING" enabled_by_default="false" />
42
- <inspection_tool class="PyIncorrectDocstringInspection" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
43
- <inspection_tool class="PyListCreationInspection" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
44
- <inspection_tool class="PyMethodMayBeStaticInspection" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
45
- <inspection_tool class="PyMethodParametersInspection" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
46
- <inspection_tool class="PyPackageRequirementsInspection" enabled="true" level="WARNING" enabled_by_default="true">
47
- <option name="ignoredPackages">
48
- <value>
49
- <list size="24">
50
- <item index="0" class="java.lang.String" itemvalue="argparse" />
51
- <item index="1" class="java.lang.String" itemvalue="boto3" />
52
- <item index="2" class="java.lang.String" itemvalue="botocore" />
53
- <item index="3" class="java.lang.String" itemvalue="sqlalchemy" />
54
- <item index="4" class="java.lang.String" itemvalue="apispec-webframeworks" />
55
- <item index="5" class="java.lang.String" itemvalue="datafunctions" />
56
- <item index="6" class="java.lang.String" itemvalue="flasgger" />
57
- <item index="7" class="java.lang.String" itemvalue="flask" />
58
- <item index="8" class="java.lang.String" itemvalue="jsonrpc" />
59
- <item index="9" class="java.lang.String" itemvalue="marshmallow" />
60
- <item index="10" class="java.lang.String" itemvalue="jsonrpcclient" />
61
- <item index="11" class="java.lang.String" itemvalue="pytest" />
62
- <item index="12" class="java.lang.String" itemvalue="littleutils" />
63
- <item index="13" class="java.lang.String" itemvalue="Django" />
64
- <item index="14" class="java.lang.String" itemvalue="bs4" />
65
- <item index="15" class="java.lang.String" itemvalue="selenium" />
66
- <item index="16" class="java.lang.String" itemvalue="black" />
67
- <item index="17" class="java.lang.String" itemvalue="localstack" />
68
- <item index="18" class="java.lang.String" itemvalue="mkdocs-windmill" />
69
- <item index="19" class="java.lang.String" itemvalue="mkdocs" />
70
- <item index="20" class="java.lang.String" itemvalue="six" />
71
- <item index="21" class="java.lang.String" itemvalue="Flask" />
72
- <item index="22" class="java.lang.String" itemvalue="beautifulsoup4" />
73
- <item index="23" class="java.lang.String" itemvalue="requests" />
74
- </list>
75
- </value>
76
- </option>
77
- </inspection_tool>
78
- <inspection_tool class="PyPep8Inspection" enabled="false" level="WEAK WARNING" enabled_by_default="false">
79
- <option name="ignoredErrors">
80
- <list>
81
- <option value="E402" />
82
- <option value="E131" />
83
- <option value="E265" />
84
- <option value="E722" />
85
- <option value="E266" />
86
- <option value="E128" />
87
- <option value="E501" />
88
- <option value="E231" />
89
- <option value="E721" />
90
- <option value="E203" />
91
- </list>
92
- </option>
93
- </inspection_tool>
94
- <inspection_tool class="PyPep8NamingInspection" enabled="true" level="WEAK WARNING" enabled_by_default="true">
95
- <option name="ignoredErrors">
96
- <list>
97
- <option value="N803" />
98
- <option value="N802" />
99
- <option value="N806" />
100
- <option value="N801" />
101
- </list>
102
- </option>
103
- </inspection_tool>
104
- <inspection_tool class="PyPropertyDefinitionInspection" enabled="false" level="WARNING" enabled_by_default="false" />
105
- <inspection_tool class="PyProtectedMemberInspection" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
106
- <inspection_tool class="PyRedundantParenthesesInspection" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
107
- <inspection_tool class="PyShadowingBuiltinsInspection" enabled="true" level="WEAK WARNING" enabled_by_default="true">
108
- <option name="ignoredNames">
109
- <list>
110
- <option value="filter" />
111
- <option value="format" />
112
- <option value="id" />
113
- </list>
114
- </option>
115
- </inspection_tool>
116
- <inspection_tool class="PyUnresolvedReferencesInspection" enabled="true" level="WARNING" enabled_by_default="true">
117
- <option name="ignoredIdentifiers">
118
- <list>
119
- <option value="cv2.*" />
120
- <option value="stanbic_trader_solutions.sb_analysis.dataframes.Dataframes.proposed_messages" />
121
- <option value="dict.*" />
122
- <option value="api.views.OrganisationMixinWithCreate.request" />
123
- <option value="api.views.OrganisationMixin.serializer_class" />
124
- <option value="api.views.OrganisationMixin.request" />
125
- <option value="api.views.OrganisationMixinWithCreate.get_serializer" />
126
- <option value="api.views.OrganisationMixinWithCreate.get_success_headers" />
127
- <option value="api.views.OrganisationMixinWithCreate.perform_create" />
128
- <option value="_importlib_modulespec.ModuleType.f" />
129
- <option value="pygments.formatters.HtmlFormatter" />
130
- <option value="utils.graphql.OrganisationFilteredDjangoObjectType.Meta.model" />
131
- <option value="utils.graphql.CRUDBundle.Node.Meta" />
132
- <option value="core.graphql.AssessmentConfigNode.logic_implementation" />
133
- <option value="functools._make_key" />
134
- <option value="pygments.lexers.TOMLLexer" />
135
- <option value="list.__getitem__" />
136
- <option value="birdseye.tracer.FrameInfo.*" />
137
- <option value="_ast.stmt.*" />
138
- <option value="_ast.expr.*" />
139
- <option value="_ast.Expr.*" />
140
- <option value="_ast.AST.*" />
141
- </list>
142
- </option>
143
- </inspection_tool>
144
- <inspection_tool class="RegExpRepeatedSpace" enabled="false" level="WARNING" enabled_by_default="false" />
145
- <inspection_tool class="SpellCheckingInspection" enabled="false" level="TYPO" enabled_by_default="false">
146
- <option name="processCode" value="false" />
147
- <option name="processLiterals" value="false" />
148
- <option name="processComments" value="false" />
149
- </inspection_tool>
150
- <inspection_tool class="SqlDialectInspection" enabled="false" level="WARNING" enabled_by_default="false" />
151
- <inspection_tool class="SqlNoDataSourceInspection" enabled="false" level="WARNING" enabled_by_default="false" />
152
- <inspection_tool class="TypeScriptFieldCanBeMadeReadonly" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
153
- </profile>
154
- </component>
@@ -1,6 +0,0 @@
1
- <component name="InspectionProjectProfileManager">
2
- <settings>
3
- <option name="USE_PROJECT_PROFILE" value="false" />
4
- <version value="1.0" />
5
- </settings>
6
- </component>
package/.idea/misc.xml DELETED
@@ -1,4 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="ProjectRootManager" version="2" project-jdk-name="pyenv 3.9" project-jdk-type="Python SDK" />
4
- </project>
package/.idea/modules.xml DELETED
@@ -1,8 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="ProjectModuleManager">
4
- <modules>
5
- <module fileurl="file://$PROJECT_DIR$/.idea/node-sqlite3.iml" filepath="$PROJECT_DIR$/.idea/node-sqlite3.iml" />
6
- </modules>
7
- </component>
8
- </project>
@@ -1,8 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <module type="PYTHON_MODULE" version="4">
3
- <component name="NewModuleRootManager">
4
- <content url="file://$MODULE_DIR$" />
5
- <orderEntry type="inheritedJdk" />
6
- <orderEntry type="sourceFolder" forTests="false" />
7
- </component>
8
- </module>
package/.idea/vcs.xml DELETED
@@ -1,6 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="VcsDirectoryMappings">
4
- <mapping directory="$PROJECT_DIR$" vcs="Git" />
5
- </component>
6
- </project>
Binary file