CloneSet58


Previous CloneSetNext CloneSetBack to Main Report
Clone
Mass
Clones in
CloneSet
Parameter
Count
Clone
Similarity
Syntax Category
[Sequence Length]
59201.000class_body_declarations[3]
Clone AbstractionParameter Bindings
Clone Instance
(Click to see clone)
Line CountSource Line
Source File
1591272
E:/TSE/Projects-CloneDR/sql12/plugins/dbcopy/src/net/sourceforge/squirrel_sql/plugins/dbcopy/util/DBUtil.java
260421
E:/TSE/Projects-CloneDR/sql12/plugins/dbdiff/src/net/sourceforge/squirrel_sql/plugins/dbdiff/util/DBUtil.java
Next
Last
Clone Instance
1
Line Count
59
Source Line
1272
Source File
E:/TSE/Projects-CloneDR/sql12/plugins/dbcopy/src/net/sourceforge/squirrel_sql/plugins/dbcopy/util/DBUtil.java

/**
 * 
 * @param con
 * @param synonym
 * @param columnName
 * @return
 * @throws SQLException
 */
public static int getColumnType(ISQLConnection con, ITableInfo ti, String columnName) throws SQLException {
  int result = -1;
  if (ti != null) {
    TableColumnInfo[] tciArr = con.getSQLMetaData().getColumnInfo(ti);
    for (int i = 0; i < tciArr.length; i++) {
      if (tciArr[i].getColumnName().equalsIgnoreCase(columnName)) {
        result = tciArr[i].getDataType();
        break;
      }
    }
  }
  return result;
}

public static int[] getColumnTypes(ISQLConnection con, ITableInfo ti, String[] colNames) throws SQLException {
  TableColumnInfo[] tciArr = con.getSQLMetaData().getColumnInfo(ti);
  int[] result = new int[tciArr.length];
  for (int i = 0; i < tciArr.length; i++) {
    boolean found = false;
    for (int j = 0; j < colNames.length && !found; j++) {
      String columnName = colNames[j];
      if (tciArr[i].getColumnName().equalsIgnoreCase(columnName)) {
        result[i] = tciArr[i].getDataType();
        found = true;
      }
    }
  }
  return result;
}

public static boolean tableHasPrimaryKey(ISQLConnection con, ITableInfo ti) throws SQLException {
  boolean result = false;
  ResultSet rs = null;
  try {
    DatabaseMetaData md = con.getConnection().getMetaData();
    String cat = ti.getCatalogName();
    String schema = ti.getSchemaName();
    String tableName = ti.getSimpleName();
    rs = md.getPrimaryKeys(cat, schema, tableName);
    if (rs.next()) {
      result = true;
    }
  }
  finally {
    SQLUtilities.closeResultSet(rs);
  }
  return result;
}


First
Previous
Clone Instance
2
Line Count
60
Source Line
421
Source File
E:/TSE/Projects-CloneDR/sql12/plugins/dbdiff/src/net/sourceforge/squirrel_sql/plugins/dbdiff/util/DBUtil.java

/**
 * @param con
 * @param synonym
 * @param columnName
 * @return
 * @throws SQLException
 */
public static int getColumnType(ISQLConnection con, ITableInfo ti, String columnName) throws SQLException {
  int result = -1;
  if (ti != null) {
    TableColumnInfo[] tciArr = con.getSQLMetaData().getColumnInfo(ti);
    for (int i = 0; i < tciArr.length; i++) {
      if (tciArr[i].getColumnName().equalsIgnoreCase(columnName)) {
        result = tciArr[i].getDataType();
        break;
      }
    }
  }
  return result;
}

public static int[] getColumnTypes(ISQLConnection con, ITableInfo ti, String[] colNames) throws SQLException {
  TableColumnInfo[] tciArr = con.getSQLMetaData().getColumnInfo(ti);
  int[] result = new int[tciArr.length];
  for (int i = 0; i < tciArr.length; i++) {
    boolean found = false;
    for (int j = 0; j < colNames.length && !found; j++) {
      String columnName = colNames[j];
      if (tciArr[i].getColumnName().equalsIgnoreCase(columnName)) {
        result[i] = tciArr[i].getDataType();
        found = true;
      }
    }
  }
  return result;
}

public static boolean tableHasPrimaryKey(ISQLConnection con, ITableInfo ti) throws SQLException {
  boolean result = false;
  ResultSet rs = null;
  try {
    DatabaseMetaData md = con.getConnection().getMetaData();
    String cat = ti.getCatalogName();
    String schema = ti.getSchemaName();
    String tableName = ti.getSimpleName();
    rs = md.getPrimaryKeys(cat, schema, tableName);
    if (rs.next()) {
      result = true;
    }
  }
  finally {
    SQLUtilities.closeResultSet(rs);
  }
  return result;
}


Clone AbstractionParameter Count: 0Parameter Bindings

/**
         * 
         * @param con
         * @param synonym
         * @param columnName
         * @return
         * @throws SQLException
         */
/**
         * @param con
         * @param synonym
         * @param columnName
         * @return
         * @throws SQLException
         */
public static int getColumnType(ISQLConnection con, ITableInfo ti, String columnName) throws SQLException {
  int result = -1;
  if (ti != null) {
    TableColumnInfo[] tciArr = con.getSQLMetaData().getColumnInfo(ti);
    for (int i = 0; i < tciArr.length; i++) {
      if (tciArr[i].getColumnName().equalsIgnoreCase(columnName)) {
        result = tciArr[i].getDataType();
        break;
      }
    }
  }
  return result;
}

public static int[] getColumnTypes(ISQLConnection con, ITableInfo ti, String[] colNames) throws SQLException {
  TableColumnInfo[] tciArr = con.getSQLMetaData().getColumnInfo(ti);
  int[] result = new int[tciArr.length];
  for (int i = 0; i < tciArr.length; i++) {
    boolean found = false;
    for (int j = 0; j < colNames.length && !found; j++) {
      String columnName = colNames[j];
      if (tciArr[i].getColumnName().equalsIgnoreCase(columnName)) {
        result[i] = tciArr[i].getDataType();
        found = true;
      }
    }
  }
  return result;
}

public static boolean tableHasPrimaryKey(ISQLConnection con, ITableInfo ti) throws SQLException {
  boolean result = false;
  ResultSet rs = null;
  try {
    DatabaseMetaData md = con.getConnection().getMetaData();
    String cat = ti.getCatalogName();
    String schema = ti.getSchemaName();
    String tableName = ti.getSimpleName();
    rs = md.getPrimaryKeys(cat, schema, tableName);
    if (rs.next()) {
      result = true;
    }
  }
  finally {
    SQLUtilities.closeResultSet(rs);
  }
  return result;
}
 

CloneAbstraction
Parameter Bindings
Parameter
Index
Clone
Instance
Parameter
Name
Value
None