亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? brokermodeldbimpl.java

?? java寫的股票交易系統
?? JAVA
?? 第 1 頁 / 共 2 頁
字號:
      }
      //** 4 Assign con by invoking the obtainConnection()
      //**   for example see similar step in ssnExists method
      con = obtainConnection();
      //** 5 Assign stmt by invoking createStatement on con
      //**   for example see similar step in ssnExists method
      stmt = con.createStatement();
      // The following creates the required INSERT SQL string
      request = 
        "UPDATE Customer SET "
        + " cust_name=" + "'" + name + "'" + ","
        + " address=" +"'" + addr + "'"
        + " WHERE ssn=" +"'" + id + "'";
      //** 6 Assign rowCount with the value returned by invoking 
      //**   executeUpdate(request) method on the stmt object
      rowCount = stmt.executeUpdate(request);
      //** 7 Invoke the fireModelChangeEvent with cust as param.
      //**   Q? why is this step necessary?
      fireModelChangeEvent(cust);
    } catch (Exception e) {
      e.printStackTrace();
      throw new BrokerException
        ("BrokerDbImpl.updateCustomer\n" +e);
    }
  }

  
// Customer segment state query methods
  /**-------------------------------------------------------------
   * Given an id, returns the Customer from the model
   */
  //modified  by  ourteam 051228
  //begin
  public Customer getCustomer(String id,String name,String addr)
    throws BrokerException {
    try {
      //modified by ourteam 051228
      //begin 
      //String name;
      //String addr;
      //end
      Connection con;
      Statement stmt;
      ResultSet result = null;
      String request;
      Customer cr = null;
      //** 1 Assign con by invoking the obtainConnection()
      //**   for example see similar step in ssnExists method
      con = obtainConnection();
      //** 2 Assign stmt by invoking createStatement on con
      //**   for example see similar step in ssnExists method
      stmt = con.createStatement();
      // The following creates the required SELECT SQL string
      //modified  by ourteam 051228
      //begin 
      request = 
        "SELECT ssn, cust_name, address FROM Customer "
         + " WHERE ssn like '" +id.trim()+ "%' and cust_name like '" +name.trim()
         +"%' and address like '"+addr.trim()+"%'";
      //end
      //** 3 Assign result with the value returned by invoking 
      //**   executeQuery(request) method on the stmt object 
      System.out.println(request);
      result = stmt.executeQuery(request);

      // The following statement checks if query successful
      if (result.next()) {
        //** 4 Assign name with the value returned by invoking 
        //**   getString(1) method on the result object
        //modified by ourteam 051228
        //begin
        id= result.getString(1);//end
        name = result.getString(2);
        //** 5 Assign addr with the value returned by invoking 
        //**   getString(2) method on the result object
        addr = result.getString(3);
        //** 6 Create a Customer object using (id, name, addr) 
        //**   and assign this object to cr
        cr = new Customer(id, name, addr);
      }
      else {
        // if query failed 
        throw new BrokerException("Record for " + id +
          " not found");
      }        
      // return cr
      return cr;
    } catch (SQLException e) {
      e.printStackTrace();
      throw new BrokerException("BrokerDbImpl.getCustomer\n" +e);
    }
  }
  
  //modified  by  ourteam 051228
  //begin
    public Portfolio getPortfolio(String id,String name,Share[] shares)
    throws BrokerException {
    try {
      String strID,strName,strAddr;
      strID="";strName="";strAddr="";
      Connection con;
      Statement stmt;
      ResultSet result = null;
      String request;
      Portfolio cr = null;
      //** 1 Assign con by invoking the obtainConnection()
      //**   for example see similar step in ssnExists method
      con = obtainConnection();
      //** 2 Assign stmt by invoking createStatement on con
      //**   for example see similar step in ssnExists method
      stmt = con.createStatement();
      // The following creates the required SELECT SQL string
      //modified  by  ourteam 051228
      //begin 
      request = "SELECT ssn,cust_name,address FROM Customer WHERE "
         + " ssn like '" +id.trim()+ "%' and cust_name like '" +name.trim() +"%'";
      //end
      //** 3 Assign result with the value returned by invoking 
      //**   executeQuery(request) method on the stmt object 
      System.out.println(request);
      result = stmt.executeQuery(request);

      // The following statement checks if query successful
      if (result.next()) {
        //** 4 Assign name with the value returned by invoking 
        //**   getString(1) method on the result object
        //modified by ourteam 051228
        //begin
        strID = result.getString(1);
        strName = result.getString(2);
        strAddr = result.getString(3);
        //** 5 Assign addr with the value returned by invoking 
        //**   getString(2) method on the result object

        //** 6 Create a Customer object using (id, name, addr) 
        //**   and assign this object to cr
        //modified by ourteam 051228
        //begin
        //get shares object array
        request = "SELECT Shares.symbol,quantity,price FROM Shares, Stock WHERE "
        			+ " Shares.ssn like '" +strID.trim()+ "%' "
        			+ " AND Shares.symbol=Stock.symbol";
      	System.out.println(request);
      	ArrayList alShares=new ArrayList();
      	Stock stock=null;
      	result = stmt.executeQuery(request);
      	while(result.next()){
      		stock=new Stock(result.getString(1),Float.parseFloat(result.getString(3)));
      		alShares.add(new Share(stock,Integer.parseInt(result.getString(2))));
      	}
      	
        cr = new Portfolio(new Customer(strID,strName,strAddr), alShares);
      }
      else {
        // if query failed 
        throw new BrokerException("Record for " + id +
          " not found");
      }
      // return cr
      return cr;
    } catch (SQLException e) {
      e.printStackTrace();
      throw new BrokerException("BrokerDbImpl.getPortfolio()\n" +e);
    }
  }
  
  //end

  /**-------------------------------------------------------------
   * Returns all customers in the broker model
   */
  public Customer[] getAllCustomers()
    throws BrokerException{
    String id;
    String name;
    String addr;
    Connection con;
    Statement stmt;
    ResultSet result = null;
    String request;
    Customer cr = null;
    Customer[] all;
    Customer[] temp = new Customer[1];
    ArrayList aList = new ArrayList(1);
    try {
      //** 1 assign con by invoking the obtainConnection()
      //**   for example see similar step in ssnExists method
      con = obtainConnection();
      //** 2 assign stmt by invoking createStatement on con
      //**   for example see similar step in ssnExists method
      stmt = con.createStatement();
      //** the following creates the required SELECT SQL string
      request = "SELECT * FROM CUSTOMER";
      //** 3 assign result with the value returned by invoking 
      //**   executeQuery(request) method on the stmt object
      result = stmt.executeQuery(request);
      while (result.next()) {
        //A* 4 assign id with the value returned by invoking 
        //**   getString(1) method on the result object
        id = result.getString(1);
        //A* 5 assign name with the value returned by invoking 
        //**   getString(2) method on the result object
        name = result.getString(2);
        //A* 6 assign addr with the value returned by invoking 
        //**   getString(3) method on the result object
        addr = result.getString(3);
        //A* 7 create a Customer object using (id, name, addr) 
        //**   and assign this object to cr
        cr = new Customer(id, name, addr);
        //A* 8 use the ArrayList add method to add cr to aList
        aList.add(cr);
      }
      if (aList.size() > 0) {
        //Q? for an explanation of the following line of code
        //** lookup javadoc for 
        all = (Customer[]) aList.toArray(temp);
      }
      else {
        all = null;
      }
      return all;
    } catch (SQLException e) {
      all = null;
      e.printStackTrace();
      throw new BrokerException
        ("BrokerDbImpl.getAllCustomers\n" + e);
    }
  }
  
  public void test() {
    try {  
      // getCustomer
      Customer cust = this.getCustomer("111-11-1111","Test Customer","++++++++++++++");
      System.out.println("testing getCustomer:\n" +
        "ssn 111-11-1111 " + cust);

      // updateCustomer - change addr for "111-11-1111"
      System.out.println("testing updateCustomer ");
      String addrOrig = cust.getAddr();
      cust.setAddr("++++++++++++++");
      this.updateCustomer(cust);
      cust = this.getCustomer("111-11-1111","Test Customer","++++++++++++++");
      System.out.println("after update:\nssn 111-11-1111 " 
        + cust);

      // updateCustomer - restore addr for "111-11-1111"
      System.out.println("restoring to before updateCustomer ");
      cust.setAddr(addrOrig);
      this.updateCustomer(cust);
      cust = this.getCustomer("111-11-1111","Test Customer","++++++++++++++");
      System.out.println("back to original:\nssn 111-11-1111 " 
        + cust);

      // getAllCustomers
      Customer[] custs = this.getAllCustomers();
      for (int i=0; i<custs.length; i++) {
        System.out.println("custs[" + i + "] " + custs[i].getName());
      }
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
  
  //modified  by ourteam 051228
  //begin
  public Stock getStock(String symbol, String price)
    throws BrokerException {
    	//add
    	try {
     
      Connection con;
      Statement stmt;
      ResultSet result = null;
      String request;
      Stock cr = null;
      //** 1 Assign con by invoking the obtainConnection()
      //**   for example see similar step in ssnExists method
      con = obtainConnection();
      //** 2 Assign stmt by invoking createStatement on con
      //**   for example see similar step in ssnExists method
      stmt = con.createStatement();
      // The following creates the required SELECT SQL string
      //modified  by ourteam 051228
      //begin 
      String strCond="";
      
      //if (symbol==null || symbol.trim().equals("")) symbol = "0";
      if (price==null || price.trim().equals(""))
        strCond = "";
      else
      	strCond = " and price="+price.trim();

      request = 
        "SELECT symbol, price FROM  stock "
         + " WHERE symbol like '" +symbol.trim()+ "%'" + strCond;
      
      System.out.println(request);
      result = stmt.executeQuery(request);

      // The following statement checks if query successful
      if (result.next()) {
        //** 4 Assign name with the value returned by invoking 
        //**   getString(1) method on the result object
        //modified by ourteam 051228
        //begin
        symbol= result.getString(1);//end
        price = result.getString(2);
        //** 5 Assign addr with the value returned by invoking 
        //**   getString(2) method on the result object
       
        //** 6 Create a Customer object using (id, name, addr) 
        //**   and assign this object to cr
        cr = new Stock(symbol, Float.parseFloat(price));
      }
      else {
        // if query failed 
        throw new BrokerException("Record for " + symbol +
          " not found");
      }        
      // return cr
      return cr;
    } catch (SQLException e) {
      e.printStackTrace();
      throw new BrokerException("BrokerDbImpl.getStock\n" +e);
    }
    	
  }
  //end
  
  //modified  by ourteam 051228
  //begin
   public Stock[] getAllStocks()
    throws BrokerException{
    String symbol;
    String price;
    //String addr;
    Connection con;
    Statement stmt;
    ResultSet result = null;
    String request;
    Stock cr = null;
    Stock[] all;
    Stock[] temp = new Stock[1];
    ArrayList aList = new ArrayList(1);
    try {
      //** 1 assign con by invoking the obtainConnection()
      //**   for example see similar step in ssnExists method
      con = obtainConnection();
      //** 2 assign stmt by invoking createStatement on con
      //**   for example see similar step in ssnExists method
      stmt = con.createStatement();
      //** the following creates the required SELECT SQL string
      request = "SELECT * FROM STOCK";
      //** 3 assign result with the value returned by invoking 
      //**   executeQuery(request) method on the stmt object
      result = stmt.executeQuery(request);
      while (result.next()) {
        //A* 4 assign id with the value returned by invoking 
        //**   getString(1) method on the result object
        symbol = result.getString(1);
        //A* 5 assign name with the value returned by invoking 
        //**   getString(2) method on the result object
        price = result.getString(2);
        //A* 6 assign addr with the value returned by invoking 
        //**   getString(3) method on the result object
        //addr = result.getString(3);
        //A* 7 create a Customer object using (id, name, addr) 
        //**   and assign this object to cr
        cr = new Stock(symbol,Float.parseFloat(price));
        //A* 8 use the ArrayList add method to add cr to aList
        aList.add(cr);
      }
      if (aList.size() > 0) {
        //Q? for an explanation of the following line of code
        //** lookup javadoc for 
        all = (Stock[]) aList.toArray(temp);
      }
      else {
        all = null;
      }
      return all;
    } catch (SQLException e) {
      all = null;
      e.printStackTrace();
      throw new BrokerException
        ("BrokerDbImpl.getAllStocks\n" + e);
    }
  }
  //end
  
    public static void main(String args[]) {
    String hostName = null;
    if (args.length < 1) {
       hostName = "localhost";
    }
    else {
      hostName = args[0];
    }
    try {
      BrokerModelDbImpl brokerDb=new BrokerModelDbImpl(hostName);
      brokerDb.test();
    } catch(Exception e) {
      System.out.println(e.toString());
    }
  }
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日韩免费观看2025年上映的电影 | 亚洲欧洲精品成人久久奇米网| 久久66热re国产| 日韩欧美视频在线| 黄网站免费久久| 国产精品久久看| 在线欧美小视频| 三级精品在线观看| 2021国产精品久久精品| 成人av网站在线观看免费| 亚洲免费看黄网站| 欧美一级日韩免费不卡| 国产剧情一区二区三区| 亚洲欧洲精品一区二区三区| 欧美日韩高清一区二区三区| 日本午夜精品一区二区三区电影| 欧美精品一区二区三| 99国内精品久久| 日韩电影在线观看一区| 欧美国产乱子伦| 在线观看一区不卡| 久久91精品国产91久久小草| 中文字幕在线一区| 欧美视频在线一区二区三区| 麻豆成人综合网| 亚洲视频一二三区| 日韩午夜在线播放| 色综合久久六月婷婷中文字幕| 日韩成人伦理电影在线观看| 久久精品男人天堂av| 色94色欧美sute亚洲线路一久| 美女视频黄频大全不卡视频在线播放| 国产精品天天摸av网| 7777精品伊人久久久大香线蕉 | 国产精品视频麻豆| 欧美日韩国产中文| 成人av网站大全| 久久精品国产在热久久| 成人欧美一区二区三区视频网页| 欧美一级高清片| 色综合天天综合网国产成人综合天| 免费在线观看一区| 亚洲精品免费看| 国产欧美视频一区二区三区| 欧美情侣在线播放| 日本黄色一区二区| 国产成人亚洲综合色影视| 丝袜亚洲另类欧美| 一区二区三区在线视频免费观看| 国产色产综合产在线视频 | 久久夜色精品国产噜噜av| 色欧美乱欧美15图片| 国产精品18久久久| 久久成人免费日本黄色| 亚洲妇熟xx妇色黄| 夜夜夜精品看看| 最近日韩中文字幕| 中文字幕在线视频一区| 国产色产综合产在线视频| 日韩欧美一区二区免费| 精品视频123区在线观看| www.色综合.com| 国v精品久久久网| 精品一区二区三区视频| 麻豆精品视频在线观看视频| 婷婷开心激情综合| 亚洲成人午夜影院| 亚洲国产精品久久人人爱| 一区二区三区在线免费观看| 亚洲丝袜自拍清纯另类| 国产精品嫩草影院com| 国产精品无遮挡| 国产精品久久久久久久浪潮网站 | 精品久久久久久久久久久久包黑料| 欧美色精品天天在线观看视频| 色狠狠av一区二区三区| 色天使色偷偷av一区二区| 色婷婷av一区| 欧美日韩一区高清| 欧美精品日韩一区| 欧美精品精品一区| 日韩一区二区电影网| 日韩一区二区电影| 精品国产乱码久久久久久图片 | 国产精品成人免费 | 亚洲va欧美va人人爽午夜| 一区二区三区国产精品| 亚洲高清免费视频| 日本人妖一区二区| 国产剧情在线观看一区二区| 成人性生交大片免费看中文网站| 成人免费视频一区二区| 一本色道久久综合亚洲aⅴ蜜桃| 色猫猫国产区一区二在线视频| 一本大道久久精品懂色aⅴ| 在线观看三级视频欧美| 欧美日韩一区 二区 三区 久久精品| 欧美精品成人一区二区三区四区| 日韩一区二区在线观看视频| 精品国产一区二区三区不卡| 国产精品欧美一级免费| 亚洲国产日韩精品| 久久精品国产精品青草| 成人网男人的天堂| 欧美日韩国产a| 久久亚洲一级片| 亚洲女人****多毛耸耸8| 日产欧产美韩系列久久99| 国产精品99久久久久久久vr| 91麻豆国产自产在线观看| 欧美一区二区三区免费在线看| 国产欧美中文在线| 亚洲午夜精品网| 国产在线观看一区二区| 91麻豆文化传媒在线观看| 日韩欧美在线不卡| 又紧又大又爽精品一区二区| 免费精品视频在线| 972aa.com艺术欧美| 欧美刺激午夜性久久久久久久| 国产亚洲自拍一区| 性欧美大战久久久久久久久| 国产精品一区二区在线播放 | 日韩欧美在线网站| 成人欧美一区二区三区在线播放| 热久久久久久久| 99精品视频在线观看| 欧美zozozo| 玉米视频成人免费看| 国产精品一卡二卡在线观看| 欧美探花视频资源| 中文字幕一区二区三区精华液| 日韩国产在线观看一区| 99视频精品在线| 久久久久久免费毛片精品| 日韩色视频在线观看| 亚洲网友自拍偷拍| 国产一区二区网址| 欧美日韩高清不卡| 一区二区三区视频在线观看| 国产美女精品在线| 欧美一级专区免费大片| 洋洋成人永久网站入口| 丰满少妇在线播放bd日韩电影| 欧美精品v日韩精品v韩国精品v| 亚洲日本韩国一区| 国产成人精品亚洲午夜麻豆| 日韩精品资源二区在线| 亚洲成av人片一区二区梦乃| 色呦呦网站一区| 一色屋精品亚洲香蕉网站| 国产成人免费xxxxxxxx| 亚洲精品在线三区| 蜜臀av亚洲一区中文字幕| 欧美日韩一二区| 亚洲国产一二三| 欧美日韩精品一区二区三区蜜桃| 一卡二卡三卡日韩欧美| 91丝袜高跟美女视频| 成人免费在线观看入口| 成人一道本在线| 日韩一区在线看| 色综合久久综合网97色综合| 18成人在线视频| 色综合色狠狠综合色| 一区二区三区在线视频免费| 在线视频一区二区三| 一区二区三区精品久久久| 欧美色中文字幕| 亚洲国产日韩a在线播放| 欧美日韩aaaaa| 男女视频一区二区| 精品国产人成亚洲区| 激情五月婷婷综合| 国产欧美日韩综合精品一区二区 | 国产一区二区在线观看视频| 久久色视频免费观看| 国产精品一二三区在线| 国产精品网站在线播放| 91在线porny国产在线看| 亚洲综合另类小说| 欧美三级电影在线看| 免费观看一级欧美片| 久久婷婷久久一区二区三区| 成人午夜在线播放| 亚洲色欲色欲www在线观看| 欧美日韩专区在线| 蜜桃久久精品一区二区| 亚洲国产高清aⅴ视频| 色久优优欧美色久优优| 日韩黄色小视频| 国产欧美日韩不卡免费| 99国产精品视频免费观看| 亚洲国产精品视频| 精品国产免费一区二区三区四区 | 亚洲男同性恋视频| 欧美亚洲综合网| 久久精品国产网站| 国产精品成人一区二区艾草| 欧美精品粉嫩高潮一区二区|