mirror of
https://github.com/CodePhiliaX/Chat2DB.git
synced 2025-07-29 02:32:33 +08:00
copy and delete Table
This commit is contained in:
@ -159,4 +159,15 @@ public class PostgreSQLDBManage extends DefaultDBManage implements DBManage {
|
||||
SQLExecutor.getInstance().execute(connection, sql, resultSet -> null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void copyTable(Connection connection, String databaseName, String schemaName, String tableName, String newTableName,boolean copyData) throws SQLException {
|
||||
String sql = "";
|
||||
if(copyData){
|
||||
sql = "CREATE TABLE " + newTableName + " AS TABLE " + tableName + " WITH DATA";
|
||||
}else {
|
||||
sql = "CREATE TABLE " + newTableName + " AS TABLE " + tableName + " WITH NO DATA";
|
||||
}
|
||||
SQLExecutor.getInstance().execute(connection, sql, resultSet -> null);
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user