Commit 4c0685c2 by jinfeng.wang

fix

parent 39a34f7c
......@@ -2,8 +2,7 @@ package com.mobvista.apptag.utils;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;
import java.sql.PreparedStatement;
import java.util.Iterator;
import java.util.Set;
import java.util.regex.Pattern;
......@@ -22,8 +21,8 @@ public class MySqlUtil {
Class.forName("com.mysql.jdbc.Driver");
Connection con = DriverManager.getConnection(
"jdbc:mysql://dataplatform-app-tag.c5yzcdreb1xr.us-east-1.rds.amazonaws.com:3306/app_tag?useUnicode=true&characterEncoding=utf8&useSSL=false", "apptag_rw", "7gyLEVtkER3u8c9");
Statement stmt = con.createStatement();
String insert_sql = "INSERT INTO tag_list(package_name, platform, install) VALUES('@packageName','@platform',10000000000) ON DUPLICATE KEY INGORE tag = tag";
String insertSql = "INSERT INTO tag_list(package_name, platform, install) VALUES @VALUES ON DUPLICATE KEY INGORE tag = tag";
StringBuilder stringBuilder = new StringBuilder();
Iterator<String> iset = set.iterator();
while (iset.hasNext()) {
String platform;
......@@ -39,9 +38,11 @@ public class MySqlUtil {
packageName = packageName.replace("id", "");
}
}
stmt.executeQuery(insert_sql.replace("@packageName", packageName).replace("@platform", platform));
stringBuilder.append("('").append(packageName).append("','").append(platform).append("',").append("10000000000),");
}
}
PreparedStatement stmt = con.prepareStatement(insertSql.replace("@VALUES", stringBuilder.substring(0, stringBuilder.length() - 1)));
stmt.execute();
con.close();
} catch (Exception e) {
System.out.println(e);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment