diff --git a/src/languages/db2i/db2i.formatter.ts b/src/languages/db2i/db2i.formatter.ts index d76e17cdf0..02fe16e925 100644 --- a/src/languages/db2i/db2i.formatter.ts +++ b/src/languages/db2i/db2i.formatter.ts @@ -169,8 +169,7 @@ export const db2i: DialectOptions = { ], identTypes: [`""-qq`], identChars: { first: '@#$' }, - paramTypes: { positional: true, named: [':'] }, - paramChars: { first: '@#$', rest: '@#$' }, + paramTypes: { positional: true }, operators: ['**', '¬=', '¬>', '¬<', '!>', '!<', '||'], }, formatOptions: { diff --git a/test/behavesLikeDb2Formatter.ts b/test/behavesLikeDb2Formatter.ts index ff82ea1f06..53d4f47a4c 100644 --- a/test/behavesLikeDb2Formatter.ts +++ b/test/behavesLikeDb2Formatter.ts @@ -13,7 +13,6 @@ import supportsDeleteFrom from './features/deleteFrom.js'; import supportsComments from './features/comments.js'; import supportsCommentOn from './features/commentOn.js'; import supportsIdentifiers from './features/identifiers.js'; -import supportsParams from './options/param.js'; import supportsSetOperations from './features/setOperations.js'; import supportsLimiting from './features/limiting.js'; import supportsInsertInto from './features/insertInto.js'; @@ -54,7 +53,6 @@ export default function behavesLikeDb2Formatter(format: FormatFn) { 'INTERSECT', 'INTERSECT ALL', ]); - supportsParams(format, { positional: true, named: [':'] }); supportsLimiting(format, { fetchFirst: true }); it('formats only -- as a line comment', () => { @@ -94,18 +92,6 @@ export default function behavesLikeDb2Formatter(format: FormatFn) { `); }); - it('supports @, #, $ characters in named parameters', () => { - expect(format(`SELECT :foo@bar, :foo#bar, :foo$bar, :@zip, :#zap, :$zop`)).toBe(dedent` - SELECT - :foo@bar, - :foo#bar, - :foo$bar, - :@zip, - :#zap, - :$zop - `); - }); - it('supports WITH isolation level modifiers for UPDATE statement', () => { expect(format('UPDATE foo SET x = 10 WITH CS')).toBe(dedent` UPDATE foo diff --git a/test/db2.test.ts b/test/db2.test.ts index 48b36b53a9..e3b05bd237 100644 --- a/test/db2.test.ts +++ b/test/db2.test.ts @@ -1,9 +1,12 @@ +import dedent from 'dedent-js'; + import { format as originalFormat, FormatFn } from '../src/sqlFormatter.js'; import behavesLikeDb2Formatter from './behavesLikeDb2Formatter.js'; import supportsCreateTable from './features/createTable.js'; import supportsDropTable from './features/dropTable.js'; import supportsJoin from './features/join.js'; +import supportsParams from './options/param.js'; describe('Db2Formatter', () => { const language = 'db2'; @@ -14,4 +17,17 @@ describe('Db2Formatter', () => { supportsCreateTable(format); supportsDropTable(format); supportsJoin(format, { without: ['NATURAL'], supportsUsing: false }); + supportsParams(format, { positional: true, named: [':'] }); + + it('supports @, #, $ characters in named parameters', () => { + expect(format(`SELECT :foo@bar, :foo#bar, :foo$bar, :@zip, :#zap, :$zop`)).toBe(dedent` + SELECT + :foo@bar, + :foo#bar, + :foo$bar, + :@zip, + :#zap, + :$zop + `); + }); }); diff --git a/test/db2i.test.ts b/test/db2i.test.ts index ebc07ad7c7..e9b6f01efd 100644 --- a/test/db2i.test.ts +++ b/test/db2i.test.ts @@ -4,6 +4,7 @@ import behavesLikeDb2Formatter from './behavesLikeDb2Formatter.js'; import supportsCreateTable from './features/createTable.js'; import supportsDropTable from './features/dropTable.js'; import supportsJoin from './features/join.js'; +import supportsParams from './options/param.js'; describe('Db2iFormatter', () => { const language = 'db2i'; @@ -14,4 +15,5 @@ describe('Db2iFormatter', () => { supportsCreateTable(format, { orReplace: true }); supportsDropTable(format, { ifExists: true }); supportsJoin(format, { without: ['NATURAL'], supportsUsing: true }); + supportsParams(format, { positional: true }); });