@cheetah.js/orm 0.1.80 → 0.1.83

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.
@@ -211,7 +211,6 @@ class SqlBuilder {
211
211
  return parseInt(result.query.rows[0].count);
212
212
  }
213
213
  logExecution(result) {
214
- console.log(result.sql);
215
214
  this.logger.debug(`SQL: ${result.sql} [${Date.now() - result.startTime}ms]`);
216
215
  }
217
216
  async inTransaction(callback) {
@@ -14,6 +14,7 @@ export declare abstract class BunDriverBase implements Partial<DriverInterface>
14
14
  executeSql(sqlString: string): Promise<any>;
15
15
  transaction<T>(callback: (tx: SQL) => Promise<T>): Promise<T>;
16
16
  protected toDatabaseValue(value: unknown): string | number | boolean;
17
+ protected escapeString(value: string): string;
17
18
  protected escapeIdentifier(identifier: string): string;
18
19
  protected buildWhereClause(where: string | undefined): string;
19
20
  protected buildOrderByClause(orderBy: string[] | undefined): string;
@@ -48,17 +48,20 @@ class BunDriverBase {
48
48
  }
49
49
  switch (typeof value) {
50
50
  case 'string':
51
- return `'${value}'`;
51
+ return `'${this.escapeString(value)}'`;
52
52
  case 'number':
53
53
  return value;
54
54
  case 'boolean':
55
55
  return value;
56
56
  case 'object':
57
- return `'${JSON.stringify(value)}'`;
57
+ return `'${this.escapeString(JSON.stringify(value))}'`;
58
58
  default:
59
- return `'${value}'`;
59
+ return `'${this.escapeString(String(value))}'`;
60
60
  }
61
61
  }
62
+ escapeString(value) {
63
+ return value.replace(/'/g, "''");
64
+ }
62
65
  escapeIdentifier(identifier) {
63
66
  return `"${identifier}"`;
64
67
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cheetah.js/orm",
3
- "version": "0.1.80",
3
+ "version": "0.1.83",
4
4
  "description": "A simple ORM for Cheetah.js",
5
5
  "type": "commonjs",
6
6
  "main": "dist/index.js",
@@ -55,5 +55,5 @@
55
55
  "bun",
56
56
  "value-object"
57
57
  ],
58
- "gitHead": "c9e4854c50d748296a78194a820036f55263ccb3"
58
+ "gitHead": "68ad3f3b572a4a833cc56bb78db496c600a1d06d"
59
59
  }