CloneSet57


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

public static boolean sameDatabaseType(ISession session1, ISession session2) {
  boolean result = false;
  String driver1ClassName = session1.getDriver().getDriverClassName();
  String driver2ClassName = session2.getDriver().getDriverClassName();
  if (driver1ClassName.equals(driver2ClassName)) {
    result = true;
  }
  return result;
}

/**
 * Gets the SQL statement which can be used to select the maximum length of the current data found in
 * tableName within the specified column.
 * 
 * @param sourceSession
 * @param colInfo
 * @param tableName
 * @param tableNameIsQualified
 *        TODO
 * @return
 */
public static String getMaxColumnLengthSQL(ISession sourceSession, TableColumnInfo colInfo, String tableName, boolean tableNameIsQualified) throws UserCancelledOperationException {
  StringBuilder result = new StringBuilder();
  HibernateDialect dialect = DialectFactory.getDialect(DialectFactory.SOURCE_TYPE, sourceSession.getApplication().getMainFrame(), sourceSession.getMetaData());
  String lengthFunction = dialect.getLengthFunction(colInfo.getDataType());
  if (lengthFunction == null) {
    log.error("Length function is null for dialect=" + dialect.getClass().getName() + ". Using \'length\'");
    lengthFunction = "length";
  }
  String maxFunction = dialect.getMaxFunction();
  if (maxFunction == null) {
    log.error("Max function is null for dialect=" + dialect.getClass().getName() + ". Using \'max\'");
    maxFunction = "max";
  }
  result.append("select ");
  result.append(maxFunction);
  result.append("(");
  result.append(lengthFunction);
  result.append("(");
  result.append(colInfo.getColumnName());
  result.append(")) from ");
  String table = tableName;
  if ( !tableNameIsQualified) {
    table = getQualifiedObjectName(sourceSession, colInfo.getCatalogName(), colInfo.getSchemaName(), tableName, DialectFactory.SOURCE_TYPE);
  }
  result.append(table);
  return result.toString();
}

/**
 * @param lastStatement
 *        the lastStatement to set
 */
public static void setLastStatement(String lastStatement) {
  DBUtil.lastStatement = lastStatement;
}

/**
 * @return the lastStatement
 */
public static String getLastStatement() {
  return lastStatement;
}

public static void setLastStatementValues(String values) {
  lastStatementValues = values;
}

public static String getLastStatementValues() {
  return lastStatementValues;
}


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

public static boolean sameDatabaseType(ISession session1, ISession session2) {
  boolean result = false;
  String driver1ClassName = session1.getDriver().getDriverClassName();
  String driver2ClassName = session2.getDriver().getDriverClassName();
  if (driver1ClassName.equals(driver2ClassName)) {
    result = true;
  }
  return result;
}

/**
 * Gets the SQL statement which can be used to select the maximum length of the current data found in
 * tableName within the specified column.
 * 
 * @param sourceSession
 * @param colInfo
 * @param tableName
 * @param tableNameIsQualified
 *           whether or not the specified tableName is qualified.
 * @return
 */
public static String getMaxColumnLengthSQL(ISession sourceSession, TableColumnInfo colInfo, String tableName, boolean tableNameIsQualified) throws UserCancelledOperationException {
  StringBuilder result = new StringBuilder();
  HibernateDialect dialect = DialectFactory.getDialect(DialectFactory.SOURCE_TYPE, sourceSession.getApplication().getMainFrame(), sourceSession.getMetaData());
  String lengthFunction = dialect.getLengthFunction(colInfo.getDataType());
  if (lengthFunction == null) {
    log.error("Length function is null for dialect=" + dialect.getClass().getName() + ". Using \'length\'");
    lengthFunction = "length";
  }
  String maxFunction = dialect.getMaxFunction();
  if (maxFunction == null) {
    log.error("Max function is null for dialect=" + dialect.getClass().getName() + ". Using \'max\'");
    maxFunction = "max";
  }
  result.append("select ");
  result.append(maxFunction);
  result.append("(");
  result.append(lengthFunction);
  result.append("(");
  result.append(colInfo.getColumnName());
  result.append(")) from ");
  String table = tableName;
  if ( !tableNameIsQualified) {
    table = getQualifiedObjectName(sourceSession, colInfo.getCatalogName(), colInfo.getSchemaName(), tableName, DialectFactory.SOURCE_TYPE);
  }
  result.append(table);
  return result.toString();
}

/**
 * @param lastStatement
 *           the lastStatement to set
 */
public static void setLastStatement(String lastStatement) {
  DBUtil.lastStatement = lastStatement;
}

/**
 * @return the lastStatement
 */
public static String getLastStatement() {
  return lastStatement;
}

public static void setLastStatementValues(String values) {
  lastStatementValues = values;
}

public static String getLastStatementValues() {
  return lastStatementValues;
}


Clone AbstractionParameter Count: 0Parameter Bindings

public static boolean sameDatabaseType(ISession session1, ISession session2) {
  boolean result = false;
  String driver1ClassName = session1.getDriver().getDriverClassName();
  String driver2ClassName = session2.getDriver().getDriverClassName();
  if (driver1ClassName.equals(driver2ClassName)) {
    result = true;
  }
  return result;
}

/**
         * Gets the SQL statement which can be used to select the maximum length of the current data found in
         * tableName within the specified column.
         * 
         * @param sourceSession
         * @param colInfo
         * @param tableName
         * @param tableNameIsQualified
         *           whether or not the specified tableName is qualified.
         * @return
         */
/**
         * Gets the SQL statement which can be used to select the maximum length of the current data found in
         * tableName within the specified column.
         * 
         * @param sourceSession
         * @param colInfo
         * @param tableName
         * @param tableNameIsQualified
         *        TODO
         * @return
         */
public static String getMaxColumnLengthSQL(ISession sourceSession, TableColumnInfo colInfo, String tableName, boolean tableNameIsQualified) throws UserCancelledOperationException {
  StringBuilder result = new StringBuilder();
  HibernateDialect dialect = DialectFactory.getDialect(DialectFactory.SOURCE_TYPE, sourceSession.getApplication().getMainFrame(), sourceSession.getMetaData());
  String lengthFunction = dialect.getLengthFunction(colInfo.getDataType());
  if (lengthFunction == null) {
    log.error("Length function is null for dialect=" + dialect.getClass().getName() + ". Using \'length\'");
    lengthFunction = "length";
  }
  String maxFunction = dialect.getMaxFunction();
  if (maxFunction == null) {
    log.error("Max function is null for dialect=" + dialect.getClass().getName() + ". Using \'max\'");
    maxFunction = "max";
  }
  result.append("select ");
  result.append(maxFunction);
  result.append("(");
  result.append(lengthFunction);
  result.append("(");
  result.append(colInfo.getColumnName());
  result.append(")) from ");
  String table = tableName;
  if ( !tableNameIsQualified) {
    table = getQualifiedObjectName(sourceSession, colInfo.getCatalogName(), colInfo.getSchemaName(), tableName, DialectFactory.SOURCE_TYPE);
  }
  result.append(table);
  return result.toString();
}

/**
         * @param lastStatement
         *           the lastStatement to set
         */
/**
         * @param lastStatement
         *        the lastStatement to set
         */
public static void setLastStatement(String lastStatement) {
  DBUtil.lastStatement = lastStatement;
}

/**
         * @return the lastStatement
         */
public static String getLastStatement() {
  return lastStatement;
}

public static void setLastStatementValues(String values) {
  lastStatementValues = values;
}

public static String getLastStatementValues() {
  return lastStatementValues;
}
 

CloneAbstraction
Parameter Bindings
Parameter
Index
Clone
Instance
Parameter
Name
Value
None