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

📄 xmltablespaces.java

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

import java.sql.CallableStatement;
import java.sql.ResultSet;
import java.sql.Types;

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 XMLTablespaces extends XMLNode {
	public static String NAME="Tablespaces";
	
	private String sqlTbs="SELECT TABLESPACE_NAME,CONTENTS,EXTENT_MANAGEMENT FROM DBA_TABLESPACES";
	
	
	/**
	 * Constructor for XMLManager.
	 */
	public XMLTablespaces() {
		super();
		this.name=NAME;
	}

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

	/**
	 * @see com.mysqlecc.pub.xml.XmlProcess.XMLNode#refresh()
	 */
	public void refreshDDLInfo() throws Exception{
		//System.out.println("XMLSchemas 1");
		//this.clear();
		JDBCPool cnn=null;
		//try {
			//XMLManager.getInstance().
			XMLDatabase db=this.getDatabase();
			if(db!=null) cnn = db.getConnPool();
			else return;

			if(db.getVersion() == XMLDatabase.VERSION_ORACLE8I){
				String sqlGenDDL = "BEGIN gen_tbs_ddl; END;";
				CallableStatement cStmt = cnn.prepareCall(sqlGenDDL);
				cStmt.execute();
			}
			
			//获取schema列表
			ResultSet rsSchemas=cnn.executeQuery(sqlTbs);

			while(rsSchemas.next()){
				XMLTablespace tbs=new XMLTablespace(rsSchemas.getString(1),rsSchemas.getString(2),rsSchemas.getString(3));								
				this.addChild(tbs);
				
				//System.out.println("before tablespace:"+this.getName()+" refresh.");										
				//tbs.refresh();						
				//System.out.println("after tablespace:"+this.getName()+" refresh.");										
			}
			rsSchemas.close();
		

		//super.refresh();
	}

	/**从数据库中获取数据对象比较后的结果*/
	public void refreshChangedProperties(){
	}
	
	/**
	 * @see com.icbcsdc.ddlexp.pub.xml.nodeinfo.XMLNode#refresh()
	 */
	public void refresh() throws Exception{
		refreshNodeNeedAccessDB();		
		super.refresh();
	}

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

/**
	public InputStream getXmlStream(){
        String xml="";
        try {
            writer.newDocumnet();
            Element root=writer.createRoot("tablespaces");
            root.setAttribute("name",this.getName());
            xml=writer.toString();
        } catch (XmlException e) {
			e.printStackTrace();
        }
        return XmlReader.streamFromString(xml);
	
	}
**/

	/**
	 * 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 + -