All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.centit.support.database.ddl.SqlSvrDDLOperations Maven / Gradle / Ivy

Go to download

数据库操作通用方法和函数,从以前的util包中分离出来,并且整合了部分sys-module中的函数

There is a newer version: 5.3.2302
Show newest version
package com.centit.support.database.ddl;

import java.sql.Connection;

import com.centit.support.database.metadata.TableField;

public class SqlSvrDDLOperations extends GeneralDDLOperations {


    public SqlSvrDDLOperations(){

    }

    public SqlSvrDDLOperations(Connection conn) {
        super(conn);
    }

    @Override
    public String makeRenameColumnSql(final String tableCode, final String columnCode, final TableField column){
/*        dropColumn(tableCode, columnCode);
        column.setColumnName(newColumnCode);
        addColumn(tableCode, column);*/
        return "exec sp_rename ' "+tableCode +"." + columnCode +"','"+ column.getColumnName() +"','COLUMN'";
    }

    @Override
    public String makeModifyColumnSql(final String tableCode, final TableField column){
        StringBuilder sbsql = new StringBuilder("alter table ");
        sbsql.append(tableCode);
        sbsql.append(" ALTER COLUMN ");
        appendColumnSQL(column,sbsql);
        return sbsql.toString();
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy