MCPcopy Create free account
hub / github.com/diyhi/bbs / printResults

Method printResults

src/main/java/cms/utils/SqlScriptRunner.java:325–352  ·  view source on GitHub ↗

打印结果 @param statement Statement对象 @param hasResults 有结果

(Statement statement, boolean hasResults)

Source from the content-addressed store, hash-verified

323 * @param hasResults 有结果
324 */
325 private void printResults(Statement statement, boolean hasResults) {
326 try {
327 if (hasResults) {
328 ResultSet rs = statement.getResultSet();
329 if (rs != null) {
330 ResultSetMetaData md = rs.getMetaData();
331 int cols = md.getColumnCount();
332 for (int i = 0; i < cols; i++) {
333 String name = md.getColumnLabel(i + 1);
334 print(name + "\t");
335 }
336 println("");
337 while (rs.next()) {
338 for (int i = 0; i < cols; i++) {
339 String value = rs.getString(i + 1);
340 print(value + "\t");
341 }
342 println("");
343 }
344 }
345 }
346 } catch (SQLException e) {
347 printlnError("打印结果出错: " + e.getMessage());
348 if (logger.isErrorEnabled()) {
349 logger.error("打印结果出错",e);
350 }
351 }
352 }
353
354 private void print(Object o) {
355 if (logWriter != null) {

Callers 1

executeStatementMethod · 0.95

Calls 5

printMethod · 0.95
printlnMethod · 0.95
printlnErrorMethod · 0.95
nextMethod · 0.80
getMessageMethod · 0.65

Tested by

no test coverage detected