Skip to content

Commit

Permalink
weird try at mysql
Browse files Browse the repository at this point in the history
  • Loading branch information
mtoy-googly-moogly committed Nov 12, 2024
1 parent cdbc0a1 commit e3f27d4
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions packages/malloy/src/dialect/mysql/mysql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -546,11 +546,16 @@ export class MySQLDialect extends Dialect {
return sqlType.match(/^[A-Za-z\s(),0-9]*$/) !== null;
}

sqlLiteralArray(_lit: ArrayLiteralNode): string {
throw new Error('No literal arrays in MySQL');
sqlLiteralArray(lit: ArrayLiteralNode): string {
const array = lit.kids.values.map(val => val.sql);
return '[' + array.join(',') + ']';
}

sqlLiteralRecord(_lit: RecordLiteralNode): string {
throw new Error('No literal records in MySQL');
sqlLiteralRecord(lit: RecordLiteralNode): string {
const pairs = Object.entries(lit.kids).map(
([propName, propVal]) =>
`${this.sqlMaybeQuoteIdentifier(propName)}:${propVal.sql}`
);
return '{' + pairs.join(',') + '}';
}
}

0 comments on commit e3f27d4

Please sign in to comment.