param map => Config
This commit is contained in:
parent
ec8ba81cb8
commit
94f168567b
|
@ -1,6 +1,7 @@
|
|||
package com.loafle.overflow.crawler.sql;
|
||||
|
||||
import com.loafle.overflow.crawler.Crawler;
|
||||
import com.loafle.overflow.crawler.config.Config;
|
||||
|
||||
import java.sql.*;
|
||||
import java.util.ArrayList;
|
||||
|
@ -16,24 +17,25 @@ public class SQLCrawler extends Crawler {
|
|||
public SQLCrawler() {}
|
||||
|
||||
@Override
|
||||
public Object getInternal(Map<String, Object> config) {
|
||||
public Object getInternal(Config config) {
|
||||
return getMetrics(config);
|
||||
}
|
||||
|
||||
|
||||
private Object getMetrics(Map<String, Object> config) {
|
||||
private Object getMetrics(Config config) {
|
||||
|
||||
Connection conn = null;
|
||||
Statement stmt = null;
|
||||
ResultSet rs = null;
|
||||
try {
|
||||
conn = DriverManager.getConnection(
|
||||
(String)config.get("url"),
|
||||
(String)config.get("user"),
|
||||
(String)config.get("pw"));
|
||||
// conn = DriverManager.getConnection(
|
||||
// (String)config.get("url"),
|
||||
// (String)config.get("user"),
|
||||
// (String)config.get("pw"));
|
||||
|
||||
stmt = conn.createStatement();
|
||||
|
||||
rs = stmt.executeQuery((String)config.get("query"));
|
||||
// rs = stmt.executeQuery((String)config.get("query"));
|
||||
|
||||
ResultSetMetaData md = rs.getMetaData();
|
||||
int cnt = md.getColumnCount();
|
||||
|
|
Loading…
Reference in New Issue
Block a user