📄 xmlobjecttype.java
字号:
package com.icbcsdc.ddlexp.pub.xml.nodeinfo;
import java.io.InputStream;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.ArrayList;
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 XMLObjectType extends XMLNode {
String sqlTypeAttr = "select attr_name,attr_type_name||'('||length||')' datatype from DBA_TYPE_ATTRS where owner=? and type_name=?";
String sqlMethod = "select method_name,method_type from DBA_TYPE_METHODS where owner=? and type_name=?";
ArrayList attributes=new ArrayList();
ArrayList methods=new ArrayList();
public XMLObjectType(String typeName){
this.name = typeName;
}
/**
* @see com.icbcsdc.ddlexp.pub.xml.nodeinfo.XMLNode#getType()
*/
public int getType() {
return XMLNode.XML_OBJECTTYPE;
}
/**从数据库中获取数据对象比较后的结果*/
public void refreshChangedProperties(){
}
/**从数据库中获取数据对象定义*/
public void refreshDDLInfo()throws Exception{
JDBCPool cnn=null;
XMLDatabase db=this.getDatabase();
if(db!=null) cnn = db.getConnPool();
else return;
PreparedStatement pStmt=cnn.prepareStatement(this.sqlTypeAttr);
pStmt.setString(1,this.getParent().getParent().getParent().getName());
pStmt.setString(2,this.getName());
ResultSet rsAttr=pStmt.executeQuery();
while(rsAttr.next()){
this.attributes.add(new OracleTypeAttribute(rsAttr.getString(1),rsAttr.getString(2)));
}
pStmt=cnn.prepareStatement(this.sqlMethod);
pStmt.setString(1,this.getParent().getParent().getParent().getName());
pStmt.setString(2,this.getName());
ResultSet rsMethod=pStmt.executeQuery();
while(rsMethod.next()){
this.methods.add(new OracleTypeMethod(rsMethod.getString(1),rsMethod.getString(2)));
}
pStmt.close();
rsAttr.close();
rsMethod.close();
}
/**
* @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) {
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 this.getSchemaDDLStr();
}
/**
* @return Returns the attributes.
*/
public ArrayList getAttributes() {
return attributes;
}
/**
* @return Returns the methods.
*/
public ArrayList getMethods() {
return methods;
}
public static void main(String[] args) {
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -