Many bugfixes and improvements
This commit is contained in:
parent
c3e3bbf787
commit
363e0c6cfc
52 changed files with 2021 additions and 982 deletions
45
src/zutil/db/handler/PropertiesSQLHandler.java
Normal file
45
src/zutil/db/handler/PropertiesSQLHandler.java
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
package zutil.db.handler;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Statement;
|
||||
import java.sql.ResultSet;
|
||||
import java.util.Properties;
|
||||
|
||||
import zutil.db.SQLResultHandler;
|
||||
|
||||
/**
|
||||
* Adds the result of the query to a Properties object,
|
||||
*
|
||||
* The handler sets the first column of the result as
|
||||
* the key and the second column as the value
|
||||
*
|
||||
* @author Ziver
|
||||
*/
|
||||
public class PropertiesSQLHandler implements SQLResultHandler<Properties> {
|
||||
|
||||
private Properties prop;
|
||||
|
||||
/**
|
||||
* Creates a new Properties object to be filled
|
||||
*/
|
||||
public PropertiesSQLHandler(){
|
||||
this.prop = new Properties();
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds data to a existing Properties object
|
||||
*/
|
||||
public PropertiesSQLHandler(Properties p){
|
||||
this.prop = p;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Is called to handle an result from an query.
|
||||
*/
|
||||
public Properties handleQueryResult(Statement stmt, ResultSet result) throws SQLException{
|
||||
while( result.next() )
|
||||
prop.setProperty(result.getString(0), result.getString(1));
|
||||
return prop;
|
||||
}
|
||||
}
|
||||
|
|
@ -11,7 +11,7 @@ import zutil.db.SQLResultHandler;
|
|||
*
|
||||
* @author Ziver
|
||||
*/
|
||||
public class SimpleResultHandler<T> implements SQLResultHandler<T> {
|
||||
public class SimpleSQLHandler<T> implements SQLResultHandler<T> {
|
||||
/**
|
||||
* Is called to handle an result from an query.
|
||||
*
|
||||
Loading…
Add table
Add a link
Reference in a new issue