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: SM Delimiter-Separated Values.md
+4-4Lines changed: 4 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -25,14 +25,14 @@ FROM json_each('["' || replace('usr/share/man', '/', '", "') || '"]') AS terms;
25
25
| 2 | share |
26
26
| 3 | man |
27
27
28
-
This query will fail if the string contains quotation marks or backslashes (assuming these characters are not JSON escaped). Another potential issue involves leading and terminal separators. However, developing a universal string-splitting SQL script is impractical. Instead, the script functionality should match reasonable assumptions about the input format for a specific use case.
28
+
This query will fail if the string contains quotation marks or backslashes (assuming these characters are not JSON escaped). Another potential issue involves leading and trailing separators. However, developing a universal string-splitting SQL script is impractical. Instead, the script functionality should match reasonable assumptions about the input format for a specific use case.
29
29
30
30
For instance, let's improve the script to
31
31
32
32
- split path-like variables (both Linux and Windows styles),
33
-
- handle leading/terminal value separator,
33
+
- handle leading/trailing value separator,
34
34
- handle doubled value separators (such as ";;"),
35
-
- normalize all paths by stripping leading/terminal path separators,
35
+
- normalize all paths by stripping leading/trailing path separators,
36
36
- convert any backslashes to slashes.
37
37
38
38
<aname="DSV-Query"></a>
@@ -69,7 +69,7 @@ Going from top to bottom:
69
69
70
70
- *params* acts as surrogate variables. *params* has one row, and it defines value and path separators. If this flexibility is excessive or unnecessary, adjust or remove this block. With the given definition, this query handles the Linux-style path variable, and the *params.sep* must be adjusted for Windows-style paths.
71
71
- *string_data* defines the input data to be processed.
72
-
- *clean_strings* performs input preprocessing. This code may clean leading/terminal/duplicate value separators and escape backslashes.
72
+
- *clean_strings* performs input preprocessing. This code may clean leading/trailing/duplicate value separators and escape backslashes.
73
73
- *json_strings* formats the preprocessed output of *clean_strings* as JSON arrays.
74
74
- *raw_terms* splits the input (*json_each* unescapes backslashes automatically).
75
75
- *term* performs postprocessing (in this case, it replaces backslashes with slashes).
0 commit comments