CloneSet370


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

/**
 * Uppercase / Lowercase / Mixedcase identifiers are a big problem. Some databases support mixing case
 * (like McKoi) others force identifier case to all uppercase or all lowercase. Some (like MySQL) can be
 * configured to care or not care about case as well as depending on the platform the database is on. This
 * method attempt to use the metadata from the driver to "fix" the case of the identifier to be acceptable
 * for the specified session.
 * 
 * @param session
 *        the session whose disposition on case we care about.
 * @param identifier
 * @return
 */
public static String fixCase(ISession session, String identifier) {
  if (identifier == null || identifier.equals("")) {
    return identifier;
  }
  try {
    DatabaseMetaData md = session.getSQLConnection().getConnection().getMetaData();
    // Don't change the case of the identifier if database allows mixed
    // case.
    if (md.storesMixedCaseIdentifiers()) {
      return identifier;
    }
    // Fix the case according to what the database tells us.
    if (md.storesUpperCaseIdentifiers()) {
      return identifier.toUpperCase();
    }
    else {
      return identifier.toLowerCase();
    }
  }
  catch (SQLException
         e) {
    if (log.isDebugEnabled()) {
      log.debug("fixCase: unexpected exception: " + e.getMessage());
    }
    return identifier;
  }
}


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

/**
 * Uppercase / Lowercase / Mixedcase identifiers are a big problem. Some databases support mixing case
 * (like McKoi) others force identifier case to all uppercase or all lowercase. Some (like MySQL) can be
 * configured to care or not care about case as well as depending on the platform the database is on. This
 * method attempt to use the metadata from the driver to "fix" the case of the identifier to be acceptable
 * for the specified session.
 * 
 * @param session
 *           the session whose disposition on case we care about.
 * @param identifier
 * @return
 */
public static String fixCase(ISession session, String identifier) {
  if (identifier == null || identifier.equals("")) {
    return identifier;
  }
  try {
    DatabaseMetaData md = session.getSQLConnection().getConnection().getMetaData();
    // Don't change the case of the identifier if database allows mixed
    // case.
    if (md.storesMixedCaseIdentifiers()) {
      return identifier;
    }
    // Fix the case according to what the database tells us.
    if (md.storesUpperCaseIdentifiers()) {
      return identifier.toUpperCase();
    }
    else {
      return identifier.toLowerCase();
    }
  }
  catch (SQLException
         e) {
    if (log.isDebugEnabled()) {
      log.debug("fixCase: unexpected exception: " + e.getMessage());
    }
    return identifier;
  }
}


Clone AbstractionParameter Count: 0Parameter Bindings

/**
         * Uppercase / Lowercase / Mixedcase identifiers are a big problem. Some databases support mixing case
         * (like McKoi) others force identifier case to all uppercase or all lowercase. Some (like MySQL) can be
         * configured to care or not care about case as well as depending on the platform the database is on. This
         * method attempt to use the metadata from the driver to "fix" the case of the identifier to be acceptable
         * for the specified session.
         * 
         * @param session
         *           the session whose disposition on case we care about.
         * @param identifier
         * @return
         */
/**
         * Uppercase / Lowercase / Mixedcase identifiers are a big problem. Some databases support mixing case
         * (like McKoi) others force identifier case to all uppercase or all lowercase. Some (like MySQL) can be
         * configured to care or not care about case as well as depending on the platform the database is on. This
         * method attempt to use the metadata from the driver to "fix" the case of the identifier to be acceptable
         * for the specified session.
         * 
         * @param session
         *        the session whose disposition on case we care about.
         * @param identifier
         * @return
         */
public static String fixCase(ISession session, String identifier) {
  if (identifier == null || identifier.equals("")) {
    return identifier;
  }
  try {
    DatabaseMetaData md = session.getSQLConnection().getConnection().getMetaData();
    // Don't change the case of the identifier if database allows mixed
    // case.
    if (md.storesMixedCaseIdentifiers()) {
      return identifier;
    }
    // Fix the case according to what the database tells us.
    if (md.storesUpperCaseIdentifiers()) {
      return identifier.toUpperCase();
    }
    else {
      return identifier.toLowerCase();
    }
  }
  catch (SQLException
         e) {
    if (log.isDebugEnabled()) {
      log.debug("fixCase: unexpected exception: " + e.getMessage());
    }
    return identifier;
  }
}
 

CloneAbstraction
Parameter Bindings
Parameter
Index
Clone
Instance
Parameter
Name
Value
None