| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> comp.databases.theory -> Re: The wisdom of the object mentors (Was: Searching OO Associations with RDBMS Persistence Models)
On 2006-06-02 14:05:37 -0400, "Mikito Harakiri"
<mikharakiri_nospaum_at_yahoo.com> said:
> > Robert Martin wrote:
>
> Big Deal:
>
> boolean querySSN ( int ssn ) {
> PreparedStatement pstmt = conn.prepareStatement(
> "select count(*) from people where ssn = :0"
> );
> pstmt.setString(1,ssn);
> ResultSet rs = pstmt.executeQuery();
> rs.next();
> return rs.getInt(1)==1? true : false
> }
>
> boolean checkSSN ( int ssn ) {
> boolean[] ret = new boolean[1];
> Thread check1 = new Thread() {
> public void run() {
> ret[0] = checkSSN(ssn);
> }
> };
> check1.start();
> final int tick = 10;
> long startTime = System.currentTimeMillis();
> while( check1.isAlive() ) {
> try {
> Thread.currentThread().sleep(tick,0);
> if( System.currentTimeMillis()-startTime >
> timeoutMin*60*1000 ) {
> break;
> }
> } catch( InterruptedException e ) {
> throw new Exception("SHOULD NEVER HAPPEN");
> }
> }
> if( ret[0] ) return true;
> Thread check2 = new Thread() {
> public void run() {
> checkSSN(ssn);
> }
> };
> check2.start();
> startTime = System.currentTimeMillis();
> while( check2.isAlive() ) {
> try {
> Thread.currentThread().sleep(tick,0);
> if( System.currentTimeMillis()-startTime >
> timeoutMin*60*1000 ) {
> break;
> }
> } catch( InterruptedException e ) {
> throw new Exception("SHOULD NEVER HAPPEN");
> }
> }
> return ret[0];
> }
This is java. I believe I was asking for this to be done in a database language.
-- Robert C. Martin (Uncle Bob) | email: unclebob_at_objectmentor.com Object Mentor Inc. | blog: www.butunclebob.com The Agile Transition Experts | web: www.objectmentor.com 800-338-6716 |Received on Tue Jun 20 2006 - 14:50:51 CDT
![]() |
![]() |