亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來(lái)到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? abstractmetadatabasedsearchcallback.java

?? 采用 Java 編寫的數(shù)據(jù)庫(kù)系統(tǒng)單元測(cè)試程序。
?? JAVA
字號(hào):
/*
 *
 * The DbUnit Database Testing Framework
 * Copyright (C)2005, DbUnit.org
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 */

package org.dbunit.database.search;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.sql.Connection;
import java.sql.DatabaseMetaData;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.SortedSet;
import java.util.TreeSet;

import org.dbunit.database.IDatabaseConnection;

import org.dbunit.util.search.AbstractNodesFilterSearchCallback;
import org.dbunit.util.search.IEdge;
import org.dbunit.util.search.SearchException;

/**
 * Super-class for the ISearchCallback that implements the
 * <code>getEdges()</code> method using the database meta-data.
 * 
 * @author Felipe Leme <dbunit@felipeal.net>
 * @version $Revision: 629 $
 * @since Aug 25, 2005
 */
public abstract class AbstractMetaDataBasedSearchCallback extends AbstractNodesFilterSearchCallback {

  /**
   * Logger for this class
   */
  private static final Logger logger = LoggerFactory.getLogger(AbstractMetaDataBasedSearchCallback.class);

  private final IDatabaseConnection connection;

  /**
   * Defautl constructor.
   * @param connection connection where the edges will be calculated from
   */
  public AbstractMetaDataBasedSearchCallback(IDatabaseConnection connection) {
    this.connection = connection;
  }

  /**
   * Get the connection where the edges will be calculated from.
   * @return the connection where the edges will be calculated from
   */
  public IDatabaseConnection getConnection() {
        logger.debug("getConnection() - start");

    return connection;
  }

  protected static final int IMPORT = 0;
  protected static final int EXPORT = 1;
  
  /** 
   * indexes of the column names on the MetaData result sets.
   */
  protected static final int[] TABLENAME_INDEXES = { 3, 7 };  
  protected static final int[] PK_INDEXES = { 4, 4 };
  protected static final int[] FK_INDEXES = { 8, 8 };


  /**
   * Get the nodes using the direct foreign key dependency, i.e, if table A has
   * a FK for a table B, then getNodesFromImportedKeys(A) will return B.
   * @param node table name 
   * @return tables with direct FK dependency from node
   * @throws SearchException
   */
  protected SortedSet getNodesFromImportedKeys(Object node)
      throws SearchException {
        logger.debug("getNodesFromImportedKeys(node=" + node + ") - start");

    return getNodes(IMPORT, node);
  }

  /**
   * Get the nodes using the reverse foreign key dependency, i.e, if table C has
   * a FK for a table A, then getNodesFromExportedKeys(A) will return C.<br>
   * 
   * <strong>NOTE:</strong> this method should be used only as an auxiliary
   * method for sub-classes that also use <code>getNodesFromImportedKeys()</code>
   * or something similiar, otherwise the generated sequence of tables might not
   * work when inserted in the database (as some tables might be missing).
   * <br>
   * @param node table name 
   * @return tables with reverse FK dependency from node
   * @throws SearchException
   */
  protected SortedSet getNodesFromExportedKeys(Object node)
      throws SearchException {
        logger.debug("getNodesFromExportedKeys(node=" + node + ") - start");

    return getNodes(EXPORT, node);
  }

  /**
   * Get the nodes using the both direct and reverse foreign key dependency, i.e, 
   * if table C has a FK for a table A and table A has a FK for a table B, then 
   * getNodesFromImportAndExportedKeys(A) will return B and C.
   * @param node table name 
   * @return tables with reverse and direct FK dependency from node
   * @throws SearchException
   */
  protected SortedSet getNodesFromImportAndExportKeys(Object node)
      throws SearchException {
        logger.debug("getNodesFromImportAndExportKeys(node=" + node + ") - start");

    SortedSet importedNodes = getNodesFromImportedKeys( node );
    SortedSet exportedNodes = getNodesFromExportedKeys( node );
    importedNodes.addAll( exportedNodes );
    return importedNodes;
  }

  private SortedSet getNodes(int type, Object node) throws SearchException {
        logger.debug("getNodes(type=" + type + ", node=" + node + ") - start");

    try {
      Connection conn = this.connection.getConnection();
      String schema = this.connection.getSchema();
      DatabaseMetaData metaData = conn.getMetaData();
      SortedSet edges = new TreeSet();
      getNodes(type, node, conn, schema, metaData, edges);
      return edges;
    } catch (SQLException e) {
      throw new SearchException(e);
    }
  }

  private void getNodes(int type, Object node, Connection conn,
      String schema, DatabaseMetaData metaData, SortedSet edges)
      throws SearchException {
        logger.debug("getNodes(type=" + type + ", node=" + node + ", conn=" + conn + ", schema=" + schema
                + ", metaData=" + metaData + ", edges=" + edges + ") - start");

    if ( logger.isDebugEnabled() ) {
      logger.debug("Getting edges for node " + node);
    }
    try {
      if (!(node instanceof String)) {
        throw new IllegalArgumentException("node should be a String, not a "
            + node.getClass().getName());
      }
      String tableName = (String) node;
      ResultSet rs = null;
      switch (type) {
      case IMPORT:
        rs = metaData.getImportedKeys(null, schema, tableName);
        break;
      case EXPORT:
        rs = metaData.getExportedKeys(null, schema, tableName);
        break;
      }
      while (rs.next()) {
        int index = TABLENAME_INDEXES[type];
        String dependentTableName = rs.getString(index);
        String pkColumn = rs.getString( PK_INDEXES[type] );
        String fkColumn = rs.getString( FK_INDEXES[type] );
        IEdge edge = newEdge(rs, type, tableName, dependentTableName, fkColumn, pkColumn );
        if ( logger.isDebugEnabled() ) {
          logger.debug("Adding edge " + edge);
        }
        edges.add(edge);
      }
    } catch (SQLException e) {
      throw new SearchException(e);
    }

  }
  
  /**
   * Creates an edge representing a foreign key relationship between 2 tables.<br>
   * @param rs database meta-data result set
   * @param type type of relationship (IMPORT or EXPORT)
   * @param from name of the table representing the 'from' node
   * @param to name of the table representing the 'to' node
   * @param fkColumn name of the foreign key column
   * @param pkColumn name of the primary key column
   * @return edge representing the relationship between the 2 tables, according to 
   * the type
   * @throws SearchException not thrown in this method (but might on sub-classes)
   */
  protected static ForeignKeyRelationshipEdge createFKEdge(ResultSet rs, int type, 
      String from, String to, String fkColumn, String pkColumn)
  throws SearchException {
        logger.debug("createFKEdge(rs=" + rs + ", type=" + type + ", from=" + from + ", to=" + to + ", fkColumn="
                + fkColumn + ", pkColumn=" + pkColumn + ") - start");

    return type == IMPORT ? 
        new ForeignKeyRelationshipEdge( from, to, fkColumn, pkColumn ) :
          new ForeignKeyRelationshipEdge( to, from, fkColumn, pkColumn );
  }
  

