fixed same value problem

fixed looping back problem after resultSet is done
added some tests and JavaDoc