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;
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 fragments detected by clone detection tool
File path: /sql12/plugins/dbdiff/src/net/sourceforge/squirrel_sql/plugins/dbdiff/util/DBUtil.java
|
|
File path: /sql12/plugins/dbcopy/src/net/sourceforge/squirrel_sql/plugins/dbcopy/util/DBUtil.java
|
Method name: boolean tableHasPrimaryKey(ISQLConnection, ITableInfo)
|
|
Method name: boolean tableHasPrimaryKey(ISQLConnection, ITableInfo)
|
Number of AST nodes: 11
|
|
Number of AST nodes: 11
|
|
1 | boolean result = false;↵ | | 1 | boolean result = false;↵
|
2 | ResultSet rs = null;↵ | | 2 | ResultSet rs = null;↵
|
3 | try↵ | | 3 | try↵
|
4 | {↵ | | 4 | {↵
|
5 | DatabaseMetaData md = con.getConnection().getMetaData();↵ | | 5 | DatabaseMetaData md = con.getConnection().getMetaData();↵
|
6 | String cat = ti.getCatalogName();↵ | | 6 | String cat = ti.getCatalogName();↵
|
7 | String schema = ti.getSchemaName();↵ | | 7 | String schema = ti.getSchemaName();↵
|
8 | String tableName = ti.getSimpleName();↵ | | 8 | String tableName = ti.getSimpleName();↵
|
9 | rs = md.getPrimaryKeys(cat, schema, tableName);↵ | | 9 | rs = md.getPrimaryKeys(cat, schema, tableName);↵
|
10 | if (rs.next())↵ | | 10 | if (rs.next())↵
|
11 | {↵ | | 11 | {↵
|
12 | result = true;↵ | | 12 | result = true;↵
|
13 | }↵ | | 13 | }↵
|
14 | }↵ | | 14 | }↵
|
15 | finally↵ | | 15 | finally↵
|
16 | {↵ | | 16 | {↵
|
17 | SQLUtilities.closeResultSet(rs);↵ | | 17 | SQLUtilities.closeResultSet(rs);↵
|
18 | }↵ | | 18 | }↵
|
19 | return result; | | 19 | return result;
|
See real code fragment |
|
See real code fragment |
Summary
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) | 0.2 |
Clones location | Clones are in different classes |
Number of node comparisons | 49 |
-
{Refactorable}
Mapping Summary
Number of mapped statements | 11 |
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) | 5.1 |
Clone type | Type 1 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
1 | boolean result = false; | | 1 | boolean result = false; |
2 | ResultSet rs = null; | | 2 | ResultSet rs = null; |
3 | try | | 3 | try |
4 | DatabaseMetaData md = con.getConnection().getMetaData(); | | 4 | DatabaseMetaData md = con.getConnection().getMetaData(); |
5 | String cat = ti.getCatalogName(); | | 5 | String cat = ti.getCatalogName(); |
6 | String schema = ti.getSchemaName(); | | 6 | String schema = ti.getSchemaName(); |
7 | String tableName = ti.getSimpleName(); | | 7 | String tableName = ti.getSimpleName(); |
8 | rs = md.getPrimaryKeys(cat, schema, tableName); | | 8 | rs = md.getPrimaryKeys(cat, schema, tableName); |
9 | | | 9 | |
10 | | | 10 | |
11 | return result; | | 11 | return result; |
Precondition Violations (0)
Row |
Violation |