File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2525``` java
2626import advancedsql.* ;
2727import advancedsql.query.* ;
28+ import advancedsql.table.ITable ;
2829
2930try {
3031 MySQL mySQL = connect();
5152}
5253```
5354
55+ ** Alter table:**
56+ ``` java
57+ import advancedsql.* ;
58+ import advancedsql.query.* ;
59+ import advancedsql.query.action.Add ;
60+ import advancedsql.query.action.Modify ;
61+
62+ try {
63+ MySQL mySQL = connect();
64+
65+ // Alter columns
66+ Alter alter = mySQL. table(" users" ). alter();
67+
68+ // Add columns
69+ Add add = alter. add();
70+ add. string(" token" ). nullable();
71+ add. string(" connection_id" ). nullable();
72+
73+ // Drop columns
74+ advancedsql.query.action. Drop drop = alter. drop();
75+ drop. column(" test" );
76+
77+ // Modify columns
78+ Modify modify = alter. modify();
79+ modify. integer(" connection_id" ). nullable();
80+
81+ // Execute query
82+ Boolean result = alter. execute();
83+
84+ // Print query string and result.
85+ System . out. println(alter);
86+ System . out. println(result);
87+ } catch (SQLException e) {
88+ e. printStackTrace();
89+ }
90+ ```
91+
5492## Licensing information
5593This project is licensed under LGPL-3.0. Please see the [ LICENSE] ( /LICENSE ) file for details.
5694
You can’t perform that action at this time.
0 commit comments