@ronin/compiler 0.12.6 → 0.12.7-leo-ron-1071-experimental-261
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/README.md +2 -2
- package/dist/index.js +5 -5
- package/package.json +1 -1
package/README.md
CHANGED
@@ -65,10 +65,10 @@ Once the RONIN queries have been compiled down to SQL statements, the statements
|
|
65
65
|
executed and their results can be formatted by the compiler as well:
|
66
66
|
|
67
67
|
```typescript
|
68
|
-
// Passing `rawResults` (rows being
|
68
|
+
// Passing `rawResults` (rows being arrays of values) provided by the database (ideal)
|
69
69
|
const results: Array<Result> = transaction.formatResults(rawResults);
|
70
70
|
|
71
|
-
// Passing `objectResults` (rows being
|
71
|
+
// Passing `objectResults` (rows being objects) provided by a driver
|
72
72
|
const results: Array<Result> = transaction.formatResults(objectResults, false);
|
73
73
|
```
|
74
74
|
|
package/dist/index.js
CHANGED
@@ -162,8 +162,8 @@ var splitQuery = (query) => {
|
|
162
162
|
var prepareStatementValue = (statementParams, value) => {
|
163
163
|
if (value === null) return "NULL";
|
164
164
|
if (!statementParams) {
|
165
|
-
const valueString = typeof value === "object" ? JSON.stringify(value) : value.toString()
|
166
|
-
return
|
165
|
+
const valueString = typeof value === "object" ? `json('${JSON.stringify(value)}')` : `'${value.toString()}'`;
|
166
|
+
return valueString;
|
167
167
|
}
|
168
168
|
let formattedValue = value;
|
169
169
|
if (Array.isArray(value) || isObject(value)) {
|
@@ -910,9 +910,9 @@ var transformMetaQuery = (models, dependencyStatements, statementParams, query)
|
|
910
910
|
parentModel: existingModel
|
911
911
|
}).main.statement;
|
912
912
|
});
|
913
|
-
|
914
|
-
statementParts.push(effectStatements.join("; "));
|
915
|
-
|
913
|
+
statementParts.push("BEGIN");
|
914
|
+
statementParts.push(`${effectStatements.join("; ")};`);
|
915
|
+
statementParts.push("END");
|
916
916
|
statement += ` ${statementParts.join(" ")}`;
|
917
917
|
}
|
918
918
|
dependencyStatements.push({ statement, params });
|