Skip to content

Commit 7f60105

Browse files
committed
Fix LoginStatementTests - handle national strings and IsIfExists
- Add IsIfExists field to DropLoginStatement - Fix national string handling: strip N prefix and quotes from value - Enable LoginStatementTests and Baselines90_LoginStatementTests
1 parent 468530b commit 7f60105

File tree

5 files changed

+13
-5
lines changed

5 files changed

+13
-5
lines changed

ast/create_simple_statements.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,8 @@ func (s *AlterLoginOptionsStatement) statement() {}
5454

5555
// DropLoginStatement represents DROP LOGIN name
5656
type DropLoginStatement struct {
57-
Name *Identifier `json:"Name,omitempty"`
57+
Name *Identifier `json:"Name,omitempty"`
58+
IsIfExists bool `json:"IsIfExists"`
5859
}
5960

6061
func (s *DropLoginStatement) node() {}

parser/marshal.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15698,7 +15698,8 @@ func alterLoginOptionsStatementToJSON(s *ast.AlterLoginOptionsStatement) jsonNod
1569815698

1569915699
func dropLoginStatementToJSON(s *ast.DropLoginStatement) jsonNode {
1570015700
node := jsonNode{
15701-
"$type": "DropLoginStatement",
15701+
"$type": "DropLoginStatement",
15702+
"IsIfExists": s.IsIfExists,
1570215703
}
1570315704
if s.Name != nil {
1570415705
node["Name"] = identifierToJSON(s.Name)

parser/parse_ddl.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6005,13 +6005,19 @@ func (p *Parser) parseAlterLoginOptions(name *ast.Identifier) (*ast.AlterLoginOp
60056005
// Parse password value
60066006
if p.curTok.Type == TokenString || p.curTok.Type == TokenNationalString {
60076007
val := p.curTok.Literal
6008+
isNational := p.curTok.Type == TokenNationalString
6009+
// Strip N prefix for national strings
6010+
if isNational && len(val) > 0 && (val[0] == 'N' || val[0] == 'n') {
6011+
val = val[1:]
6012+
}
6013+
// Strip surrounding quotes
60086014
if len(val) >= 2 && val[0] == '\'' && val[len(val)-1] == '\'' {
60096015
val = val[1 : len(val)-1]
60106016
}
60116017
opt.Password = &ast.StringLiteral{
60126018
LiteralType: "String",
60136019
Value: val,
6014-
IsNational: p.curTok.Type == TokenNationalString,
6020+
IsNational: isNational,
60156021
IsLargeObject: false,
60166022
}
60176023
p.nextToken()
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"todo": true}
1+
{}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"todo": true}
1+
{}

0 commit comments

Comments
 (0)