Advertisement
Guest User

Untitled

a guest
Apr 5th, 2017
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 22.69 KB | None | 0 0
  1. import javax.swing.JFrame;
  2. import java.sql.*;
  3. import java.util.Calendar;
  4.  
  5. public class Bookstore {
  6.    
  7.     private Connection conDB;  
  8.     private String url;        
  9.     private JFrame frame;
  10.    
  11.     /**
  12.      * Open the connections and calls the GUI to be constructed.
  13.      * Closes the connection using the closeConnection method
  14.      * upon clicking the close button using the GUI.
  15.      */
  16.     public Bookstore() throws InstantiationException, IllegalAccessException, ClassNotFoundException, SQLException {
  17.         url = "jdbc:db2:c3421m";
  18.        
  19.         //has 3 exceptions
  20.         try {
  21.             Class.forName("com.ibm.db2.jcc.DB2Driver").newInstance();
  22.         } catch (Exception e) {
  23.             System.exit(0);
  24.         }
  25.  
  26.         //has 1 exception
  27.         try {
  28.             conDB = DriverManager.getConnection(url);
  29.         } catch (Exception e) {
  30.             System.exit(0);
  31.         }
  32.        
  33.         BookstoreBuilder b = new BookstoreBuilder(frame);
  34.         b.createGui(frame, this);
  35.    }
  36.    
  37.     /**
  38.      * This method is used in the GUI when the GUI override
  39.      * the close operation of the problem to do nothing.
  40.      * This allows us to manually close the window and the program
  41.      * which gives us the benefit of closing the connection right before
  42.      * we close the window.
  43.      */
  44.     public void closeConnection() {
  45.         try {
  46.             conDB.commit();
  47.         } catch (Exception e) {
  48.             System.exit(0);
  49.         }
  50.         try {
  51.             conDB.close(); 
  52.         } catch (Exception e) {
  53.             System.exit(0);
  54.         }
  55.     }
  56.  
  57.     /**
  58.      * This method simply finds the customer's name and
  59.      * is used to determine whether a customer exists or not.
  60.      * @param id as an int of the customer's ID retrieved from the GUI.
  61.      * @return true if the customer's name is found. False, otherwise.
  62.      * @GUI Makes the cid input field to be uneditable if true
  63.      * until the user selects the 'Reset' button or the transaction
  64.      * is made. If false, the gui outputs the customer
  65.      * to retry. Affiliated with the 'Find' button.
  66.      */
  67.     public boolean find_customer(int id) throws SQLException {
  68.         String query = "";
  69.         PreparedStatement statement = null;
  70.         ResultSet answer = null;
  71.         boolean result = false;
  72.        
  73.         query = "SELECT name FROM yrb_customer WHERE cid = ?";
  74.  
  75.        
  76.         try {
  77.             statement = conDB.prepareStatement(query);
  78.         } catch (SQLException e) {
  79.             System.exit(0);
  80.         }
  81.        
  82.         try {
  83.             statement.setInt(1, id);    // I DON'T KNOW WHAT THIS DOES AND I HATE IT
  84.             answer = statement.executeQuery();
  85.         } catch (SQLException e) {
  86.            
  87.             System.exit(0);
  88.         }
  89.        
  90.         try {
  91.             result = answer.next();
  92.         } catch (SQLException e) {
  93.            
  94.             System.exit(0);
  95.         }
  96.        
  97.         try {
  98.             answer.close();
  99.         } catch(SQLException e) {
  100.            
  101.             System.exit(0);
  102.         }
  103.  
  104.         // We're done with the handle.
  105.         try {
  106.             statement.close();
  107.         } catch(SQLException e) {
  108.            
  109.             System.exit(0);
  110.         }
  111.        
  112.         if (!result) {
  113.             System.out.println("Not found!");
  114.         } else {
  115.            
  116.         }
  117.        
  118.         return result;
  119.     }
  120.    
  121.     /**
  122.      * This method retrieves the information of a customer
  123.      * (their name, cid, and city) and is requested only if the method
  124.      * find_customer() returns true.
  125.      * @param id is an int of the customer's ID retrieved from the GUI.
  126.      * @return a String of the customers information.
  127.      * @GUI outputs the customer's information in the first text area of the
  128.      * GUI. Affiliated with the 'Find' button.
  129.      */
  130.     public String find_customerInfo(int id) {
  131.         String query = "";
  132.         PreparedStatement statement = null;
  133.         ResultSet answer = null;
  134.         StringBuffer result = new StringBuffer("Customer: ");
  135.        
  136.         query = "SELECT * FROM yrb_customer WHERE cid = ?";
  137.        
  138.         try {
  139.             statement = conDB.prepareStatement(query);
  140.         } catch (SQLException e) {
  141.             System.out.println(query);
  142.             System.exit(0);
  143.         }
  144.        
  145.    
  146.         try {
  147.             statement.setInt(1, id);    // I DON'T KNOW WHAT THIS DOES AND I HATE IT
  148.             answer = statement.executeQuery();
  149.         } catch (SQLException e) {
  150.             System.exit(0);
  151.         }
  152.        
  153.         try {
  154.             answer.next();
  155.             result.append(answer.getString("cid"));
  156.             result.append(", ");
  157.             result.append(answer.getString("name"));
  158.             result.append(", ");
  159.             result.append(answer.getString("city"));
  160.             result.append(".");
  161.         } catch (SQLException e) {
  162.             System.exit(0);
  163.         }
  164.        
  165.         try {
  166.             answer.close();
  167.         } catch(SQLException e) {
  168.             System.exit(0);
  169.         }
  170.  
  171.         // We're done with the handle.
  172.         try {
  173.             statement.close();
  174.         } catch(SQLException e) {
  175.             System.exit(0);
  176.         }
  177.  
  178.         this.fetch_categories();    //REMOVE TESTER
  179.        
  180.         return result.toString();
  181.     }
  182.    
  183.     /**
  184.      * This method freshly returns all the categories from the database
  185.      * at the current moment and puts them out for the user to choose.
  186.      * @return an array of String each containing the name of a category.
  187.      * @GUI modifies the empty dropdown list for categories and adds all
  188.      * the categories to it. Affiliated with the 'Find' button.
  189.      */
  190.     public String[] fetch_categories() {
  191.         String query = "";
  192.         PreparedStatement statement = null;
  193.         ResultSet answer = null;
  194.         String[] result = new String[this.category_Count()];
  195.        
  196.         query = "SELECT * FROM yrb_category";
  197.        
  198.         try {
  199.             statement = conDB.prepareStatement(query);
  200.         } catch (SQLException e) {
  201.             System.out.println(e);
  202.             System.exit(0);
  203.         }
  204.        
  205.    
  206.         try {
  207.             answer = statement.executeQuery();
  208.         } catch (SQLException e) {
  209.             System.out.println(e);
  210.             System.exit(0);
  211.         }
  212.        
  213.         try {
  214.             answer.next();
  215.             int i = 0;
  216.             while (i < this.category_Count()) {
  217.                 result[i] = answer.getString("cat");
  218.                 i++;
  219.                 answer.next();
  220.             }
  221.         } catch (SQLException e) {
  222.             System.out.println(e);
  223.             System.exit(0);
  224.         }
  225.        
  226.         try {
  227.             answer.close();
  228.         } catch(SQLException e) {
  229.             System.out.println("1");
  230.             System.exit(0);
  231.         }
  232.  
  233.         // We're done with the handle.
  234.         try {
  235.             statement.close();
  236.         } catch(SQLException e) {
  237.             System.out.println("1");
  238.             System.exit(0);
  239.         }
  240.  
  241.         return result;
  242.     }
  243.    
  244.     /**
  245.      * This method is a helper method for fetch_categories() to
  246.      * determine how many categories there are to initalize the array
  247.      * of Strings (category names).
  248.      * @return the number of categories in the yrb_category database.
  249.      */
  250.     private int category_Count() {
  251.         String query = "";
  252.         PreparedStatement statement = null;
  253.         ResultSet answer = null;
  254.         int result = 0;
  255.        
  256.         query = "SELECT COUNT(*) AS count FROM yrb_category";
  257.        
  258.         try {
  259.             statement = conDB.prepareStatement(query);
  260.         } catch (SQLException e) {
  261.             System.out.println(query);
  262.             System.exit(0);
  263.         }
  264.        
  265.         try {
  266.             answer = statement.executeQuery();
  267.         } catch (SQLException e) {
  268.             System.exit(0);
  269.         }
  270.        
  271.         try {
  272.             answer.next();
  273.             result = Integer.parseInt(answer.getString("count"));
  274.         } catch (SQLException e) {
  275.             System.exit(0);
  276.         }
  277.        
  278.         try {
  279.             answer.close();
  280.         } catch(SQLException e) {
  281.             System.exit(0);
  282.         }
  283.  
  284.         // We're done with the handle.
  285.         try {
  286.             statement.close();
  287.         } catch(SQLException e) {
  288.             System.exit(0);
  289.         }
  290.        
  291.         return result;
  292.  
  293.     }
  294.    
  295.     /**
  296.      * Upon selection of a category, the user may enter a book title and
  297.      * search for a book. This method returns a String with the title, year,
  298.      * language and weight of a book (separated by '.' in a StringBuffer).
  299.      * This method ONLY returns books that match the category and title
  300.      * entered by the user AND ALSO makes sure that the customer is a
  301.      * member of the club that offers the book in the output.
  302.      * @param title is a String from the title text input of the GUI.
  303.      * @param category is a String from the category dropdown menu of the GUI.
  304.      * @param cid is an int from the CID text input of the GUI.
  305.      * @return a string of the book containing all the information in the
  306.      * yrb_book table.
  307.      */
  308.     public String find_book(String title, String category, int cid) {
  309.         String query = "";
  310.         PreparedStatement statement = null;
  311.         ResultSet answer = null;
  312.         //String[] result = new String[this.book_count(title)];
  313.         StringBuffer result = new StringBuffer();
  314.    
  315.         query = "SELECT B.title, B.year, B.language, B.weight FROM yrb_offer O, yrb_member M, yrb_book B WHERE B.title = ? AND B.cat = ?"
  316.                 + " AND M.cid = ? AND M.club = O.club GROUP BY B.title, B.year, B.weight, B.language";
  317.        
  318.         try {
  319.             statement = conDB.prepareStatement(query);
  320.         } catch (SQLException e) {
  321.             System.out.println(e);
  322.             System.exit(0);
  323.         }
  324.        
  325.         try {
  326.             statement.setString(1, title);
  327.             statement.setString(2, category);
  328.             statement.setInt(3, cid);
  329.             answer = statement.executeQuery();
  330.         } catch (SQLException e) {
  331.             System.out.println(e);
  332.             System.exit(0);
  333.         }
  334.        
  335.         try {
  336.             answer.next();
  337.             int i = 0;
  338.             if (this.book_count(title, category, cid) == 0) {
  339.                 result.delete(0, result.length());
  340.                 result.append("");
  341.             } else {
  342.                 while (i < this.book_count(title, category, cid)) {
  343.                     result.append(answer.getString("title") + ". " + answer.getString("year")
  344.                     + ". " + answer.getString("language") + ". " + answer.getString("weight")  
  345.                     + "." + "\n");
  346.                     i++;
  347.                     answer.next();
  348.                 }
  349.             }
  350.         } catch (SQLException e) {
  351.             System.out.println(e);
  352.             System.exit(0);
  353.         }
  354.  
  355.         try {
  356.             answer.close();
  357.         } catch(SQLException e) {
  358.             System.exit(0);
  359.         }
  360.  
  361.         // We're done with the handle.
  362.         try {
  363.             statement.close();
  364.         } catch(SQLException e) {
  365.             System.exit(0);
  366.         }
  367.        
  368.         return result.toString();
  369.  
  370.     }
  371.      
  372.     /**
  373.      * This is a helper method for the dropdown menu of books in the GUI.
  374.      * Allows the gui to know how many options to have in the menu.
  375.      * @param title is a String that is extracted from the title text
  376.      * input from the GUI.
  377.      * @param category is a string that is retrieved from the dropdown
  378.      * category menu.
  379.      * @return a String from a StringBuffer where the Strings are
  380.      * seperated by '\n' (the new line character)
  381.      * @GUI splits the String into an array using the split method
  382.      * on the new line character symbol to put them in the dropdown
  383.      * menu of books found. After this button is pressed the dropdown
  384.      * menu becomes uneditable until the user selects the 'Reset' button
  385.      * or a transaction is made.
  386.      */
  387.     private int book_count(String title, String category, int cid) {
  388.         String query = "";
  389.         PreparedStatement statement = null;
  390.         ResultSet answer = null;
  391.         int result = 0;
  392.        
  393.         query = "SELECT COUNT(*) AS COUNT FROM (SELECT B.title, B.year, B.weight, B.language AS count FROM yrb_offer O, yrb_member M, yrb_book B WHERE B.title = ? AND B.cat = ?"
  394.                 + " AND M.cid = ? AND M.club = O.club GROUP BY B.title, B.year, B.weight, B.language)";
  395.        
  396.         try {
  397.             statement = conDB.prepareStatement(query);
  398.         } catch (SQLException e) {
  399.             System.out.println(query);
  400.             System.exit(0);
  401.         }
  402.        
  403.         try {
  404.             statement.setString(1, title);
  405.             statement.setString(2, category);
  406.             statement.setInt(3, cid);
  407.             answer = statement.executeQuery();
  408.         } catch (SQLException e) {
  409.             System.exit(0);
  410.         }
  411.        
  412.         try {
  413.             answer.next();
  414.             result = Integer.parseInt(answer.getString("count"));
  415.         } catch (SQLException e) {
  416.             System.exit(0);
  417.         }
  418.        
  419.         try {
  420.             answer.close();
  421.         } catch(SQLException e) {
  422.             System.exit(0);
  423.         }
  424.  
  425.         // We're done with the handle.
  426.         try {
  427.             statement.close();
  428.         } catch(SQLException e) {
  429.             System.exit(0);
  430.         }
  431.        
  432.         return result;
  433.  
  434.     }
  435.  
  436.     /**
  437.      * This method returns the minimum price of the book with the
  438.      * year and title extracted from the dropdown menu ALONG with
  439.      * making sure that the minimum price recieved is from a club
  440.      * that the customer with the given CID is a member of.
  441.      * @param title is a String that is extracted from the GUI and
  442.      * is the title of the book.
  443.      * @param year is an int that is extracted from the GUI and
  444.      * is the year of the book.
  445.      * @param cid is an int taht is extracted from the GUI and
  446.      * is the CID of the customer.
  447.      * @return a double with the minimum price of the book.
  448.      * @GUI outputs the minimum price and makes the book dropdown
  449.      * menu uneditable until the 'Reset' button is clicked or
  450.      * the transaction is completed.
  451.      */
  452.     public double min_price(String title, int year, int cid) {
  453.         String query = "";
  454.         PreparedStatement statement = null;
  455.         ResultSet answer = null;
  456.         double result = 0.0;
  457.        
  458.         query = "SELECT min(price) AS price FROM yrb_offer, yrb_member "
  459.                 + "WHERE yrb_offer.title = ? AND yrb_offer.year = ? AND yrb_offer.club = yrb_member.club"
  460.                 + " AND yrb_member.cid = ?";
  461.  
  462.         try {
  463.             statement = conDB.prepareStatement(query);
  464.         } catch (SQLException e) {
  465.             System.out.println(e);
  466.             System.exit(0);
  467.         }
  468.        
  469.         try {
  470.             statement.setString(1, title);
  471.             statement.setInt(2, year);
  472.             statement.setInt(3, cid);
  473.             answer = statement.executeQuery();
  474.         } catch (SQLException e) {
  475.             System.out.println(e);
  476.             System.exit(0);
  477.            
  478.         }
  479.         try {
  480.             answer.next();
  481.             result = answer.getDouble("price");
  482.            
  483.         } catch (SQLException e) {
  484.             System.out.println(e);
  485.             System.exit(0);
  486.         }
  487.        
  488.         try {
  489.             answer.close();
  490.         } catch(SQLException e) {
  491.             System.out.println(e);
  492.             System.exit(0);
  493.         }
  494.  
  495.         // We're done with the handle.
  496.         try {
  497.             statement.close();
  498.         } catch(SQLException e) {
  499.             System.out.println(e);
  500.             System.exit(0);
  501.         }
  502.        
  503.         return result;
  504.  
  505.     }
  506.  
  507.     /**
  508.      * This method is responsible for the insertion of a tuple
  509.      * into the database (specifically the yrb_database) table.
  510.      * It takes in the CID, club name, title of the book, year
  511.      * of the book and the quantity the user wants to buy. The
  512.      * timestamp is based of Java's date at the current moment
  513.      * and then converted into the Database's timestamp type.
  514.      * @param customerCid is an int and the CID of the customer
  515.      * in the CID input field.
  516.      * @param clubName is a String and the name of the club
  517.      * that is retrieved from a method called find_club()
  518.      * and it is just a helper method that: makes sure the customer
  519.      * is a member of the club dealt with and the club offers the book
  520.      * the customer wants to buy.
  521.      * @param title is a String and the name of the book the customer
  522.      * wants to purchase. It is retrieved from the GUI dropdown menu.
  523.      * @param year is an int and it is the year of the book being
  524.      * purchased. It is retrieved from the GUI dropdown menu.
  525.      * @param qnty is an int and it the quantity the user
  526.      * wants to purchase. It is retrieved from the quantity input.
  527.      * @GUI this method is affiliated with the 'Approve' button
  528.      * in the GUI. After this button is pressed, it will let the user
  529.      * know if the transaction went through or not. After approval,
  530.      * the fields are reset and the user can start from scratch.
  531.      */
  532.     public void insert_purchase(int customerCid, String clubName, String title, int year, int qnty) {
  533.         String query = "";
  534.         PreparedStatement statement = null;
  535.        
  536.         query = "INSERT INTO yrb_purchase VALUES (?, ?, ?, ?, ?, ?)";
  537.  
  538.         try {
  539.             statement = conDB.prepareStatement(query);
  540.         } catch (SQLException e) {
  541.             System.out.println(e);
  542.             System.exit(0);
  543.         }
  544.        
  545.         try {
  546.             Calendar c = Calendar.getInstance();
  547.             java.util.Date now = c.getTime();
  548.             java.sql.Timestamp currentTimestamp = new java.sql.Timestamp(now.getTime());
  549.             statement.setInt(1, customerCid);
  550.             statement.setString(2, clubName);
  551.             statement.setString(3, title);
  552.             statement.setInt(4, year);
  553.             statement.setTimestamp(5, currentTimestamp);
  554.             statement.setInt(6, qnty);
  555.            
  556.             statement.execute();
  557.         } catch (SQLException e) {
  558.             System.out.println("2" + e);
  559.             System.exit(0);
  560.            
  561.         }
  562.  
  563.         // We're done with the handle.
  564.         try {
  565.             statement.close();
  566.         } catch(SQLException e) {
  567.             System.exit(0);
  568.         }
  569.        
  570.     }
  571.    
  572.     public static void main(String[] args) throws InstantiationException, IllegalAccessException, ClassNotFoundException, SQLException {
  573.         Bookstore p = new Bookstore();
  574.     }
  575.  
  576.     /**
  577.      * This is a helper method for the insert_purchase method as it
  578.      * finds the club that the book is to be purchased from, as a String
  579.      * in order to insert the correct information into the database.
  580.      * @param title is a String and is the title of the book.
  581.      * It is retrieved from the book input from the GUI.
  582.      * @param year is an int and is the year that identifies
  583.      * the edition of the book. Is is retrieved from the dropdown
  584.      * menu selected String in the GUI.
  585.      * @param cid is an int and is the customer CID. It is retrieved
  586.      * from the CID input in the GUI.
  587.      * @return the name of the club as a String.
  588.      * @GUI is affiliated with the 'Approve' button.
  589.      */
  590.     public String find_club(String title, int year, int cid, double price) {
  591.         String query = "";
  592.         PreparedStatement statement = null;
  593.         ResultSet answer = null;
  594.         String result = "";
  595.        
  596.         query = "SELECT O.club as club FROM yrb_offer O"
  597.                 + " WHERE O.title = ? AND O.year = ? AND O.price = ? AND club IN (SELECT club FROM yrb_member WHERE cid = ?)";
  598.            
  599.         try {
  600.             statement = conDB.prepareStatement(query);
  601.         } catch (SQLException e) {
  602.             System.out.println("1");
  603.             System.out.println(e);
  604.             System.exit(0);
  605.         }
  606.        
  607.         try {
  608.             statement.setString(1, title);
  609.             statement.setInt(2, year);
  610.             statement.setDouble(3, price);
  611.             statement.setInt(4, cid);
  612.             answer = statement.executeQuery();
  613.         } catch (SQLException e) {
  614.             System.out.println("2");
  615.             System.out.println(e);
  616.             System.exit(0);
  617.         }
  618.        
  619.         try {
  620.             answer.next();
  621.             result = answer.getString("club");
  622.         } catch (SQLException e) {
  623.             System.out.println("3");
  624.             System.out.println(e);
  625.             System.exit(0);
  626.         }
  627.        
  628.         try {
  629.             answer.close();
  630.         } catch(SQLException e) {
  631.             System.exit(0);
  632.         }
  633.  
  634.         // We're done with the handle.
  635.         try {
  636.             statement.close();
  637.         } catch(SQLException e) {
  638.             System.exit(0);
  639.         }
  640.        
  641.         return result;
  642.     }
  643.    
  644.     /**
  645.      * This method returns a boolean that is true if the cid entered
  646.      * by the user exists in the database and false if it does not.
  647.      * It checks this by running a query and determining whether
  648.      * an output is returned (a tuple) or not.
  649.      * @param cid is an int and the customer CID that is retrieved
  650.      * from the GUI.
  651.      * @return a boolean whether or not the customer exists.
  652.      */
  653.     public boolean cid_exists(int cid) {
  654.         String query = "";
  655.         PreparedStatement statement = null;
  656.         ResultSet answer = null;
  657.         boolean result = false;
  658.         query = "SELECT name FROM yrb_customer WHERE cid = ?";
  659.        
  660.         try {
  661.             statement = conDB.prepareStatement(query);
  662.         } catch (SQLException e) {
  663.             System.out.println(e);
  664.             System.exit(0);
  665.         }
  666.        
  667.    
  668.         try {
  669.             statement.setInt(1, cid);
  670.             answer = statement.executeQuery();
  671.         } catch (SQLException e) {
  672.             System.out.println(e);
  673.             System.exit(0);
  674.         }
  675.        
  676.         try {
  677.             if (answer.next()) {
  678.                 result = true;
  679.             }
  680.         } catch (SQLException e) {
  681.             System.out.println(e);
  682.             System.exit(0);
  683.         }
  684.        
  685.         try {
  686.             answer.close();
  687.         } catch(SQLException e) {
  688.             System.out.println("1");
  689.             System.exit(0);
  690.         }
  691.  
  692.         // We're done with the handle.
  693.         try {
  694.             statement.close();
  695.         } catch(SQLException e) {
  696.             System.out.println("1");
  697.             System.exit(0);
  698.         }
  699.         return result;
  700.     }
  701.  
  702.     /**
  703.      * This method makes sure a book exists to let the GUI know
  704.      * whether to let the customer know that there are no books
  705.      * found.
  706.      * @param title is a String and is the title of the book.
  707.      * @param category is a String and is the category of the book.
  708.      * @param cid is an int and it is the CID of a customer.
  709.      * @return a boolean whether or not the book exists.
  710.      */
  711.     public boolean book_exists(String title, String category, int cid) {
  712.         String query = "";
  713.         PreparedStatement statement = null;
  714.         ResultSet answer = null;
  715.         boolean result = false;
  716.         //String[] result = new String[this.book_count(title)];
  717.    
  718.         query = "SELECT B.title, B.year, B.language, B.weight FROM yrb_offer O, yrb_member M, yrb_book B WHERE B.title = ? AND B.cat = ?"
  719.                 + " AND M.cid = ? AND M.club = O.club GROUP BY B.title, B.year, B.weight, B.language";
  720.        
  721.         try {
  722.             statement = conDB.prepareStatement(query);
  723.         } catch (SQLException e) {
  724.             System.out.println(e);
  725.             System.exit(0);
  726.         }
  727.        
  728.         try {
  729.             statement.setString(1, title);
  730.             statement.setString(2, category);
  731.             statement.setInt(3, cid);
  732.             answer = statement.executeQuery();
  733.         } catch (SQLException e) {
  734.             System.out.println(e);
  735.             System.exit(0);
  736.         }
  737.        
  738.         try {
  739.             if (answer.next()) {
  740.                 result = true;
  741.             }
  742.         } catch (SQLException e) {
  743.             System.out.println(e);
  744.             System.exit(0);
  745.         }
  746.  
  747.         try {
  748.             answer.close();
  749.         } catch(SQLException e) {
  750.             System.exit(0);
  751.         }
  752.  
  753.         // We're done with the handle.
  754.         try {
  755.             statement.close();
  756.         } catch(SQLException e) {
  757.             System.exit(0);
  758.         }
  759.        
  760.         return result;
  761.  
  762.     }
  763. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement