public static Cache insertCache( String url, String r_location, String r_lang, int r_date, String tid, String fid, Date cache_date, JsonObject response) { try { DataBaseConect.cargarDriver(); DataBaseConect.conectarAlServidor("postgres", "postgres", "localhost", "alcine-dev"); DataBaseConect.exeUpdate( "INSERT INTO \"CACHE\"(url, r_location, r_lang, r_date, tid, fid, cache_date, response) VALUES ('" + url + "', '" + r_location + "', '" + r_lang + "', " + r_date + ", '" + tid + "', '" + fid + "', '" + new java.sql.Timestamp((cache_date).getTime()) + "', '" + response.toString() + "');"); DataBaseConect.cerrarConexion(); } catch (SQLException e) { e.printStackTrace(); } return new Cache(url, r_location, r_lang, r_date, tid, fid, cache_date, response); }
public static Cache updateCache( String url, String r_location, String r_lang, int r_date, String tid, String fid, Date cache_date, JsonObject response) { try { DataBaseConect.cargarDriver(); DataBaseConect.conectarAlServidor("postgres", "postgres", "localhost", "alcine-dev"); DataBaseConect.exeUpdate( "UPDATE \"CACHE\" SET tid='" + tid + "', fid='" + fid + "', cache_date='" + new java.sql.Timestamp((cache_date).getTime()) + "', response='" + response.toString() + "' WHERE url='" + url + "' AND r_location='" + r_location + "' AND r_lang='" + r_lang + "' AND r_date=" + r_date + ";"); DataBaseConect.cerrarConexion(); } catch (SQLException e) { e.printStackTrace(); } return new Cache(url, r_location, r_lang, r_date, tid, fid, cache_date, response); }