  /**
   * This method can be overwritten by the sub-classes if they need to decorate
   * the edge (for instance, providing an Edge that contains the primary and 
   * foreign keys used).
   * @param rs database meta-data result set
   * @param type type of relationship (IMPORT or EXPORT)
   * @param from name of the table representing the 'from' node
   * @param to name of the table representing the 'to' node
   * @param fkColumn name of the foreign key column
   * @param pkColumn name of the primary key column
   * @return edge representing the relationship between the 2 tables, according to 
   * the type
   * @throws SearchException not thrown in this method (but might on sub-classes)
   */
  protected IEdge newEdge(ResultSet rs, int type, String from, String to, String fkColumn, String pkColumn)
      throws SearchException {
        logger.debug("newEdge(rs=" + rs + ", type=" + type + ", from=" + from + ", to=" + to + ", fkColumn=" + fkColumn
                + ", pkColumn=" + pkColumn + ") - start");

    return createFKEdge( rs, type, from, to, fkColumn, pkColumn );
  }
            

}

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
7878成人国产在线观看| 欧美视频一区在线| 91精品国产黑色紧身裤美女| 国产精品传媒视频| 麻豆国产精品777777在线| 色综合色狠狠天天综合色| 26uuu国产在线精品一区二区| 亚洲综合成人在线| 不卡一区二区三区四区| 久久亚洲一区二区三区明星换脸| 夜夜嗨av一区二区三区四季av| 国产91色综合久久免费分享| 成人av影视在线观看| 精品99一区二区三区| 日韩不卡一二三区| 欧美亚男人的天堂| 亚洲天堂av老司机| 国产99久久久精品| 久久久一区二区三区| 美女视频黄久久| 欧美肥大bbwbbw高潮| 亚洲在线视频一区| 在线一区二区三区| 亚洲欧美日韩在线不卡| av日韩在线网站| 国产精品免费看片| 不卡大黄网站免费看| 国产女人18水真多18精品一级做 | 精品国产免费一区二区三区香蕉| 亚洲国产欧美在线| 欧美在线一二三四区| 亚洲欧美激情视频在线观看一区二区三区 | 视频一区中文字幕| 欧美亚洲综合网| 亚洲国产精品久久久久婷婷884 | 一本大道久久a久久综合| 国产精品国产三级国产aⅴ原创| 国产成人一级电影| 日本一区二区电影| 成人激情视频网站| 亚洲国产电影在线观看| 成人黄色电影在线| 综合亚洲深深色噜噜狠狠网站| av资源站一区| 亚洲另类色综合网站| 日本精品视频一区二区| 一区二区成人在线| 欧美电影一区二区| 久久电影网电视剧免费观看| 久久综合久久99| 成人美女视频在线看| 亚洲欧美一区二区三区极速播放| 在线免费观看日本欧美| 性做久久久久久免费观看| 777久久久精品| 精品一区二区三区香蕉蜜桃 | 欧美私模裸体表演在线观看| 亚洲一区二区免费视频| 欧美一区二区久久| 国产露脸91国语对白| 中文在线一区二区| 日本精品一区二区三区四区的功能| 成人av网站在线观看| 亚洲视频每日更新| 欧美情侣在线播放| 久久精品国产亚洲高清剧情介绍| 久久综合久久久久88| av中文字幕不卡| 亚洲一区二区在线免费观看视频 | 99精品国产热久久91蜜凸| 亚洲妇熟xx妇色黄| 精品日韩一区二区三区免费视频| 国产精品456| 亚洲精品国产无天堂网2021| 欧美日韩1234| 国产在线不卡一卡二卡三卡四卡| 国产精品每日更新在线播放网址| 91国在线观看| 玖玖九九国产精品| 国产精品久久午夜夜伦鲁鲁| 欧美亚洲高清一区| 国产综合色精品一区二区三区| 亚洲欧洲日韩一区二区三区| 欧美日韩情趣电影| 国产一区在线视频| 玉米视频成人免费看| 精品电影一区二区| 99国产精品视频免费观看| 日本网站在线观看一区二区三区| 日本一区二区三区免费乱视频| 色婷婷av一区二区| 精品一区二区三区视频| 一区二区视频在线| 欧美精品一区二区精品网| 一本色道久久综合精品竹菊| 久久国产人妖系列| 艳妇臀荡乳欲伦亚洲一区| 久久综合久久综合久久综合| 欧美在线影院一区二区| 国产成人免费视频网站| 五月天丁香久久| 国产精品激情偷乱一区二区∴| 欧美一级高清片| 91福利视频久久久久| 国模冰冰炮一区二区| 亚洲成a人片综合在线| 国产精品人成在线观看免费| 制服丝袜av成人在线看| 91一区一区三区| 国产一区欧美二区| 性欧美疯狂xxxxbbbb| 国产精品免费观看视频| 精品人在线二区三区| 在线观看三级视频欧美| 从欧美一区二区三区| 日本美女视频一区二区| 亚洲免费伊人电影| 国产午夜精品一区二区| 日韩网站在线看片你懂的| 色噜噜狠狠色综合中国| 国产69精品久久777的优势| 六月丁香综合在线视频| 亚洲成人第一页| 亚洲综合在线电影| 亚洲欧洲成人精品av97| 久久久久国产精品麻豆| 欧美一级午夜免费电影| 欧美日韩精品一区二区三区四区| 99视频热这里只有精品免费| 国内精品视频666| 麻豆精品一区二区三区| 亚洲高清免费在线| 亚洲精品中文在线| 一色桃子久久精品亚洲| 日本一区二区久久| 日本一区二区三区四区在线视频| 精品国产免费久久| 日韩女优av电影| 欧美一区二区三区思思人| 欧美剧在线免费观看网站| 在线看国产一区| 欧美专区在线观看一区| 色综合久久中文综合久久97 | 麻豆精品视频在线| 日韩有码一区二区三区| 亚洲第一二三四区| 伊人婷婷欧美激情| 亚洲自拍偷拍欧美| 亚洲一区电影777| 亚洲3atv精品一区二区三区| 亚洲午夜电影在线观看| 亚洲国产精品一区二区www| 亚洲一区二区中文在线| 亚洲高清一区二区三区| 一区二区免费看| 亚洲成人午夜电影| 视频在线观看一区| 免费观看久久久4p| 老司机精品视频一区二区三区| 美腿丝袜在线亚洲一区| 美女久久久精品| 紧缚捆绑精品一区二区| 国产伦精一区二区三区| 国产成人av电影在线观看| 成人黄色av网站在线| 色综合久久99| 欧美日韩高清一区二区不卡| 欧美一区二区三区在| 欧美成人精品高清在线播放| 精品精品国产高清a毛片牛牛 | 欧美日韩一区二区三区高清| 欧美中文字幕不卡| 91.成人天堂一区| 欧美tickling网站挠脚心| 精品电影一区二区三区| 国产精品丝袜久久久久久app| 国产精品夫妻自拍| 亚洲制服欧美中文字幕中文字幕| 亚洲国产精品一区二区久久恐怖片 | 一区二区三区不卡视频| 石原莉奈一区二区三区在线观看| 日韩精品一区第一页| 久久se这里有精品| 成人av电影在线| 在线观看免费一区| 日韩久久免费av| 久久久噜噜噜久久人人看| 亚洲欧美一区二区在线观看| 亚洲午夜一区二区| 久久精品av麻豆的观看方式| 国产成人激情av| 欧美亚洲精品一区| 精品裸体舞一区二区三区| 国产欧美日韩久久| 一区二区免费在线播放| 老司机午夜精品99久久| 北条麻妃国产九九精品视频| 一本大道久久a久久综合| 欧美一区二区三区四区视频| 国产精品丝袜一区|