Beispiel #1
0
    def _store_package_names(self, package_names):
        values = []
        for package_name in package_names:
            values.append('("%s")' % package_name)

        if len(values) > 0:
            query = 'INSERT IGNORE INTO package_name (package_name) VALUES ' + ','.join(
                values)
            try:
                MySQLDBUtil.insert(query, None, self._db_conn)
            except Exception:
                self.logger.exception('Store package names into database fail')
Beispiel #2
0
    def _store_key_words(self, key_words):
        values = []
        for key_word in key_words:
            values.append('("%s")' % key_word)

        if len(values) > 0:
            query = 'INSERT IGNORE INTO key_word (key_word) VALUES ' + ','.join(
                values)
            try:
                MySQLDBUtil.insert(query, None, self._db_conn)
            except Exception:
                self.logger.exception('Store key words into database fail')
 def _store_app_description(self, app_detail):
     if not app_detail:
         return
     description = ' '.join(app_detail.description)
     description = description.replace('"', '').replace('\'', '')
     if not description:
         return
     query = 'INSERT INTO raw_text (text) VALUES ("%s")' % description
     try:
         MySQLDBUtil.insert(query, None, self._mysql_db_conn)
     except Exception:
         self.logger.exception('Store app description error')
 def _store_app_developer(self, app_detail):
     if not app_detail:
         return
     developer_link = app_detail.developer_link
     if not developer_link:
         return
     items = developer_link.split('id=')
     if len(items) == 2:
         developer_name = items[-1]
         query = 'INSERT IGNORE INTO developer (name) VALUES ("%s")' % developer_name
         try:
             MySQLDBUtil.insert(query, None, self._mysql_db_conn)
             self.logger.info('Stored app developer %s' % developer_name)
         except Exception:
             self.logger.exception('Store app developer error')
     else:
         return
 def _store_package_name_similar(self, package_name):
     query = 'INSERT IGNORE INTO similar_app (package_name) VALUES ("%s")' % package_name
     try:
         MySQLDBUtil.insert(query, None, self._mysql_db_conn)
     except Exception:
         self.logger.exception('Store package name into similar app database fail')