📄 xmltabcolcomment.java
字号:
package com.icbcsdc.ddlexp.pub.xml.nodeinfo;
import java.io.InputStream;
import java.sql.CallableStatement;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import com.icbcsdc.ddlexp.pub.staticLog.Logger;
import com.icbcsdc.ddlexp.pub.connectionpool.JDBCCnn;
import com.icbcsdc.ddlexp.pub.connectionpool.JDBCException;
import com.icbcsdc.ddlexp.pub.connectionpool.JDBCPool;
import com.icbcsdc.ddlexp.pub.connectionpool.JDBCPoolManager;
/**
* @author zhangyc
*
* To change this generated comment edit the template variable "typecomment":
* Window>Preferences>Java>Templates.
* To enable and disable the creation of type comments go to
* Window>Preferences>Java>Code Generation.
*/
public class XMLTabColComment extends XMLNode{
String rsComparedColumnComments = "SELECT ATTR_NAME,SRC_ATTR_VALUE,DST_ATTR_VALUE FROM COMPARE_COLUMNCOMMENTS WHERE SRC_OWNER = ? AND SRC_TABLE_NAME = ? AND SRC_COLUMN_NAME = ? AND ATTR_NAME<>'MYSTYLE'" ;
String rsComparedColumnCommentStatus = "SELECT SRC_ATTR_VALUE FROM COMPARE_COLUMNCOMMENTS WHERE SRC_OWNER = ? AND SRC_TABLE_NAME = ? AND SRC_COLUMN_NAME = ? AND ATTR_NAME='MYSTYLE'" ;
// String rsComparedColumnComments="SELECT SRC_LINE,SRC_ATTR_VALUE,DST_ATTR_VALUE FROM COMPARE_PROCEDURE_LINES WHERE SRC_OWNER=? AND SRC_PROCEDURE_NAME=? AND ATTR_NAME<>'MYSTYLE'";
private static String NAME="ColumnComment";
private String comment=null;
/**
* Constructor for OracleDatFile.
*/
public XMLTabColComment() {
this.name = NAME;
}
/**
* Constructor for OracleDatFile.
*/
public XMLTabColComment(String comment) {
super();
this.name = NAME;
this.comment = comment;
}
/**
* @see com.icbcsdc.ddlexp.pub.xml.nodeinfo.XMLNode#getType()
*/
public int getType() {
return XMLNode.XML_TABCOLCOMMENT;
}
/**
* @see com.icbcsdc.ddlexp.pub.xml.nodeinfo.XMLNode#chkChildType(XMLNode)
*/
public boolean chkChildType(XMLNode node) {
return false;
}
/**从数据库中获取数据对象比较后的结果*/
public void refreshChangedProperties() throws Exception{
/**compare_procedure_lines相关的信息放到容器changedProperties中*/
JDBCPool cnn=null;
//try {
//XMLManager.getInstance().
XMLDatabase db=this.getDatabase();
if(db!=null) cnn = db.getConnPool();
else return;
PreparedStatement pStmtstatus=cnn.prepareStatement(rsComparedColumnCommentStatus);
pStmtstatus.setString(1,this.getSchema().getName().toUpperCase());
pStmtstatus.setString(2,this.getParent().getParent().getParent().getName().toUpperCase());
pStmtstatus.setString(3,this.getParent().getName().toUpperCase());
ResultSet rsCrColumnCommentstatus=pStmtstatus.executeQuery();
while(rsCrColumnCommentstatus.next()){
// XMLTabColComment columncomment=null;
byte status=XMLNode.toCompareStatus(rsCrColumnCommentstatus.getString("SRC_ATTR_VALUE"));
this.setCompareStatus(status);
}
rsCrColumnCommentstatus.close();
pStmtstatus.close();
//再修改比较节点
PreparedStatement pStmt=cnn.prepareStatement(rsComparedColumnComments);
pStmt.setString(1,this.getSchema().getName().toUpperCase());
pStmt.setString(2,this.getParent().getParent().getParent().getName().toUpperCase());
pStmt.setString(3,this.getParent().getName().toUpperCase());
ResultSet rsUpColumnComments=pStmt.executeQuery();
while(rsUpColumnComments.next()){
//XMLColumnComment procedure1=(XMLColumnComment)this.getDirectChildren(XMLNode.XML_PROCEDURE,rsUpColumnComments.getString("SRC_PROCEDURE_NAME"));
this.putChangedProperty(rsUpColumnComments.getString("ATTR_NAME"),rsUpColumnComments.getString("SRC_ATTR_VALUE"),rsUpColumnComments.getString("DST_ATTR_VALUE"));
}
rsUpColumnComments.close();
pStmt.close();
}
/**从数据库中获取数据对象定义*/
public void refreshDDLInfo(){
}
/**
* @see com.icbcsdc.ddlexp.pub.xml.nodeinfo.XMLNode#refresh()
*/
public void refresh() throws Exception{
refreshNodeNeedAccessDB();
super.refresh();
}
/**
* @see com.icbcsdc.ddlexp.pub.xml.nodeinfo.XMLNode#getSqlDDL()
*/
public String getSqlDDL() {
//return this.getSchemaDependentDDLStr();
String tabName2 = this.getTable().name.toUpperCase();
String tabOwner2 = this.getSchema().name.toUpperCase();
return "COMMENT ON COLUMN "+tabOwner2+"."+tabName2+"."+this.getTabColumn().getName()+" '"+this.comment+"'";
}
public String getAlterSQL(){
//return this.getSchemaDependentDDLStr();
String tabName2 = this.getTable().name.toUpperCase();
String tabOwner2 = this.getSchema().name.toUpperCase();
return "COMMENT ON COLUMN "+tabOwner2+"."+tabName2+"."+this.getTabColumn().getName()+" '"+this.getChangedPropertyNewValue("COMMENTS")+"'";
}
/**
* Returns the fileSize.
* @return long
*/
public String getComment() {
return comment;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -