public String [ ] loadAllRealNames ( ) throws PersistenceException { final ArrayList < String > names = new ArrayList < String > ( ) ; // do the query execute ( new Operation < Object > ( ) { public Object invoke ( Connection conn , DatabaseLiaison liaison ) throws PersistenceException , SQLException { Statement stmt = conn . createStatement ( ) ; try { String query = "select realname from users" ; ResultSet rs = stmt . executeQuery ( query ) ; while ( rs . next ( ) ) { names . add ( rs . getString ( 1 ) ) ; } // nothing to return return null ; } finally { JDBCUtil . close ( stmt ) ; } } } ) ; // finally construct our result return names . toArray ( new String [ names . size ( ) ] ) ; }
Returns an array with the real names of every user in the system .