Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public ArrayList<SpecVisual> Insertar_bocetos(String[] anuncios) {
- String driver = "org.postgresql.Driver";
- String connectString = "jdbc:postgresql://db1.medellin.intrayell.com:5432/clipper";
- String user = "clipper";
- String password = "clipper";
- PreparedStatement ps = null;
- ResultSet rs = null;
- ResultSetMetaData rsmd = null;
- SpecVisual specVisual = new SpecVisual();
- Advertiser advertiser = new Advertiser();
- ArrayList<SpecVisual> arrbocetos = new ArrayList<SpecVisual>();
- try {
- Class.forName(driver);
- Connection con = DriverManager.getConnection(connectString, user,
- password);
- StringBuilder sb = new StringBuilder("Select sp.clipper_Book_Id,sp.Book_Edition,"
- + "sp.creativity_id,sp.Awaiting_ref_flag,sp.type_Id,sp.pub_ad_code,sp.heading_name,"
- + "sp.Login_Id,sp.sales_rep_code,ad.advertiser_name,ad.clipper_advertiser_ref,sp.language_id,sp.multi_page_flag "
- + "from advertiser ad,Spec_visual sp "
- + "where sp.clipper_advertiser_ref= ad.clipper_advertiser_ref and sp.clipper_wi_ref in (");
- for(int i=0;i<anuncios.length;i++){
- if(i>0){
- sb.append(",");
- }
- sb.append("?");
- }
- sb.append(")");
- ps = con.prepareStatement(sb.toString());
- for(int i=0;i<anuncios.length;i++){
- ps.setString(i+1, anuncios[i]);
- }
- rs = ps.executeQuery();
- while (rs.next()) {
- specVisual
- .setClipperBookId(rs.getString("clipper_Book_Id"));
- specVisual.setBookEditionId(Long.parseLong(rs
- .getString("Book_Edition")));
- specVisual.setCreativityId(Integer.parseInt(rs
- .getString("creativity_id")));
- specVisual.setAwaitRefFlag(Integer.parseInt(rs
- .getString("Awaiting_ref_flag")));
- specVisual.setTypeId(Integer.parseInt(rs
- .getString("type_Id")));
- specVisual.setPubAdCode(rs.getString("pub_ad_code"));
- specVisual.setHeadingName(rs.getString("heading_name"));
- specVisual.setLoginId(rs.getString("Login_Id"));
- specVisual.setSalesRepCode(rs.getString("sales_rep_code"));
- advertiser.setAdvertiserName(rs
- .getString("advertiser_name"));
- advertiser.setClipperAdvertiserRef(rs
- .getString("clipper_advertiser_ref"));
- specVisual.setAdvertiser(advertiser);
- specVisual.setLanguageId(Integer.parseInt(rs
- .getString("language_id")));
- specVisual.setMultiPageFlag(Integer.parseInt(rs
- .getString("multi_page_flag")));
- // specVisual.setTypeInstructionsText("specVisualFB.getInstructions()");
- arrbocetos.add(specVisual);
- }
- }
- catch (Exception e) {
- System.out.println(e.getMessage());
- }
- finally{
- ps.close();
- con.close();
- rs.close();
- return arrbocetos;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement