File tree Expand file tree Collapse file tree 2 files changed +14
-19
lines changed
packages/cubejs-schema-compiler Expand file tree Collapse file tree 2 files changed +14
-19
lines changed Original file line number Diff line number Diff line change @@ -87,28 +87,23 @@ export class SqlParser {
8787 openChar = null ;
8888 }
8989 result += sql [ i ] ;
90- } else {
90+ } else if ( sql [ i ] === '-' && sql [ i + 1 ] === '-' ) {
9191 // Check for start of single-line comment
92- if ( sql [ i ] === '-' && sql [ i + 1 ] === '-' ) {
93- inComment = true ;
94- commentType = '--' ;
95- result += sql [ i ] ;
96- }
92+ inComment = true ;
93+ commentType = '--' ;
94+ result += sql [ i ] ;
95+ } else if ( sql [ i ] === '/' && sql [ i + 1 ] === '*' ) {
9796 // Check for start of multi-line comment
98- else if ( sql [ i ] === '/' && sql [ i + 1 ] === '*' ) {
99- inComment = true ;
100- commentType = '/*' ;
101- result += sql [ i ] ;
102- }
97+ inComment = true ;
98+ commentType = '/*' ;
99+ result += sql [ i ] ;
100+ } else if ( sql [ i ] === '\'' || sql [ i ] === '"' || sql [ i ] === '`' ) {
103101 // Check for string literals
104- else if ( sql [ i ] === '\'' || sql [ i ] === '"' || sql [ i ] === '`' ) {
105- openChar = sql [ i ] ;
106- result += sql [ i ] . toUpperCase ( ) ;
107- }
102+ openChar = sql [ i ] ;
103+ result += sql [ i ] . toUpperCase ( ) ;
104+ } else {
108105 // Regular character - convert to uppercase
109- else {
110- result += sql [ i ] . toUpperCase ( ) ;
111- }
106+ result += sql [ i ] . toUpperCase ( ) ;
112107 }
113108 }
114109
Original file line number Diff line number Diff line change @@ -104,7 +104,7 @@ describe('SqlParser', () => {
104104 } ) ;
105105
106106 it ( 'sql with regex containing question mark' , ( ) => {
107- const sqlParser = new SqlParser ( " SELECT * FROM users WHERE name = ? AND REGEXP '^stripe(?!_direct).{1,}$'" ) ;
107+ const sqlParser = new SqlParser ( ' SELECT * FROM users WHERE name = ? AND REGEXP \ '^stripe(?!_direct).{1,}$\'' ) ;
108108 expect ( sqlParser . canParse ( ) ) . toEqual ( true ) ;
109109 } ) ;
110110
You can’t perform that action at this time.
0 commit comments