File path: /sql12/plugins/derby/src/net/sourceforge/squirrel_sql/plugins/derby/types/DerbyClobDataTypeComponent.java | File path: /sql12/fw/src/net/sourceforge/squirrel_sql/fw/datasetviewer/cellcomponent/DataTypeClob.java | |||
Method name: void setPreparedStatementValue(PreparedStatement, Object, int)
|
Method name: void setPreparedStatementValue(PreparedStatement, Object, int)
|
|||
Number of AST nodes: 4 | Number of AST nodes: 4 | |||
1 | if (value == null || ((DerbyClobDescriptor) value).getData() == null) {↵ | 1 | if (value == null || ((ClobDescriptor)value).getData() == null) {↵ | |
2 | pstmt.setNull(position, _colDef.getSqlType());↵ | 2 | pstmt.setNull(position, _colDef.getSqlType());↵ | |
3 | } else {↵ | |||
4 | ↵ | 3 | }↵ | |
4 | else {↵ | |||
5 | // for convenience cast the object to ClobDescriptor↵ | 5 | // for convenience cast the object to ClobDescriptor↵ | |
6 | DerbyClobDescriptor cdesc = (DerbyClobDescriptor) value;↵ | 6 | ClobDescriptor cdesc = (ClobDescriptor)value;↵ | |
7 | pstmt.setCharacterStream(position,↵ | |||
8 | ↵ | 7 | // There are a couple of possible ways to update the data in the DB.↵ | |
8 | // The first is to use setString like this:↵ | |||
9 | // cdesc.getClob().setString(0, cdesc.getData());↵ | |||
10 | // However, the DB2 driver throws an exception saying that that function↵ | |||
11 | // is not implemented, so we have to use the other method, which is to use a stream.↵ | |||
9 | new StringReader(cdesc.getData()),↵ | 12 | pstmt.setCharacterStream(position, new StringReader(cdesc.getData()),↵ | |
10 | cdesc.getData().length());↵ | 13 | cdesc.getData().length());↵ | |
11 | } | 14 | } | |
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.4 |
Clones location | Clones are in different classes having the same super class |
Number of node comparisons | 16 |
Number of mapped statements | 3 |
Number of unmapped statements in the first code fragment | 1 |
Number of unmapped statements in the second code fragment | 1 |
Time elapsed for statement mapping (ms) | 10.3 |
Clone type | Type 2 |
ID | Statement | ID | Statement | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | if (value == null || ((DerbyClobDescriptor)value).getData() == null) |
| 1 | if (value == null || ((ClobDescriptor)value).getData() == null) | |||||||||||||||
2 | pstmt.setNull(position, _colDef.getSqlType()); | 2 | pstmt.setNull(position, _colDef.getSqlType()); | ||||||||||||||||
else | else | ||||||||||||||||||
|
| 3 | ClobDescriptor cdesc = (ClobDescriptor)value; | ||||||||||||||||
3 | DerbyClobDescriptor cdesc = (DerbyClobDescriptor)value; |
| | ||||||||||||||||
4 | pstmt.setCharacterStream(position, new StringReader(cdesc.getData()), cdesc.getData().length()); |
| 4 | pstmt.setCharacterStream(position, new StringReader(cdesc.getData()), cdesc.getData().length()); |
Row | Violation |
---|---|
1 | Type net.sourceforge.squirrel_sql.plugins.derby.types.DerbyClobDescriptor does not match with type net.sourceforge.squirrel_sql.fw.datasetviewer.cellcomponent.ClobDescriptor |
2 | Unmatched statement ClobDescriptor cdesc=(ClobDescriptor)value; cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted |
3 | Unmatched statement DerbyClobDescriptor cdesc=(DerbyClobDescriptor)value; cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted |
4 | Type net.sourceforge.squirrel_sql.plugins.derby.types.DerbyClobDescriptor of variable cdesc does not match with type net.sourceforge.squirrel_sql.fw.datasetviewer.cellcomponent.ClobDescriptor of variable cdesc |
5 | Type net.sourceforge.squirrel_sql.plugins.derby.types.DerbyClobDescriptor of variable cdesc does not match with type net.sourceforge.squirrel_sql.fw.datasetviewer.cellcomponent.ClobDescriptor of variable cdesc |