From cc279c8f6c7e00929b31626f4f168534bcffe3e7 Mon Sep 17 00:00:00 2001 From: Michael Toy <66150587+mtoy-googly-moogly@users.noreply.github.com> Date: Fri, 29 Nov 2024 12:38:21 -0800 Subject: [PATCH] more proper quoting --- packages/malloy/src/dialect/mysql/mysql.ts | 2 +- .../src/dialect/standardsql/standardsql.ts | 100 ------------------ 2 files changed, 1 insertion(+), 101 deletions(-) diff --git a/packages/malloy/src/dialect/mysql/mysql.ts b/packages/malloy/src/dialect/mysql/mysql.ts index def4f51a5..af7710e54 100644 --- a/packages/malloy/src/dialect/mysql/mysql.ts +++ b/packages/malloy/src/dialect/mysql/mysql.ts @@ -351,7 +351,7 @@ export class MySQLDialect extends Dialect { } sqlMaybeQuoteIdentifier(identifier: string): string { - return `\`${identifier}\``; + return '"' + identifier.replace(/"/g, '""') + '"'; } // TODO: Check what this is. diff --git a/packages/malloy/src/dialect/standardsql/standardsql.ts b/packages/malloy/src/dialect/standardsql/standardsql.ts index 06cd24cae..39246c7ba 100644 --- a/packages/malloy/src/dialect/standardsql/standardsql.ts +++ b/packages/malloy/src/dialect/standardsql/standardsql.ts @@ -270,107 +270,7 @@ ${indent(sql)} return `(SELECT AS STRUCT ${alias}.*)`; } - keywords = ` - ALL - AND - ANY - ARRAY - AS - ASC - ASSERT_ROWS_MODIFIED - AT - BETWEEN - BY - CASE - CAST - COLLATE - CONTAINS - CREATE - CROSS - CUBE - CURRENT - DEFAULT - DEFINE - DESC - DISTINCT - ELSE - END - ENUM - ESCAPE - EXCEPT - EXCLUDE - EXISTS - EXTRACT - FALSE - FETCH - FOLLOWING - FOR - FROM - FULL - GROUP - GROUPING - GROUPS - HASH - HAVING - IF - IGNORE - IN - INNER - INTERSECT - INTERVAL - INTO - IS - JOIN - LATERAL - LEFT - LIKE - LIMIT - LOOKUP - MERGE - NATURAL - NEW - NO - NOT - NULL - NULLS - OF - ON - OR - ORDER - OUTER - OVER - PARTITION - PRECEDING - PROTO - RANGE - RECURSIVE - RESPECT - RIGHT - ROLLUP - ROWS - SELECT - SET - SOME - STRUCT - TABLESAMPLE - THEN - TO - TREAT - TRUE - UNBOUNDED - UNION - UNNEST - USING - WHEN - WHERE - WINDOW - WITH - WITHIN`.split(/\s/); - sqlMaybeQuoteIdentifier(identifier: string): string { - // return this.keywords.indexOf(identifier.toUpperCase()) > 0 - // ? '`' + identifier + '`' - // : identifier; return '`' + identifier + '`'; }