|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.jackrabbit.core.persistence.bundle.util.DbNameIndex
public class DbNameIndex
Implements a StringIndex
that stores and retrieves the names from a
table in a database.
Field Summary | |
---|---|
protected PreparedStatement |
indexSelect
|
protected PreparedStatement |
nameInsert
|
protected PreparedStatement |
nameSelect
|
Constructor Summary | |
---|---|
DbNameIndex(Connection con,
String schemaObjectPrefix)
Creates a new index that is stored in a db. |
Method Summary | |
---|---|
void |
close()
Closes this index and releases it's resources. |
protected void |
closeResultSet(ResultSet rs)
Closes the result set |
protected void |
closeStatement(PreparedStatement stmt)
closes the statement |
protected int |
getIndex(String string)
Retrieves the index from the database for the given string. |
protected String |
getString(int index)
Retrieves the string from the database for the given index. |
String |
indexToString(int idx)
Returns the string for a given index. |
protected void |
init(Connection con,
String schemaObjectPrefix)
Inits this index and prepares the statements. |
protected int |
insertString(String string)
Inserts a string into the database and returns the new index. |
protected void |
resetStatement(PreparedStatement stmt)
Resets the given PreparedStatement by clearing the
parameters and warnings contained. |
int |
stringToIndex(String string)
Returns the index for a given string. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected PreparedStatement nameSelect
protected PreparedStatement indexSelect
protected PreparedStatement nameInsert
Constructor Detail |
---|
public DbNameIndex(Connection con, String schemaObjectPrefix) throws SQLException
con
- the jdbc connectionschemaObjectPrefix
- the prefix for table names
SQLException
- if the statements cannot be prepared.Method Detail |
---|
protected void init(Connection con, String schemaObjectPrefix) throws SQLException
con
- the jdbc connectionschemaObjectPrefix
- the prefix for table names
SQLException
- if the statements cannot be prepared.public void close()
public int stringToIndex(String string)
stringToIndex
in interface StringIndex
string
- the string to return the index for
public String indexToString(int idx)
null
is returned.
indexToString
in interface StringIndex
idx
- the index tp returns the string for.
null
protected int insertString(String string)
string
- the string to insert
protected int getIndex(String string)
string
- the string to retrieve the index for
protected String getString(int index)
index
- the index to retrieve the string for.
null
if not found.protected void closeStatement(PreparedStatement stmt)
stmt
- the statementprotected void resetStatement(PreparedStatement stmt)
PreparedStatement
by clearing the
parameters and warnings contained.
stmt
- The PreparedStatement
to reset. If
null
this method does nothing.protected void closeResultSet(ResultSet rs)
rs
- the result set.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |