File path: /sql12/plugins/dbcopy/src/net/sourceforge/squirrel_sql/plugins/dbcopy/util/DBUtil.java | File path: /sql12/plugins/dbdiff/src/net/sourceforge/squirrel_sql/plugins/dbdiff/util/DBUtil.java | |||
Method name: String fixCase(ISession, String)
|
Method name: String fixCase(ISession, String)
|
|||
Number of AST nodes: 9 | Number of AST nodes: 9 | |||
1 | if (identifier == null || identifier.equals(""))↵ | 1 | if (identifier == null || identifier.equals(""))↵ | |
2 | {↵ | |||
3 | return identifier;↵ | 2 | { return identifier;↵ | |
4 | }↵ | 3 | }↵ | |
5 | try↵ | 4 | try↵ | |
6 | {↵ | 5 | {↵ | |
7 | DatabaseMetaData md = session.getSQLConnection().getConnection().getMetaData();↵ | 6 | DatabaseMetaData md = session.getSQLConnection().getConnection().getMetaData();↵ | |
8 | // Don't change the case of the identifier if database allows mixed↵ | 7 | // Don't change the case of the identifier if database allows mixed↵ | |
9 | // case.↵ | 8 | // case.↵ | |
10 | if (md.storesMixedCaseIdentifiers())↵ | 9 | if (md.storesMixedCaseIdentifiers())↵ | |
11 | {↵ | |||
12 | return identifier;↵ | 10 | { return identifier;↵ | |
13 | }↵ | 11 | }↵ | |
14 | // Fix the case according to what the database tells us.↵ | 12 | // Fix the case according to what the database tells us.↵ | |
15 | if (md.storesUpperCaseIdentifiers())↵ | 13 | if (md.storesUpperCaseIdentifiers())↵ | |
16 | {↵ | 14 | {↵ | |
17 | return identifier.toUpperCase();↵ | 15 | return identifier.toUpperCase();↵ | |
18 | } ↵ | 16 | }↵ | |
19 | else↵ | 17 | else↵ | |
20 | {↵ | 18 | {↵ | |
21 | return identifier.toLowerCase();↵ | 19 | return identifier.toLowerCase();↵ | |
22 | }↵ | 20 | }↵ | |
23 | } ↵ | 21 | }↵ | |
24 | catch (SQLException e)↵ | 22 | catch (SQLException e)↵ | |
25 | {↵ | 23 | {↵ | |
26 | if (log.isDebugEnabled())↵ | 24 | if (log.isDebugEnabled())↵ | |
27 | {↵ | 25 | {↵ | |
28 | log.debug("fixCase: unexpected exception: " + e.getMessage());↵ | 26 | log.debug("fixCase: unexpected exception: " + e.getMessage());↵ | |
29 | }↵ | 27 | }↵ | |
30 | return identifier;↵ | 28 | return identifier;↵ | |
31 | } | 29 |
| |
See real code fragment | See real code fragment |
Number of common nesting structure subtrees | 1 |
Number of refactorable cases | 1 |
Number of non-refactorable cases | 0 |
Time elapsed for finding largest common nesting structure subtrees (ms) | 1.1 |
Clones location | Clones are in different classes |
Number of node comparisons | 23 |
Number of mapped statements | 9 |
Number of unmapped statements in the first code fragment | 0 |
Number of unmapped statements in the second code fragment | 0 |
Time elapsed for statement mapping (ms) | 2.6 |
Clone type | Type 1 |
ID | Statement | ID | Statement | |
---|---|---|---|---|
1 | if (identifier == null || identifier.equals("")) | 1 | if (identifier == null || identifier.equals("")) | |
2 | return identifier; | 2 | return identifier; | |
3 | try | 3 | try | |
4 | DatabaseMetaData md = session.getSQLConnection().getConnection().getMetaData(); | 4 | DatabaseMetaData md = session.getSQLConnection().getConnection().getMetaData(); | |
5 | if (md.storesMixedCaseIdentifiers()) | 5 | if (md.storesMixedCaseIdentifiers()) | |
6 | return identifier; | 6 | return identifier; | |
7 | if (md.storesUpperCaseIdentifiers()) | 7 | if (md.storesUpperCaseIdentifiers()) | |
8 | return identifier.toUpperCase(); | 8 | return identifier.toUpperCase(); | |
else | else | |||
9 | return identifier.toLowerCase(); | 9 | return identifier.toLowerCase(); |
Row | Violation |
---|