Closed Auios closed 3 weeks ago
Input data
Which SQL and options did you provide as input?
const config: FormatOptionsWithLanguage = { tabWidth: 2, useTabs: false, keywordCase: "upper", identifierCase: "preserve", dataTypeCase: "upper", functionCase: "upper", indentStyle: "standard", logicalOperatorNewline: "before", // expressionWidth: number, linesBetweenQueries: 1, denseOperators: false, newlineBeforeSemicolon: false, // params?: ParamItems | string[], // paramTypes?: ParamTypes, };
Expected Output
CREATE TABLE steamLoginLogs ( id INTEGER PRIMARY KEY AUTOINCREMENT, createdAt DATETIME DEFAULT CURRENT_TIMESTAMP, ipAddress TEXT DEFAULT NULL, clientId TEXT DEFAULT NULL, actualId TEXT DEFAULT NULL, fbid INTEGER DEFAULT NULL, username TEXT DEFAULT NULL, publisherBanned BOOLEAN DEFAULT NULL, vacbanned BOOLEAN DEFAULT NULL, result TEXT CHECK(result IN ('ERROR', 'FAIL', 'NEW', 'SUCCESS')) );
Actual Output
CREATE TABLE steamLoginLogs ( id INTEGER PRIMARY KEY AUTOINCREMENT, createdAt DATETIME DEFAULT CURRENT_TIMESTAMP, ipAddress TEXT DEFAULT NULL, clientId TEXT DEFAULT NULL, actualId TEXT DEFAULT NULL, fbid INTEGER DEFAULT NULL, username TEXT DEFAULT NULL, publisherBanned BOOLEAN DEFAULT NULL, vacbanned BOOLEAN DEFAULT NULL, RESULT TEXT CHECK (RESULT IN ('ERROR', 'FAIL', 'NEW', 'SUCCESS')) );
Usage
How are you calling / using the library? npx tsc format_sql.ts
npx tsc format_sql.ts
What SQL language(s) does this apply to? SQLite
Thanks for reporting.
This is the same fundamental problem as #740. See that issue for details and for a possible alternative formatting library to use.
I'll close this as duplicate.
Input data
Which SQL and options did you provide as input?
Expected Output
Actual Output
Usage
How are you calling / using the library?
npx tsc format_sql.ts
What SQL language(s) does this apply to? SQLite