|
>Are you using SQL primarily for queries, or are >you doing a lot of updates as well? Both. The current work in progress involves customer care: signing up customers for telephone/cellular/internet/cable TV service. >Instead of: > > String mySqlStatement = "SELECT * FROM ITEMFILE WHERE >ITEMNUMBER = '" + >item + "'"; > ResultSet rs = statement.executeQuery(mySqlStatement); > >You write: > > ParmSet parms = new ParmSet(); > parms.addParm(item); > DataCollection data = query.execute(1, parms); > >The constant "1" identifies the query to run. Now you need a specific >instance of the Query class. For testing, you can start by >simply executing >your normal JDBC statements: > >public DataCollection execute(int type, ParmSet parmSet) >{ > String mySqlStatement = formatSql(type, parmSet); > ResultSet rs = statement.executeQuery(mySqlStatement); > return new DataCollection(rs); >} > >private String formatSql(int type, ParmSet parmSet) >{ > String sql = null; > > switch type > { > case 1: String item = (String) parmSet.getParms().elementAt(0); > sql = "SELECT * FROM ITEMFILE WHERE ITEMNUMBER = >'" + item + >"'"; > break; > case 2: (...) > } > > return sql; >} This is good stuff. I'll have to check with our PC developers and see if this fits the way they're looking at this stuff. Right now, the Delphi code written years ago has a multitude of functions(?); one for each business need like getLineEquipment, putLineEquipment, etc. (I'm the RPG guy over here, learning Java "on the side".) --buck
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.