SQL returns the SQL representation of this ALTER TABLE statement. Note: the parser returns AlterStatement (in alter.go); this method is for manually-constructed AlterTableStatement values.
()
| 870 | // Note: the parser returns AlterStatement (in alter.go); this method |
| 871 | // is for manually-constructed AlterTableStatement values. |
| 872 | func (a *AlterTableStatement) SQL() string { |
| 873 | if a == nil { |
| 874 | return "" |
| 875 | } |
| 876 | sb := getBuilder() |
| 877 | defer putBuilder(sb) |
| 878 | sb.WriteString("ALTER TABLE ") |
| 879 | sb.WriteString(a.Table) |
| 880 | for _, action := range a.Actions { |
| 881 | action := action // G601: Create local copy to avoid memory aliasing |
| 882 | sb.WriteString(" ") |
| 883 | sb.WriteString(alterActionSQL(&action)) |
| 884 | } |
| 885 | return sb.String() |
| 886 | } |
| 887 | |
| 888 | // SQL returns the SQL representation of this DROP statement, including the |
| 889 | // object type, optional IF EXISTS, object names, and CASCADE/RESTRICT behavior. |