File path: /sql12/plugins/dbcopy/src/net/sourceforge/squirrel_sql/plugins/dbcopy/util/DBUtil.java | File path: /sql12/plugins/dbcopy/src/net/sourceforge/squirrel_sql/plugins/dbcopy/util/DBUtil.java | |||
Method name: void bindBlobVarInFile(PreparedStatement, int, ResultSet, int)
|
Method name: void bindClobVarInFile(PreparedStatement, int, ResultSet, int)
|
|||
Number of AST nodes: 24 | Number of AST nodes: 24 | |||
1 | InputStream is = rs.getBinaryStream(index);↵ | 1 | InputStream is = rs.getAsciiStream(index);↵ | |
2 | if (rs.wasNull())↵ | 2 | if (rs.wasNull())↵ | |
3 | {↵ | 3 | {↵ | |
4 | ps.setNull(index, type);↵ | 4 | ps.setNull(index, type);↵ | |
5 | return;↵ | 5 | return;↵ | |
6 | }↵ | 6 | }↵ | |
7 | // Open file output stream↵ | 7 | // Open file output stream↵ | |
8 | long millis = System.currentTimeMillis();↵ | 8 | long millis = System.currentTimeMillis();↵ | |
9 | File f = File.createTempFile("blob", "" + millis);↵ | 9 | File f = File.createTempFile("clob", "" + millis);↵ | |
10 | f.deleteOnExit();↵ | 10 | f.deleteOnExit();↵ | |
11 | FileOutputStream fos = new FileOutputStream(f);↵ | 11 | FileOutputStream fos = new FileOutputStream(f);↵ | |
12 | if (log.isDebugEnabled())↵ | 12 | if (log.isDebugEnabled())↵ | |
13 | {↵ | 13 | {↵ | |
14 | // i18n[DBUtil.info.bindblobfile=bindBlobVarInFile: Opening temp file '{0}']↵ | 14 | // i18n[DBUtil.info.bindclobfile=bindClobVarInFile: Opening temp file '{0}']↵ | |
15 | String msg = s_stringMgr.getString("DBUtil.info.bindblobfile", f.getAbsolutePath());↵ | 15 | String msg = s_stringMgr.getString("DBUtil.info.bindclobfile", f.getAbsolutePath());↵ | |
16 | log.debug(msg);↵ | 16 | log.debug(msg);↵ | |
17 | }↵ | 17 | }↵ | |
18 | // read rs input stream write to file output stream↵ | 18 | // read rs input stream write to file output stream↵ | |
19 | byte[] buf = new byte[_prefs.getFileCacheBufferSize()];↵ | 19 | byte[] buf = new byte[_prefs.getFileCacheBufferSize()];↵ | |
20 | int length = 0;↵ | 20 | int length = 0;↵ | |
21 | int total = 0;↵ | 21 | int total = 0;↵ | |
22 | while ((length = is.read(buf)) >= 0)↵ | 22 | while ((length = is.read(buf)) >= 0)↵ | |
23 | {↵ | 23 | {↵ | |
24 | if (log.isDebugEnabled())↵ | 24 | if (log.isDebugEnabled())↵ | |
25 | {↵ | 25 | {↵ | |
26 | // i18n[DBUtil.info.bindbloblength=bindBlobVarInFile: writing '{0}' bytes.]↵ | 26 | // i18n[DBUtil.info.bindcloblength=bindClobVarInFile: writing '{0}' bytes.]↵ | |
27 | String msg = s_stringMgr.getString("DBUtil.info.bindbloblength", Integer.valueOf(length));↵ | 27 | String msg = s_stringMgr.getString("DBUtil.info.bindcloblength", Integer.valueOf(length));↵ | |
28 | log.debug(msg);↵ | 28 | log.debug(msg);↵ | |
29 | }↵ | 29 | }↵ | |
30 | fos.write(buf, 0, length);↵ | 30 | fos.write(buf, 0, length);↵ | |
31 | total += length;↵ | 31 | total += length;↵ | |
32 | }↵ | 32 | }↵ | |
33 | fos.close();↵ | 33 | fos.close();↵ | |
34 | // set the ps to read from the file we just created.↵ | 34 | // set the ps to read from the file we just created.↵ | |
35 | FileInputStream fis = new FileInputStream(f);↵ | 35 | FileInputStream fis = new FileInputStream(f);↵ | |
36 | BufferedInputStream bis = new BufferedInputStream(fis);↵ | 36 | BufferedInputStream bis = new BufferedInputStream(fis);↵ | |
37 | ps.setBinaryStream(index, bis, total); | 37 | ps.setAsciiStream(index, bis, total); | |
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) | 0.8 |
Clones location | Clones are declared in the same class |
Number of node comparisons | 124 |
Number of mapped statements | 24 |
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) | 13.5 |
Clone type | Type 2 |
ID | Statement | ID | Statement | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | InputStream is = rs.getBinaryStream(index); |
| 1 | InputStream is = rs.getAsciiStream(index); | ||||||||||||||
2 | if (rs.wasNull()) | 2 | if (rs.wasNull()) | |||||||||||||||
3 | ps.setNull(index, type); | 3 | ps.setNull(index, type); | |||||||||||||||
4 | return; | 4 | return; | |||||||||||||||
5 | long millis = System.currentTimeMillis(); | 5 | long millis = System.currentTimeMillis(); | |||||||||||||||
6 | File f = File.createTempFile("blob", "" + millis); |
| 6 | File f = File.createTempFile("clob", "" + millis); | ||||||||||||||
7 | f.deleteOnExit(); | 7 | f.deleteOnExit(); | |||||||||||||||
8 | FileOutputStream fos = new FileOutputStream(f); | 8 | FileOutputStream fos = new FileOutputStream(f); | |||||||||||||||
9 | if (log.isDebugEnabled()) | 9 | if (log.isDebugEnabled()) | |||||||||||||||
10 | String msg = s_stringMgr.getString("DBUtil.info.bindblobfile", f.getAbsolutePath()); |
| 10 | String msg = s_stringMgr.getString("DBUtil.info.bindclobfile", f.getAbsolutePath()); | ||||||||||||||
11 | log.debug(msg); | 11 | log.debug(msg); | |||||||||||||||
12 | byte[] buf = new byte[_prefs.getFileCacheBufferSize()]; | 12 | byte[] buf = new byte[_prefs.getFileCacheBufferSize()]; | |||||||||||||||
13 | int length = 0; | 13 | int length = 0; | |||||||||||||||
14 | int total = 0; | 14 | int total = 0; | |||||||||||||||
15 | while ((length = is.read(buf)) >= 0) | 15 | while ((length = is.read(buf)) >= 0) | |||||||||||||||
16 | if (log.isDebugEnabled()) | 16 | if (log.isDebugEnabled()) | |||||||||||||||
17 | String msg = s_stringMgr.getString("DBUtil.info.bindbloblength", Integer.valueOf(length)); |
| 17 | String msg = s_stringMgr.getString("DBUtil.info.bindcloblength", Integer.valueOf(length)); | ||||||||||||||
18 | log.debug(msg); | 18 | log.debug(msg); | |||||||||||||||
19 | fos.write(buf, 0, length); | 19 | fos.write(buf, 0, length); | |||||||||||||||
20 | total += length; | 20 | total += length; | |||||||||||||||
21 | fos.close(); | 21 | fos.close(); | |||||||||||||||
22 | FileInputStream fis = new FileInputStream(f); | 22 | FileInputStream fis = new FileInputStream(f); | |||||||||||||||
23 | BufferedInputStream bis = new BufferedInputStream(fis); | 23 | BufferedInputStream bis = new BufferedInputStream(fis); | |||||||||||||||
24 | ps.setBinaryStream(index, bis, total); |
| 24 | ps.setAsciiStream(index, bis, total); |
Row | Violation |
---|---|
1 | Expression ps.setBinaryStream(index,bis,total) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
2 | Expression ps.setAsciiStream(index,bis,total) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
3 | Expression ps.setBinaryStream(index,bis,total) is a void method call, and thus it cannot be parameterized |
4 | Expression ps.setAsciiStream(index,bis,total) is a void method call, and thus it cannot be parameterized |