public class IDGenerator extends java.lang.Object
Constructor and Description |
---|
IDGenerator() |
Modifier and Type | Method and Description |
---|---|
static int |
createID(java.sql.Connection connection,
java.lang.String table,
java.lang.String column,
int min,
int max)
Returns a random ID which is not contained in the specified column of the specified
table by the time this method is called.
|
static long |
createID(java.sql.Connection connection,
java.lang.String table,
java.lang.String column,
long min,
long max)
Returns a random ID which is not contained in the specified column of the specified
table by the time this method is called.
|
static java.lang.String |
createID(java.sql.Connection connection,
java.lang.String table,
java.lang.String column,
java.lang.String chars,
int length)
Returns a random ID which is not contained in the specified column of the specified
table by the time this method is called.
|
static int |
createNextID(java.sql.Connection connection,
java.lang.String table,
java.lang.String column,
boolean higher,
int start)
Returns the next ID which is not already present in the specified table.
|
static long |
createNextID(java.sql.Connection connection,
java.lang.String table,
java.lang.String column,
boolean higher,
long start)
Returns the next ID which is not already present in the specified table.
|
static boolean |
idExists(java.sql.Connection connection,
java.lang.String table,
java.lang.String column,
long id)
Returns whether an ID already exists is the specified column of the specified table.
|
static boolean |
idExists(java.sql.Connection connection,
java.lang.String table,
java.lang.String column,
java.lang.String id) |
public IDGenerator()
public static boolean idExists(java.sql.Connection connection, java.lang.String table, java.lang.String column, long id) throws java.sql.SQLException
connection
- table
- column
- id
- java.sql.SQLException
public static boolean idExists(java.sql.Connection connection, java.lang.String table, java.lang.String column, java.lang.String id) throws java.sql.SQLException
java.sql.SQLException
public static int createID(java.sql.Connection connection, java.lang.String table, java.lang.String column, int min, int max) throws java.sql.SQLException
connection
- table
- column
- min
- max
- java.sql.SQLException
public static long createID(java.sql.Connection connection, java.lang.String table, java.lang.String column, long min, long max) throws java.sql.SQLException
connection
- table
- column
- min
- max
- java.sql.SQLException
public static java.lang.String createID(java.sql.Connection connection, java.lang.String table, java.lang.String column, java.lang.String chars, int length) throws java.sql.SQLException
connection
- table
- column
- chars
- length
- java.sql.SQLException
public static int createNextID(java.sql.Connection connection, java.lang.String table, java.lang.String column, boolean higher, int start) throws java.sql.SQLException
start
is returned. There are no changes made to the
database.connection
- table
- column
- higher
- specifies if an ID greater than the greatest or smaller than the
smallest value value in the table shall be returnedstart
- the value to be returned if the table is emptyjava.sql.SQLException
public static long createNextID(java.sql.Connection connection, java.lang.String table, java.lang.String column, boolean higher, long start) throws java.sql.SQLException
start
is returned. There are no changes made to the
database.connection
- table
- column
- higher
- specifies if an ID greater than the greatest or smaller than the
smallest value value in the table shall be returnedstart
- the value to be returned if the table is emptyjava.sql.SQLException