Logo Search packages:      
Sourcecode: ibus-table version File versions  Download package

def tabsqlitedb::tabsqlitedb::select_zi (   self,
  tabkeys 
)

Get zi from database by tab_key objects
( which should be equal or less than 6)
This method is called in table.py by passing UserInput held data
Return  result[:] 

Definition at line 696 of file tabsqlitedb.py.

00696                                   :
        '''
        Get zi from database by tab_key objects
        ( which should be equal or less than 6)
        This method is called in table.py by passing UserInput held data
        Return  result[:] 
        '''
        # firstly, we make sure the len we used is equal or less than
        # the max pinyin length 7 (include tune[1-5])
        _len = min( len(tabkeys), 7 )
        _condition = ''
        #for i in range(_len):
        #    _condition += 'AND p%d = ? ' % i
        _condition += ''.join ( map (lambda x: 'AND p%d = ? ' %x, range(_len)) )
        # you can increase the x in _len + x to include more result, but in the most case, we only need one more key result, so we don't need the extra overhead :)
        sqlstr = '''SELECT * FROM main.pinyin WHERE plen < %(mk)d  %(condition)s 
        ORDER BY plen ASC, freq DESC;''' % { 'mk':_len+3, 'condition':_condition}
        # we have redefine the __int__(self) in class tabdict.tab_key to return the key id, so we can use map to got key id :)
        _tabkeys = map(int,tabkeys[:_len])
        result = self.db.execute(sqlstr, _tabkeys).fetchall()
        #self.db.commit()
        return result[:]

    def get_ime_property( self, attr ):


Generated by  Doxygen 1.6.0   Back to index