⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 xmlschemas.java

📁 导出ORACLE数据库对象DDL语句的程序
💻 JAVA
字号:
package com.icbcsdc.ddlexp.pub.xml.nodeinfo;

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 XMLSchemas extends XMLNode {
	public static String NAME="Schemas";
	String sqlSchemas="select distinct owner from dba_objects where owner not in('SYS','SYSTEM') order by owner desc";	

	String sqlComparedSchemas="SELECT SRC_OWNER FROM COMPARE_TABLES WHERE ATTR_NAME='MYSTYLE' UNION SELECT SRC_OWNER FROM COMPARE_SEQUENCES WHERE ATTR_NAME='MYSTYLE' UNION SELECT SRC_OWNER FROM COMPARE_SYNONYMS WHERE ATTR_NAME='MYSTYLE' UNION SELECT SRC_OWNER FROM COMPARE_TYPES WHERE ATTR_NAME='MYSTYLE' UNION SELECT SRC_OWNER FROM COMPARE_VIEWS WHERE ATTR_NAME='MYSTYLE' UNION SELECT SRC_OWNER FROM COMPARE_PACKAGES WHERE ATTR_NAME='MYSTYLE' UNION SELECT SRC_OWNER FROM COMPARE_FUNCTIONS WHERE ATTR_NAME='MYSTYLE' UNION SELECT SRC_OWNER FROM COMPARE_PROCEDURES WHERE ATTR_NAME='MYSTYLE'";	
	
	public XMLSchemas(){
		this.name=NAME;		
	}

	/**
	 * @see com.mysqlecc.pub.xml.XmlProcess.XMLNode#getType()
	 */
	public int getType() {
		return XMLNode.XML_SCHEMAS;
	}

	/**
	 * @see com.mysqlecc.pub.xml.XmlProcess.XMLNode#refresh()
	 */
	public void refreshDDLInfo() throws Exception {
		JDBCPool cnn=null;

		XMLDatabase db=this.getDatabase();
		if(JDBCPoolManager.getInstance().isDebug()) 
			System.out.println(this.getClass().toString());
			
		if(db!=null) cnn = db.getConnPool();
		else return;

		//获取schema列表
		ResultSet rsSchemas=cnn.executeQuery(sqlSchemas);

		while(rsSchemas.next()){
//				Logger.log(Logger.DEBUG,"模式:"+rsSchemas.getString(1));
			XMLSchema schema=new XMLSchema(rsSchemas.getString(1));
			this.addChild(schema);
		}
		
		rsSchemas.close();

	}

	/**从数据库中获取数据对象比较后的结果*/
	public void refreshChangedProperties() throws Exception{
		JDBCPool cnn=null;

		XMLDatabase db=this.getDatabase();
		if(JDBCPoolManager.getInstance().isDebug()) 
			System.out.println(this.getClass().toString());
			
		if(db!=null) cnn = db.getConnPool();
		else return;

		//获取schema列表
		ResultSet rsSchemas=cnn.executeQuery(sqlComparedSchemas);

		while(rsSchemas.next()){
			XMLSchema schema=new XMLSchema(rsSchemas.getString(1));
			schema.setCompareStatus(ComparedNode.COMPARED);
			this.addChild(schema);
		}
		
		rsSchemas.close();

	}
	
	/**
	 * @see com.icbcsdc.ddlexp.pub.xml.nodeinfo.XMLNode#refresh()
	 */
	public void refresh() throws Exception{
		refreshNodeNeedAccessDB();		
		if(this.compareStatus!=ComparedNode.NO_COMPARED) 
			super.refresh();
	}

	/**
	 * @see com.mysqlecc.pub.xml.XmlProcess.XMLNode#chkChildType(XMLNode)
	 */
	public boolean chkChildType(XMLNode node) {
		if(node.getType()==XMLNode.XML_SCHEMA) return true;
		
		return false;
	}

	/**
	 * Returns the 返回定义导出语句.
	 * @return String
	 */
	public String getSqlDDL(){
		return null;	
	}

	public static void main(String[] args) {
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -