Many bugfixes and improvements
This commit is contained in:
parent
c3e3bbf787
commit
363e0c6cfc
52 changed files with 2021 additions and 982 deletions
27
src/zutil/db/handler/SimpleSQLHandler.java
Normal file
27
src/zutil/db/handler/SimpleSQLHandler.java
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
package zutil.db.handler;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Statement;
|
||||
import java.sql.ResultSet;
|
||||
|
||||
import zutil.db.SQLResultHandler;
|
||||
|
||||
/**
|
||||
* Returns the first column of the first row from the query
|
||||
*
|
||||
* @author Ziver
|
||||
*/
|
||||
public class SimpleSQLHandler<T> implements SQLResultHandler<T> {
|
||||
/**
|
||||
* Is called to handle an result from an query.
|
||||
*
|
||||
* @param stmt is the query
|
||||
* @param result is the ResultSet
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public T handleQueryResult(Statement stmt, ResultSet result) throws SQLException{
|
||||
if( result.next() )
|
||||
return (T) result.getObject(1);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue