Anonymous
public text v1 · immutable/**
* Returns the next id of the current table. The tabe is the default table
* When a certain mapper is iniitalised.
*
* @return int next table id
*/
protected int nextId() {
int id = 0;
String sql = "SHOW TABLE STATUS LIKE '" + getTable() + "'";
try {
ResultSet rs = select(sql);
if(! rs.next()) return 0;
id = rs.getInt("Auto_increment");
rs.close();
System.out.println("next id: " + id);
return id;
} catch(SQLException e) {
e.printStackTrace();
return 0;
}
}