Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Passing a Reference to the Current row of a ResultSet

Posted on 2003-02-25
2
Medium Priority
?
234 Views
Last Modified: 2010-03-31
Is it possible ( and safe ) to pass a reference to the current row of a result set to a method
ie are the following snippets equivalent?

Snippet A
   while (rs.next())
   {
       System.out.println(rs.getString("cola")};
   }


Snippet B.
   while (rs.next())
   {
       methodA(rs);
   }

   private void methodA(ResultSet rs)
   (
      System.out.println(rs.getString("cola"));
   }


Thanks in advance

Dave
0
Comment
Question by:howesd
2 Comments
 
LVL 9

Accepted Solution

by:
yongsing earned 200 total points
ID: 8015473
They basically work the same. You are just passing the reference to the ResultSet to another method, and inside that method you invoked the getString() method. There is really no difference. The state of the rs object is not changed as a result of using methodA.
0
 
LVL 1

Author Comment

by:howesd
ID: 8015591
Thanks for that - my code was working OK, I just wanted to make sure that it was doing what I thought it should


Dave
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
Suggested Courses
Course of the Month11 days, 4 hours left to enroll

571 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question