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: machines/send-native-query.js
+15-21Lines changed: 15 additions & 21 deletions
Original file line number
Diff line number
Diff line change
@@ -23,17 +23,23 @@ module.exports = {
23
23
},
24
24
25
25
nativeQuery: {
26
-
description: 'A SQL statement as a string (or to use built-in escaping, this should be provided as a dictionary).',
27
-
extendedDescription: 'If provided as a dictionary, this should contain `sql` (the SQL statement string; e.g. \'SELECT * FROM dogs WHERE name = ?\') as well as an array of `bindings` (e.g. [\'David\']).',
extendedDescription: 'If `valuesToEscape` is provided, this supports template syntax like `$1`, `$2`, etc.',
29
28
whereToGet: {
30
-
description: 'This is oftentimes compiled from Waterline query syntax using "Compile statement", however it could also originate from userland code.',
29
+
description: 'Write a native query for this database, or if this driver supports it, use `compileStatement()` to build a native query from Waterline syntax.',
30
+
extendedDescription: 'This might be compiled from a Waterline statement (stage 4 query) using "Compile statement", however it could also originate directly from userland code.'
31
31
},
32
-
example: '===',
33
-
// example: '*',
32
+
example: 'SELECT * FROM pets WHERE species=$1 AND nickname=$2',
34
33
required: true
35
34
},
36
35
36
+
valuesToEscape: {
37
+
description: 'An optional list of strings, numbers, or special literals (true, false, or null) to escape and include in the native query, in order.',
38
+
extendedDescription: 'Note that numbers, `true`, `false`, and `null` are all interpreted exactly the same way as if they were wrapped in quotes. This array must never contain any arrays or dictionaries. The first value in the list will be used to replace `$1`, the second value to replace `$2`, and so on.',
39
+
example: '===',
40
+
defaultsTo: []
41
+
},
42
+
37
43
meta: {
38
44
friendlyName: 'Meta (custom)',
39
45
description: 'Additional stuff to pass to the driver.',
@@ -95,21 +101,9 @@ module.exports = {
95
101
}
96
102
97
103
98
-
// Validate query
99
-
// (supports raw SQL string or dictionary consisting of `sql` and `bindings` properties)
returnexits.error(newError('Provided `nativeQuery` is invalid. Please specify either a string of raw SQL or a dictionary like `{sql: \'SELECT * FROM dogs WHERE name = $1\', bindings: [\'Rover\']}`.'));
0 commit comments