<s> class Sql : <EOL> WORD_COL_NAME_PREFIX = '<STR_LIT>' <EOL> COUNT_COL_NAME = '<STR_LIT:count>' <EOL> WORD_TABLE_NAME = '<STR_LIT>' <EOL> INDEX_NAME = '<STR_LIT>' <EOL> PARAM_TABLE_NAME = '<STR_LIT>' <EOL> KEY_COL_NAME = '<STR_LIT:name>' <EOL> VAL_COL_NAME = '<STR_LIT:value>' <EOL> def _check_column_count ( self , count ) : <EOL> if count < <NUM_LIT:2> : <EOL> raise ValueError ( '<STR_LIT>' ) <EOL> def _make_column_name_list ( self , column_count ) : <EOL> return '<STR_LIT:U+002CU+0020>' . join ( [ self . WORD_COL_NAME_PREFIX + str ( n ) for n in range ( <NUM_LIT:1> , column_count + <NUM_LIT:1> ) ] ) <EOL> def _make_column_names_and_placeholders ( self , column_count ) : <EOL> return '<STR_LIT>' . join ( [ '<STR_LIT>' % ( self . WORD_COL_NAME_PREFIX , n ) for n in range ( <NUM_LIT:1> , column_count + <NUM_LIT:1> ) ] ) <EOL> def create_word_table_sql ( self , column_count ) : <EOL> return '<STR_LIT>' % ( self . WORD_TABLE_NAME , self . _make_column_name_list ( column_count ) , self . COUNT_COL_NAME ) <EOL> def create_param_table_sql ( self ) : <EOL> return '<STR_LIT>' % ( self . PARAM_TABLE_NAME , self . KEY_COL_NAME , self . VAL_COL_NAME ) <EOL> def set_param_sql ( self ) : <EOL> return '<STR_LIT>' % ( self . PARAM_TABLE_NAME , self . KEY_COL_NAME , self . VAL_COL_NAME ) <EOL> def get_param_sql ( self ) : <EOL> return '<STR_LIT>' % ( self . VAL_COL_NAME , self . PARAM_TABLE_NAME , self . KEY_COL_NAME ) <EOL> def create_index_sql ( self , column_count ) : <EOL> return '<STR_LIT>' % ( self . INDEX_NAME , self . WORD_TABLE_NAME , self . _make_column_name_list ( column_count ) ) <EOL> def select_count_for_words_sql ( self , column_count ) : <EOL> return '<STR_LIT>' % ( self . COUNT_COL_NAME , self . WORD_TABLE_NAME , self . _make_column_names_and_placeholders ( column_count ) ) <EOL> def update_count_for_words_sql ( self , column_count ) : <EOL> return '<STR_LIT>' % ( self . WORD_TABLE_NAME , self . COUNT_COL_NAME , self . _make_column_names_and_placeholders ( column_count ) ) <EOL> def insert_row_for_words_sql ( self , column_count ) : <EOL> columns = self . _make_column_name_list ( column_count ) + '<STR_LIT:U+002CU+0020>' + self . COUNT_COL_NAME <EOL> values = '<STR_LIT:U+002CU+0020>' . join ( [ '<STR_LIT:?>' ] * ( column_count + <NUM_LIT:1> ) ) <EOL> return '<STR_LIT>' % ( self . WORD_TABLE_NAME , columns , values ) <EOL> def select_words_and_counts_sql ( self , column_count ) : <EOL> last_word_col_name = self . WORD_COL_NAME_PREFIX + str ( column_count ) <EOL> return '<STR_LIT>' % ( last_word_col_name , self . COUNT_COL_NAME , self . WORD_TABLE_NAME , self . _make_column_names_and_placeholders ( column_count - <NUM_LIT:1> ) ) <EOL> def delete_words_sql ( self ) : <EOL> return '<STR_LIT>' + self . WORD_TABLE_NAME </s>
