📄 xmlsequence.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.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 XMLSequence extends XMLNode {
String ComparedSequenceSql="SELECT ATTR_NAME,SRC_ATTR_VALUE,DST_ATTR_VALUE FROM COMPARE_SEQUENCES WHERE SRC_OWNER=? AND SRC_SEQUENCE_NAME=? AND ATTR_NAME<>'MYSTYLE'";
private String maxValue=null;
private String minValue=null;
private String incrInterval=null;
private static String newline = System.getProperty("line.separator");
public XMLSequence(String sequenceName,String min,String max,String interval){
this.name=sequenceName;
this.maxValue=max;
this.minValue=min;
this.incrInterval=interval;
}
public XMLSequence(String sequenceName){
this.name=sequenceName;
}
/**
* @see com.icbcsdc.ddlexp.pub.xml.nodeinfo.XMLNode#getType()
*/
public int getType() {
return XMLNode.XML_SEQUENCE;
}
/**
* @see com.icbcsdc.ddlexp.pub.xml.nodeinfo.XMLNode#refresh()
*/
public void refresh() throws Exception{
refreshNodeNeedAccessDB();
}
/**从数据库中获取数据对象比较后的结果*/
public void refreshChangedProperties()throws Exception{
if(this.getCompareStatus()==XMLNode.SRC_DST_DIFF){
/**compare_package_lines相关的信息放到容器changedProperties中*/
JDBCPool cnn=null;
//try {
//XMLManager.getInstance().
XMLDatabase db=this.getDatabase();
if(JDBCPoolManager.getInstance().isDebug())
System.out.println(this.getClass().toString());
if(db!=null) cnn = db.getConnPool();
else return;
//再修改比较节点
PreparedStatement pStmt=cnn.prepareStatement(ComparedSequenceSql);
pStmt.setString(1,this.getSchema().getName().toUpperCase());
pStmt.setString(2,this.getName().toUpperCase());
ResultSet rsUpSequences=pStmt.executeQuery();
while(rsUpSequences.next()){
//LSequence package1=(XMLSequence)this.getDirectChildren(XMLNode.XML_PACKAGE,this.getName().toUpperCase());
this.putChangedProperty(rsUpSequences.getString("ATTR_NAME"),rsUpSequences.getString("SRC_ATTR_VALUE"),rsUpSequences.getString("DST_ATTR_VALUE"));
}
rsUpSequences.close();
pStmt.close();
/**
} catch (Exception e) {
e.printStackTrace();
Logger.log(Logger.ERROR,e.getMessage());
}
**/
}
}
/**从数据库中获取数据对象定义*/
public void refreshDDLInfo(){
}
/**
* @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();
}
public static void main(String[] args) {
}
/**
* Returns the incrInterval.
* @return String
*/
public String getIncrInterval() {
return incrInterval;
}
/**
* Returns the maxValue.
* @return String
*/
public String getMaxValue() {
return maxValue;
}
/**
* Returns the minValue.
* @return String
*/
public String getMinValue() {
return minValue;
}
public String getAlterSQL(){
String sqlstr="";
sqlstr= increment_byClause()+newline+
max_valueClause()+newline+
min_valueClause()+newline+
cacheClause()+newline+
cycleClause()+newline+
orderClause()+newline;
if(sqlstr.equals(""))
return sqlstr;
else
return "Alter Sequence "+this.getSchema().name+"." +this.getName() +newline+sqlstr;
}
public String alterSequenceProperties(){
return "";
}
public String cacheClause(){
String cache=this.getChangedPropertyNewValue("CACHE_SIZE");
if(cache==null)
return "";
else
return "cache "+cache+"\n";
}
public String cycleClause(){
String cycle=this.getChangedPropertyNewValue("CYCLE_FLAG");
if(cycle==null)
return "";
else if(cycle.equals("N"))
cycle="nocycle";
else
cycle="cycle";
return cycle+"\n";
}
public String orderClause(){
String order=this.getChangedPropertyNewValue("ORDER_FLAG");
if(order==null)
return "";
else if(order.equals("N"))
order="noorder";
else
order="order";
return order+"\n";
}
public String min_valueClause(){
String min_value=this.getChangedPropertyNewValue("MIN_VALUE");
if(min_value==null)
return "";
else
return "minvalue "+min_value+"\n";
}
public String max_valueClause(){
String max_value=this.getChangedPropertyNewValue("MAX_VALUE");
if(max_value==null)
return "";
else
return "maxvalue "+max_value+"\n";
}
public String increment_byClause(){
String increment_by=this.getChangedPropertyNewValue("INCREMENT_BY");
if(increment_by==null)
return "";
else
return "increment by "+increment_by+"\n";
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -