| 
68
 | 
     1 package fschmidt.db;
 | 
| 
 | 
     2 
 | 
| 
 | 
     3 import java.sql.PreparedStatement;
 | 
| 
 | 
     4 import java.sql.ResultSet;
 | 
| 
 | 
     5 import java.sql.SQLException;
 | 
| 
 | 
     6 import java.sql.Connection;
 | 
| 
 | 
     7 import java.sql.Statement;
 | 
| 
 | 
     8 import java.util.Collection;
 | 
| 
 | 
     9 import java.util.Iterator;
 | 
| 
 | 
    10 import fschmidt.db.DbKey;
 | 
| 
 | 
    11 import fschmidt.db.DbKeySetter;
 | 
| 
 | 
    12 import fschmidt.db.DbObject;
 | 
| 
 | 
    13 import fschmidt.db.NoKey;
 | 
| 
 | 
    14 import fschmidt.db.DbArcana;
 | 
| 
 | 
    15 import fschmidt.db.DbRecord;
 | 
| 
 | 
    16 
 | 
| 
 | 
    17 
 | 
| 
 | 
    18 public enum NoKeySetter implements DbKeySetter<NoKey> {
 | 
| 
 | 
    19 
 | 
| 
 | 
    20 	INSTANCE;
 | 
| 
 | 
    21 
 | 
| 
 | 
    22 	public PreparedStatement prepareStatement(Connection con,NoKey key,String sql,int keyIndex)
 | 
| 
 | 
    23 		throws SQLException
 | 
| 
 | 
    24 	{
 | 
| 
 | 
    25 		PreparedStatement stmt = con.prepareStatement(
 | 
| 
 | 
    26 			sql
 | 
| 
 | 
    27 		);
 | 
| 
 | 
    28 		return stmt;
 | 
| 
 | 
    29 	}
 | 
| 
 | 
    30 
 | 
| 
 | 
    31 	public PreparedStatement prepareStatement(Connection con,Collection<NoKey> keys,String sql,DbArcana dbArcana)
 | 
| 
 | 
    32 		throws SQLException
 | 
| 
 | 
    33 	{
 | 
| 
 | 
    34 		return prepareStatement(con,NoKey.INSTANCE,sql,0);
 | 
| 
 | 
    35 	}
 | 
| 
 | 
    36 
 | 
| 
 | 
    37 	public NoKey refreshKeyAfterInsert(Connection con,DbRecord<NoKey,? extends DbObject> record) throws SQLException {
 | 
| 
 | 
    38 		return NoKey.INSTANCE;
 | 
| 
 | 
    39 	}
 | 
| 
 | 
    40 
 | 
| 
 | 
    41 	public NoKey getKey(ResultSet rs)
 | 
| 
 | 
    42 		throws SQLException
 | 
| 
 | 
    43 	{
 | 
| 
 | 
    44 		return NoKey.INSTANCE;
 | 
| 
 | 
    45 	}
 | 
| 
 | 
    46 
 | 
| 
 | 
    47 	public NoKey getKey(ResultSet rs,String tableName)
 | 
| 
 | 
    48 		throws SQLException
 | 
| 
 | 
    49 	{
 | 
| 
 | 
    50 		return NoKey.INSTANCE;
 | 
| 
 | 
    51 	}
 | 
| 
 | 
    52 }
 |