@dbml/core 5.2.0 → 5.3.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.
|
@@ -118,6 +118,11 @@ var createCompilerError = function createCompilerError(ctx, message) {
|
|
|
118
118
|
}
|
|
119
119
|
}]);
|
|
120
120
|
};
|
|
121
|
+
var unquoteString = function unquoteString(str) {
|
|
122
|
+
var quoteChar = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '"';
|
|
123
|
+
return !str.startsWith(quoteChar) ? str : str.slice(1, -1) // Strip off starting and ending quotes
|
|
124
|
+
.replaceAll("".concat(quoteChar).concat(quoteChar), quoteChar); // Unescape quotes, in Oracle, quotes are escaped by doubling it
|
|
125
|
+
};
|
|
121
126
|
|
|
122
127
|
// Only methods for rules representing whole statements can mutate `data`:
|
|
123
128
|
// * create_table
|
|
@@ -649,11 +654,7 @@ var OracleSqlASTGen = exports["default"] = /*#__PURE__*/function (_OracleSqlPars
|
|
|
649
654
|
key: "visitIdentifier",
|
|
650
655
|
value: function visitIdentifier(ctx) {
|
|
651
656
|
var text = (0, _helpers.getOriginalText)(ctx);
|
|
652
|
-
|
|
653
|
-
return text.substring(1, text.length - 1);
|
|
654
|
-
}
|
|
655
|
-
text.replace('""', '"');
|
|
656
|
-
return text;
|
|
657
|
+
return unquoteString(text);
|
|
657
658
|
}
|
|
658
659
|
}, {
|
|
659
660
|
key: "visitType_name",
|
|
@@ -674,7 +675,7 @@ var OracleSqlASTGen = exports["default"] = /*#__PURE__*/function (_OracleSqlPars
|
|
|
674
675
|
value: function visitDatatype(ctx) {
|
|
675
676
|
var typeName = (0, _helpers.getOriginalText)(ctx);
|
|
676
677
|
return {
|
|
677
|
-
type_name: typeName
|
|
678
|
+
type_name: unquoteString(typeName)
|
|
678
679
|
};
|
|
679
680
|
}
|
|
680
681
|
|
|
@@ -958,7 +959,7 @@ var OracleSqlASTGen = exports["default"] = /*#__PURE__*/function (_OracleSqlPars
|
|
|
958
959
|
}, {
|
|
959
960
|
key: "visitConstraint_name",
|
|
960
961
|
value: function visitConstraint_name(ctx) {
|
|
961
|
-
return (0, _helpers.getOriginalText)(ctx);
|
|
962
|
+
return unquoteString((0, _helpers.getOriginalText)(ctx));
|
|
962
963
|
}
|
|
963
964
|
}, {
|
|
964
965
|
key: "visitIndex_name",
|
|
@@ -1085,7 +1086,8 @@ var OracleSqlASTGen = exports["default"] = /*#__PURE__*/function (_OracleSqlPars
|
|
|
1085
1086
|
}, {
|
|
1086
1087
|
key: "visitId_expression",
|
|
1087
1088
|
value: function visitId_expression(ctx) {
|
|
1088
|
-
|
|
1089
|
+
var text = (0, _helpers.getOriginalText)(ctx);
|
|
1090
|
+
return unquoteString(text);
|
|
1089
1091
|
}
|
|
1090
1092
|
|
|
1091
1093
|
// expression
|
|
@@ -1106,7 +1108,7 @@ var OracleSqlASTGen = exports["default"] = /*#__PURE__*/function (_OracleSqlPars
|
|
|
1106
1108
|
if (ctx.CHAR_STRING()) {
|
|
1107
1109
|
return {
|
|
1108
1110
|
type: _constants.DATA_TYPE.STRING,
|
|
1109
|
-
value: value
|
|
1111
|
+
value: unquoteString(value, "'") // string literals use single quotes
|
|
1110
1112
|
};
|
|
1111
1113
|
}
|
|
1112
1114
|
if (ctx.TRUE()) {
|
|
@@ -1136,8 +1138,8 @@ var OracleSqlASTGen = exports["default"] = /*#__PURE__*/function (_OracleSqlPars
|
|
|
1136
1138
|
if (ctx.column_name()) {
|
|
1137
1139
|
return {
|
|
1138
1140
|
type: _constants.CONSTRAINT_TYPE.COLUMN,
|
|
1139
|
-
rawValue: value,
|
|
1140
|
-
value: (0, _helpers.getOriginalText)(ctx.column_name())
|
|
1141
|
+
rawValue: unquoteString(value),
|
|
1142
|
+
value: unquoteString((0, _helpers.getOriginalText)(ctx.column_name()))
|
|
1141
1143
|
};
|
|
1142
1144
|
}
|
|
1143
1145
|
return {
|
|
@@ -1148,7 +1150,12 @@ var OracleSqlASTGen = exports["default"] = /*#__PURE__*/function (_OracleSqlPars
|
|
|
1148
1150
|
}, {
|
|
1149
1151
|
key: "visitQuoted_string",
|
|
1150
1152
|
value: function visitQuoted_string(ctx) {
|
|
1151
|
-
return (0, _helpers.getOriginalText)(ctx)
|
|
1153
|
+
return unquoteString((0, _helpers.getOriginalText)(ctx), "'"); // string literals use single quotes
|
|
1154
|
+
}
|
|
1155
|
+
}, {
|
|
1156
|
+
key: "visitRegular_id",
|
|
1157
|
+
value: function visitRegular_id(ctx) {
|
|
1158
|
+
return unquoteString((0, _helpers.getOriginalText)(ctx), '"');
|
|
1152
1159
|
}
|
|
1153
1160
|
}]);
|
|
1154
1161
|
}(_OracleSqlParserVisitor["default"]);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/package",
|
|
3
3
|
"name": "@dbml/core",
|
|
4
|
-
"version": "5.
|
|
4
|
+
"version": "5.3.0",
|
|
5
5
|
"description": "> TODO: description",
|
|
6
6
|
"author": "Holistics <dev@holistics.io>",
|
|
7
7
|
"license": "Apache-2.0",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"lint:fix": "eslint --fix ."
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@dbml/parse": "^5.
|
|
38
|
+
"@dbml/parse": "^5.3.0",
|
|
39
39
|
"antlr4": "^4.13.1",
|
|
40
40
|
"lodash": "^4.17.15",
|
|
41
41
|
"parsimmon": "^1.13.0",
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
"^lodash-es$": "lodash"
|
|
74
74
|
}
|
|
75
75
|
},
|
|
76
|
-
"gitHead": "
|
|
76
|
+
"gitHead": "c8e67b627584b81d18c16a6f2983a92d75a326d9",
|
|
77
77
|
"engines": {
|
|
78
78
|
"node": ">=16"
|
|
79
79
|
}
|