textmaven.dictionaries
Interface ISQLStatementFactory

All Known Implementing Classes:
MySQLStatementFactory

public interface ISQLStatementFactory

Creates SQL statements appropriate for the database in use.

Author:
krebtho

Method Summary
 java.lang.String getCreateIndexStmt(java.lang.String tableName)
          Returns the statement to create the index on the specified the table.
 java.lang.String getCreateTableStmt(java.lang.String tableName)
          Returns the statement to create the table representing the lex.
 java.sql.PreparedStatement getInsertStmt(Translation t)
          Returns an executable prepared INSERT statement to insert the given translation.
 java.sql.PreparedStatement getLastIDStmt(Translation t)
          Returns the unique id (field nr) of the record which was last inserted.
 java.sql.PreparedStatement getLookupStmt(java.lang.String key)
          Returns an executable prepared SQL SELECT statement to check whether the given key does exist in the database
 java.sql.PreparedStatement getTranslationStmt()
          Returns an executable prepared SQL SELECT statement to lookup the translation associated with the given key
 java.sql.PreparedStatement getTranslationStmt(java.lang.String key)
          Returns an executable prepared SQL SELECT statement to lookup the translation associated with the given key
 java.lang.String getTranslationStmt(Translation t)
          Returns an executable SQL statement as string which upon execution returns all database records matching the non-null fields of the given Translation instance.
 java.sql.PreparedStatement getUpdateStmt(Translation t)
          Returns an executable prepared UPDATE statement to update the given translation.
 java.lang.String getWildcard()
          Returns wildcard string for the specific database.
 void init(java.sql.Connection con, java.lang.String tableName)
          Initializes the factory instance with the connection to use and the table name to be used for the SQL statements.
 

Method Detail

init

public void init(java.sql.Connection con,
                 java.lang.String tableName)
Initializes the factory instance with the connection to use and the table name to be used for the SQL statements.

Parameters:
con - Connection to use
tableName - database table name to use

getTranslationStmt

public java.sql.PreparedStatement getTranslationStmt(java.lang.String key)
Returns an executable prepared SQL SELECT statement to lookup the translation associated with the given key

Parameters:
key - to lookup
Returns:
executable statement

getTranslationStmt

public java.sql.PreparedStatement getTranslationStmt()
Returns an executable prepared SQL SELECT statement to lookup the translation associated with the given key

Returns:
executable statement

getTranslationStmt

public java.lang.String getTranslationStmt(Translation t)
Returns an executable SQL statement as string which upon execution returns all database records matching the non-null fields of the given Translation instance.

Parameters:
t - Translation record, non-null fields will be used in WHERE clause of select statements
Returns:
SQL statement to be used to retrieve translations

getLookupStmt

public java.sql.PreparedStatement getLookupStmt(java.lang.String key)
Returns an executable prepared SQL SELECT statement to check whether the given key does exist in the database

Parameters:
key - to lookup
Returns:
executable SQL statement

getInsertStmt

public java.sql.PreparedStatement getInsertStmt(Translation t)
Returns an executable prepared INSERT statement to insert the given translation.

Parameters:
t - Translation
Returns:
executable SQL statement

getUpdateStmt

public java.sql.PreparedStatement getUpdateStmt(Translation t)
Returns an executable prepared UPDATE statement to update the given translation. All fields in the translation have to be specified

Parameters:
t - Translation
Returns:
executable SQL statement

getLastIDStmt

public java.sql.PreparedStatement getLastIDStmt(Translation t)
Returns the unique id (field nr) of the record which was last inserted.

Parameters:
t - Translation which was inserted last. Value is stored in column ID.
Returns:
executable SQL Statement

getCreateTableStmt

public java.lang.String getCreateTableStmt(java.lang.String tableName)
Returns the statement to create the table representing the lex.

Parameters:
tableName - table which will hold the lex.
Returns:
SQL statement as string

getCreateIndexStmt

public java.lang.String getCreateIndexStmt(java.lang.String tableName)
Returns the statement to create the index on the specified the table.

Parameters:
tableName - on which index should be created
Returns:
SQL statement as string

getWildcard

public java.lang.String getWildcard()
Returns wildcard string for the specific database.

Returns:
wildcard string


Copyright © 2002-2005 Sourceforge. All Rights Reserved.