Package jp.co.ntt.oss

Examples of jp.co.ntt.oss.SyncDatabaseException


      final String mlogName, final long lastMlogID, final long lastCount,
      final Hashtable<Short, String> pkNames)
      throws SyncDatabaseException, SQLException {
    if (conn == null || mlogName == null || pkNames == null
        || pkNames.size() < 1) {
      throw new SyncDatabaseException("error.argument");
    }

    if (lastMlogID < 0 || lastCount < 0) {
      return Double.NaN;
    }

    StringBuilder query = new StringBuilder();
    query.append("SELECT COUNT(*), ");
    query.append("SUM(LEAST(1, m.d_cnt)) + ");
    query.append("SUM(LEAST(1, m.i_cnt)) + ");
    query.append("SUM(LEAST(1, m.u_cnt)), ");
    query.append("SUM(m.i_cnt) - SUM(m.d_cnt) ");
    query.append("FROM (SELECT ");
    query.append("SUM(CASE WHEN dmltype = 'D' THEN 1 ELSE 0 END) d_cnt, ");
    query.append("SUM(CASE WHEN dmltype = 'I' THEN 1 ELSE 0 END) i_cnt, ");
    query.append("SUM(CASE WHEN dmltype = 'U' THEN 1 ELSE 0 END) u_cnt ");
    query.append("FROM ");
    query.append(mlogName);
    query.append(" WHERE mlogid > ? GROUP BY ");
    // PK list
    for (short i = 1; i <= pkNames.size(); i++) {
      if (i > 1) {
        query.append(", ");
      }
      query.append(pkNames.get(Short.valueOf(i)));
    }
    query.append(") m");

    PreparedStatement pstmt = null;
    ResultSet rset = null;

    try {
      pstmt = conn.prepareStatement(query.toString());
      pstmt.setLong(1, lastMlogID);
      rset = pstmt.executeQuery();
      if (!rset.next()) {
        throw new SyncDatabaseException("error.argument");
      }

      long pkCount = rset.getLong(REFRESH_COST_PK_COUNT);
      long execQueryCount = rset.getLong(REFRESH_COST_EXEC_COUNT);
      long diffCount = rset.getLong(REFRESH_COST_DIFF_COUNT);
View Full Code Here


  }

  public static RefreshMode chooseFastestMode(final Connection conn,
      final Subscriber suber) throws SyncDatabaseException, SQLException {
    if (conn == null || suber == null) {
      throw new SyncDatabaseException("error.argument");
    }

    double cost = getIncrementalRefreshCost(conn, suber.getMlogName(),
        suber.getLastMlogID(), suber.getLastCount(), getPKNames(conn,
            suber.getNspName(), suber.getRelName()));
View Full Code Here

  }

  public static void purgeMlog(final Connection conn, final String schema,
      final String table) throws SyncDatabaseException, SQLException {
    if (conn == null || schema == null || table == null) {
      throw new SyncDatabaseException("error.argument");
    }

    CallableStatement cstmt = null;

    try {
View Full Code Here

  public static void truncate(final Connection conn,
      final String quotedTable, final boolean concurrent)
      throws SQLException, SyncDatabaseException {
    if (conn == null || quotedTable == null) {
      throw new SyncDatabaseException("error.argument");
    }

    Statement stmt = null;
    try {
      stmt = conn.createStatement();
View Full Code Here

  }

  public static String quoteIdent(final String quoteString,
      final String identifier) throws SyncDatabaseException, SQLException {
    if (identifier == null) {
      throw new SyncDatabaseException("error.argument");
    }

    if (quoteString.equals(" ")) {
      return identifier;
    }
View Full Code Here

  public static long subscribeMlog(final Connection conn,
      final String schema, final String table, final String description)
      throws SyncDatabaseException, SQLException {
    if (conn == null || schema == null || table == null) {
      throw new SyncDatabaseException("error.argument");
    }

    CallableStatement cstmt = null;

    try {
View Full Code Here

  }

  public static void unSubscribeMlog(final Connection conn, final long subsID)
      throws SyncDatabaseException, SQLException {
    if (conn == null) {
      throw new SyncDatabaseException("error.argument");
    }

    CallableStatement cstmt = null;

    try {
View Full Code Here

  }

  public static void createMlog(final Connection conn, final String schema,
      final String table) throws SyncDatabaseException, SQLException {
    if (conn == null || schema == null || table == null) {
      throw new SyncDatabaseException("error.argument");
    }

    CallableStatement cstmt = null;

    try {
View Full Code Here

  }

  public static void dropMlog(final Connection conn, final String schema,
      final String table) throws SyncDatabaseException, SQLException {
    if (conn == null || schema == null || table == null) {
      throw new SyncDatabaseException("error.argument");
    }

    CallableStatement cstmt = null;

    try {
View Full Code Here

      final String schema, final String table, final long subsid,
      final String master, final String query)
      throws SyncDatabaseException, SQLException {
    if (conn == null || schema == null || table == null || master == null
        || query == null) {
      throw new SyncDatabaseException("error.argument");
    }

    CallableStatement cstmt = null;

    try {
View Full Code Here

TOP

Related Classes of jp.co.ntt.oss.SyncDatabaseException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.