Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pegjs/mysql.pegjs
Original file line number Diff line number Diff line change
Expand Up @@ -4399,7 +4399,7 @@ assign_stmt_list
}

assign_stmt
= va:(var_decl / without_prefix_var_decl) __ s: (KW_ASSIGN / KW_ASSIGIN_EQUAL) __ e:proc_expr {
= va:(var_decl / without_prefix_var_decl) __ s: (KW_ASSIGN / KW_ASSIGIN_EQUAL) __ e:expr {
return {
type: 'assign',
left: va,
Expand All @@ -4409,7 +4409,7 @@ assign_stmt
}

select_assign_stmt
= va:(var_decl / without_prefix_var_decl) __ s:KW_ASSIGN __ e:proc_expr {
= va:(var_decl / without_prefix_var_decl) __ s:KW_ASSIGN __ e:expr {
return {
type: 'assign',
left: va,
Expand Down
5 changes: 5 additions & 0 deletions test/cmd.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,11 @@ describe('Command SQL', () => {
.to.equal(`SET @@${keyword}.id = 123 ; SET @@${keyword}.yy.xx = "abcd"`);
})
})

it('should support set variable with cast', () => {
expect(getParsedSql('SET @myvar=CAST("123.1" AS DOUBLE)'))
.to.equal('SET @myvar = CAST("123.1" AS DOUBLE)');
})
})

describe('unlock', () => {
Expand Down