textmaven.dictionaries
Class MySQLStatementFactory

java.lang.Object
  extended bytextmaven.dictionaries.MySQLStatementFactory
All Implemented Interfaces:
Globals, ISQLStatementFactory

public class MySQLStatementFactory
extends java.lang.Object
implements ISQLStatementFactory, Globals

Creates and instantiates statements appropriate for the MySQL

Author:
krebtho

Field Summary
 
Fields inherited from interface textmaven.Globals
C_ATTR_CLASSNAME, C_DICT_BASE_TYPE, C_DICT_TYPE, C_SERVER_BASE_TYPE, C_STEMMER_BASE_TYPE, C_WRITER_BASE_TYPE, CONFIG_FILE, DEFAULT_SENTENCES, DEFAULT_SEPARATOR, NEW_PARA, T_COL_DICTIONARY, T_COL_HOMONYMID, T_COL_ID, T_COL_LEXKEY, T_COL_TRANSLATION, T_COL_WORDCLASS, VERBOSE
 
Constructor Summary
MySQLStatementFactory()
           
 
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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MySQLStatementFactory

public MySQLStatementFactory()
Method Detail

init

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

Specified by:
init in interface ISQLStatementFactory
Parameters:
con - Connection to use
tableName - database table name to use

getTranslationStmt

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

Specified by:
getTranslationStmt in interface ISQLStatementFactory
Parameters:
key - to lookup
Returns:
executable statement

getTranslationStmt

public java.sql.PreparedStatement getTranslationStmt()
Description copied from interface: ISQLStatementFactory
Returns an executable prepared SQL SELECT statement to lookup the translation associated with the given key

Specified by:
getTranslationStmt in interface ISQLStatementFactory
Returns:
executable statement

getTranslationStmt

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

Specified by:
getTranslationStmt in interface ISQLStatementFactory
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)
Description copied from interface: ISQLStatementFactory
Returns an executable prepared SQL SELECT statement to check whether the given key does exist in the database

Specified by:
getLookupStmt in interface ISQLStatementFactory
Parameters:
key - to lookup
Returns:
executable SQL statement

getInsertStmt

public java.sql.PreparedStatement getInsertStmt(Translation t)
Description copied from interface: ISQLStatementFactory
Returns an executable prepared INSERT statement to insert the given translation.

Specified by:
getInsertStmt in interface ISQLStatementFactory
Parameters:
t - Translation
Returns:
executable SQL statement

getUpdateStmt

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

Specified by:
getUpdateStmt in interface ISQLStatementFactory
Parameters:
t - Translation
Returns:
executable SQL statement

getLastIDStmt

public java.sql.PreparedStatement getLastIDStmt(Translation t)
Description copied from interface: ISQLStatementFactory
Returns the unique id (field nr) of the record which was last inserted.

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

getWildcard

public java.lang.String getWildcard()
Description copied from interface: ISQLStatementFactory
Returns wildcard string for the specific database.

Specified by:
getWildcard in interface ISQLStatementFactory
Returns:
wildcard string

getCreateTableStmt

public java.lang.String getCreateTableStmt(java.lang.String tableName)
Description copied from interface: ISQLStatementFactory
Returns the statement to create the table representing the lex.

Specified by:
getCreateTableStmt in interface ISQLStatementFactory
Parameters:
tableName - table which will hold the lex.
Returns:
SQL statement as string

getCreateIndexStmt

public java.lang.String getCreateIndexStmt(java.lang.String tableName)
Description copied from interface: ISQLStatementFactory
Returns the statement to create the index on the specified the table.

Specified by:
getCreateIndexStmt in interface ISQLStatementFactory
Parameters:
tableName - on which index should be created
Returns:
SQL statement as string


Copyright © 2002-2005 Sourceforge. All Rights Reserved.