formatDrop formats DROP statements
(stmt *ast.DropStatement)
| 1132 | |
| 1133 | // formatDrop formats DROP statements |
| 1134 | func (f *SQLFormatter) formatDrop(stmt *ast.DropStatement) error { |
| 1135 | f.writeKeyword("DROP") |
| 1136 | f.builder.WriteString(" ") |
| 1137 | f.writeKeyword(stmt.ObjectType) |
| 1138 | |
| 1139 | if stmt.IfExists { |
| 1140 | f.builder.WriteString(" ") |
| 1141 | f.writeKeyword("IF EXISTS") |
| 1142 | } |
| 1143 | |
| 1144 | for i, name := range stmt.Names { |
| 1145 | if i > 0 { |
| 1146 | f.builder.WriteString(",") |
| 1147 | } |
| 1148 | f.builder.WriteString(" " + name) |
| 1149 | } |
| 1150 | |
| 1151 | if stmt.CascadeType != "" { |
| 1152 | f.builder.WriteString(" ") |
| 1153 | f.writeKeyword(stmt.CascadeType) |
| 1154 | } |
| 1155 | |
| 1156 | return nil |
| 1157 | } |
| 1158 | |
| 1159 | // formatCreateView formats CREATE VIEW statements |
| 1160 | func (f *SQLFormatter) formatCreateView(stmt *ast.CreateViewStatement) error { |
no test coverage detected