Advertisement
Guest User

Untitled

a guest
Sep 28th, 2016
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. public static void insert(String table, String columns, List<String> values){
  2. try {
  3. Statement statement;
  4. statement = db.getConnection().createStatement();
  5. String walus = "(";
  6. for(String key : values){
  7. walus = walus + "'" + key + "',";
  8. }
  9. walus = walus.substring(0, walus.length()-1) + ")";
  10. statement.executeUpdate("INSERT INTO " + table + " " + columns + " VALUES " + walus);
  11. statement.close();
  12. } catch (SQLException e) {
  13. Core.criticalError(e);
  14. }
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement