📄 xmltypes.java
字号:
package com.icbcsdc.ddlexp.pub.xml.nodeinfo;
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.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 XMLTypes extends XMLNode {
public static final String NAME="Types";
String crComparedSql="SELECT SRC_TYPE_NAME,ATTR_NAME,SRC_ATTR_VALUE,DST_TYPE_NAME FROM COMPARE_TYPES WHERE SRC_OWNER=? AND ATTR_NAME='MYSTYLE'";
String upComparedSql="SELECT SRC_TYPE_NAME,ATTR_NAME,SRC_ATTR_VALUE,DST_ATTR_VALUE FROM COMPARE_TYPES WHERE SRC_OWNER=? AND ATTR_NAME<>'MYSTYLE'";
public XMLTypes() throws NodeException{
super();
this.name=NAME;
}
/**
* @see com.icbcsdc.ddlexp.pub.xml.nodeinfo.XMLNode#getType()
*/
public int getType() {
return XMLNode.XML_TYPES;
}
/**
* @see com.icbcsdc.ddlexp.pub.xml.nodeinfo.XMLNode#refresh()
*/
public void refreshDDLInfo() throws Exception{
JDBCPool cnn=null;
XMLDatabase db=this.getDatabase();
if(db!=null) cnn = db.getConnPool();
else return;
this.addChild(new XMLArrayTypes());
this.addChild(new XMLObjectTypes());
this.addChild(new XMLTableTypes());
if(db.getVersion() == XMLDatabase.VERSION_ORACLE8I){
String sqlGenDDL = "BEGIN GEN_TYPE_DDL(?); END;";
CallableStatement cStmt = cnn.prepareCall(sqlGenDDL);
cStmt.setString(1,this.getSchema().name);
cStmt.execute();
}
//super.refresh();
}
/**从数据库中获取数据对象比较后的结果*/
public void refreshChangedProperties()throws Exception{
JDBCPool cnn=null;
//try {
XMLDatabase db=this.getDatabase();
if(db!=null) cnn = db.getConnPool();
else return;
//先创建比较节点
PreparedStatement pStmt=cnn.prepareStatement(crComparedSql);
pStmt.setString(1,this.getSchema().name.toUpperCase());
ResultSet rsCr=pStmt.executeQuery();
while(rsCr.next()){
XMLType type0=null;
byte status=XMLNode.toCompareStatus(rsCr.getString("SRC_ATTR_VALUE"));
if(status==XMLNode.SRC_NULL_DST_EXIST)
type0 = new XMLType(rsCr.getString("DST_TYPE_NAME"));
else
type0 = new XMLType(rsCr.getString("SRC_TYPE_NAME"));
type0.setCompareStatus(status);
this.addChild(type0);
}
rsCr.close();
//再修改比较节点
pStmt=cnn.prepareStatement(upComparedSql);
pStmt.setString(1,this.getSchema().name.toUpperCase());
ResultSet rsUp=pStmt.executeQuery();
while(rsUp.next()){
XMLType type1=(XMLType)this.getDirectChildren(XMLNode.XML_TYPE,rsUp.getString("SRC_TYPE_NAME"));
type1.putChangedProperty(rsUp.getString("ATTR_NAME"),rsUp.getString("SRC_ATTR_VALUE"),rsUp.getString("DST_ATTR_VALUE"));
}
rsUp.close();
pStmt.close();
/**
} catch (Exception e) {
Logger.log(Logger.ERROR,e.getMessage());
}
**/
}
/**
* @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#chkChildType(XMLNode)
*/
public boolean chkChildType(XMLNode node) {
if(node.getType()==XMLNode.XML_ARRAYTYPES) return true;
if(node.getType()==XMLNode.XML_OBJECTTYPES) return true;
if(node.getType()==XMLNode.XML_TABLETYPES) return true;
if(node.getType()==XMLNode.XML_TYPE) return true;
return false;
}
/**
* @see com.icbcsdc.ddlexp.pub.xml.nodeinfo.XMLNode#getXmlStream()
public InputStream getXmlStream() {
return null;
}
*/
/**
* @see com.icbcsdc.ddlexp.pub.xml.nodeinfo.XMLNode#getSqlDDL()
*/
public String getSqlDDL() {
return null;
}
public static void main(String[] args) {
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -