File path: /sql12/fw/src/net/sourceforge/squirrel_sql/fw/gui/action/TableCopyInsertStatementCommand.java | File path: /sql12/fw/src/net/sourceforge/squirrel_sql/fw/gui/action/TableCopyUpdateStatementCommand.java | |||
Method name: void execute()
|
Method name: void execute()
|
|||
Number of AST nodes: 15 | Number of AST nodes: 14 | |||
1 | buf.append("UPDATE PressCtrlH SET ");↵ | |||
2 | boolean firstCol = true;↵ | |||
1 | for (int colIdx = 0; colIdx < nbrSelCols; ++colIdx)↵ | 3 | for (int colIdx = 0; colIdx < nbrSelCols; ++colIdx)↵ | |
2 | {↵ | 4 | {↵ | |
3 | TableColumn col = _table.getColumnModel().getColumn(selCols[colIdx]);↵ | 5 | TableColumn col = _table.getColumnModel().getColumn(selCols[colIdx]);↵ | |
4 | ColumnDisplayDefinition colDef = null;↵ | 6 | ColumnDisplayDefinition colDef = null;↵ | |
5 | if(col instanceof ExtTableColumn)↵ | 7 | if(col instanceof ExtTableColumn)↵ | |
6 | {↵ | 8 | {↵ | |
7 | colDef = ((ExtTableColumn) col).getColumnDisplayDefinition();↵ | 9 | colDef = ((ExtTableColumn) col).getColumnDisplayDefinition();↵ | |
8 | }↵ | 10 | }↵ | |
9 | else↵ | 11 | else↵ | |
10 | {↵ | 12 | {↵ | |
11 | continue;↵ | 13 | continue;↵ | |
12 | }↵ | 14 | }↵ | |
13 | if (firstCol)↵ | 15 | if (firstCol)↵ | |
14 | {↵ | 16 | {↵ | |
15 | firstCol = false;↵ | 17 | firstCol = false;↵ | |
16 | colNames.append("INSERT INTO PressCtrlH (");↵ | |||
17 | vals.append("(");↵ | |||
18 | }↵ | 18 | }↵ | |
19 | else↵ | 19 | else↵ | |
20 | {↵ | 20 | {↵ | |
21 | colNames.append(",");↵ | 21 | ↵ | |
22 | vals.append(",");↵ | 22 | buf.append(",");↵ | |
23 | }↵ | 23 | }↵ | |
24 | Object cellObj = _table.getValueAt(selRows[rowIdx], selCols[colIdx]);↵ | 24 | final Object cellObj = _table.getValueAt(selRows[rowIdx], selCols[colIdx]);↵ | |
25 | colNames.append(colDef.getColumnName());↵ | 25 | buf.append(colDef.getColumnName())↵ | |
26 | vals.append(getData(colDef, cellObj, StatType.IN));↵ | 26 | .append(getData(colDef, cellObj, StatType.UPDATE));↵ | |
27 | } | 27 | }↵ | |
28 |
| |||
See real code fragment | See real code fragment |
Number of common nesting structure subtrees | 1 |
Number of refactorable cases | 0 |
Number of non-refactorable cases | 1 |
Time elapsed for finding largest common nesting structure subtrees (ms) | 0.9 |
Clones location | Clones are in different classes having the same super class |
Number of node comparisons | 70 |
Number of mapped statements | 10 |
Number of unmapped statements in the first code fragment | 5 |
Number of unmapped statements in the second code fragment | 4 |
Time elapsed for statement mapping (ms) | 92.6 |
Clone type | Type 3 |
ID | Statement | ID | Statement | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 8 | buf.append("UPDATE PressCtrlH SET "); | ||||||||||||||||
|
| 9 | boolean firstCol = true; | |||||||||||||||
11 | for (int colIdx = 0; colIdx < nbrSelCols; ++colIdx) | 10 | for (int colIdx = 0; colIdx < nbrSelCols; ++colIdx) | |||||||||||||||
12 | TableColumn col = _table.getColumnModel().getColumn(selCols[colIdx]); | 11 | TableColumn col = _table.getColumnModel().getColumn(selCols[colIdx]); | |||||||||||||||
13 | ColumnDisplayDefinition colDef = null; | 12 | ColumnDisplayDefinition colDef = null; | |||||||||||||||
14 | if (col instanceof ExtTableColumn) | 13 | if (col instanceof ExtTableColumn) | |||||||||||||||
15 | colDef = ((ExtTableColumn)col).getColumnDisplayDefinition(); | 14 | colDef = ((ExtTableColumn)col).getColumnDisplayDefinition(); | |||||||||||||||
else | else | |||||||||||||||||
16 | continue; | 15 | continue; | |||||||||||||||
17 | if (firstCol) | 16 | if (firstCol) | |||||||||||||||
18 | firstCol = false; | 17 | firstCol = false; | |||||||||||||||
19 | colNames.append("INSERT INTO PressCtrlH ("); | | ||||||||||||||||
20 | vals.append("("); | | ||||||||||||||||
else | else | |||||||||||||||||
21 | colNames.append(","); |
| 18 | buf.append(","); | ||||||||||||||
22 | vals.append(","); | | ||||||||||||||||
|
| 19 | final Object cellObj = _table.getValueAt(selRows[rowIdx], selCols[colIdx]); | |||||||||||||||
23 | Object cellObj = _table.getValueAt(selRows[rowIdx], selCols[colIdx]); |
| | |||||||||||||||
24 | colNames.append(colDef.getColumnName()); |
| | |||||||||||||||
25 | vals.append(getData(colDef, cellObj, StatType.IN)); |
| 20 | buf.append(colDef.getColumnName()).append(getData(colDef, cellObj, StatType.UPDATE)); | ||||||||||||||
| 21 | buf.append(" WHERE\n"); |
Row | Violation |
---|---|
1 | Unmatched statement boolean firstCol=true; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
2 | Unmatched statement final Object cellObj=_table.getValueAt(selRows[rowIdx],selCols[colIdx]); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
3 | Unmatched statement Object cellObj=_table.getValueAt(selRows[rowIdx],selCols[colIdx]); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
4 | Unmatched statement colNames.append(colDef.getColumnName()); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
5 | Expression buf.append(colDef.getColumnName()) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
6 | Clone fragment #1 returns variables colIdx, colDef , while Clone fragment #2 returns variables colIdx |