/** * ShitenFinderSoapBindingImpl.java * * This file was auto-generated from WSDL * by the Apache Axis WSDL2Java emitter. */ package ushiws.shiten; import ushi.jdbc.*; public class ShitenFinderSoapBindingImpl implements ushiws.shiten.ShitenFinder{ private DbcmAdaptor adaptor; public ShitenFinderSoapBindingImpl() throws Exception { adaptor = new DbcmSimpleAdaptor("mysql", "localhost", 3306, "udb", "urano", "urano398"); } /** * データベースに対してSELECT文を発行し、その結果集合を持つDbcmResultSet * オブジェクトを返します。 * @param where WHERE句の内容("WHERE"は含まない) * @param param パラメータの値 */ private DbcmResultSet executeQuery(String where, String param) throws java.rmi.RemoteException { Dbcm d = null; DbcmResultSet rset; try { d = new Dbcm(adaptor); rset = d.executeQuery( "SELECT SHITEN_CODE, SHITEN_NAME, AREA_CODE, ADDRESS, EMPLOYEE_NUM " + " FROM SHITEN WHERE " + where, new String[] { param }); d.close(); } catch(java.sql.SQLException ex){ ex.printStackTrace(); if(d != null) d.close(); throw new java.rmi.RemoteException(ex.toString()); } return rset; } public ushiws.shiten.Shiten findByCode(String shitenCode) throws java.rmi.RemoteException { DbcmResultSet rset = executeQuery("SHITEN_CODE = ?", shitenCode); if(rset.getRowCount() == 0){ return null; } else{ Shiten s = new Shiten(); s.setShitenCode(rset.getData(0, 0)); s.setShitenName(rset.getData(0, 1)); s.setAreaCode(Integer.parseInt(rset.getData(0, 2))); s.setAddress(rset.getData(0, 3)); s.setEmployeeNum(Integer.parseInt(rset.getData(0, 4))); return s; } } public ushiws.shiten.Shiten findByName(String shitenName) throws java.rmi.RemoteException { DbcmResultSet rset = executeQuery("SHITEN_NAME = ?", shitenName); if(rset.getRowCount() == 0){ return null; } else{ Shiten s = new Shiten(); s.setShitenCode(rset.getData(0, 0)); s.setShitenName(rset.getData(0, 1)); s.setAreaCode(Integer.parseInt(rset.getData(0, 2))); s.setAddress(rset.getData(0, 3)); s.setEmployeeNum(Integer.parseInt(rset.getData(0, 4))); return s; } } }