コード例 #1
0
 def find(self, connection, only_one=True):
     """
     Finds in the database for a star by HIP
     :param connection: open connection
     :param only_one: if True, only the first record returned by DB is returned, else all are returned
     :return: record(s) if found, else None
     """
     find_star = MySQL.select(self.TABLE, ['hip'], ['='])
     return super(Star, self).find(find_star, {'hip': self.columns['hip']}, connection, only_one)
コード例 #2
0
 def find(self, connection, only_one=True):
     """
     Finds in the database for a catalogue by author and year
     :param connection: open connection
     :param only_one: if True, only the first record returned by DB is returned, else all are returned
     :return: record(s) if found, else None
     """
     find_catalogue = MySQL.select(self.TABLE, ['author_year'], ['='])
     return super(Catalogue, self).find(find_catalogue,
                                        {'author_year': self.columns['author_year'].strip()}, connection, only_one)
コード例 #3
0
 def find(self, connection, only_one=True):
     """
     Finds in the database for a catalogue by author and year
     :param connection: open connection
     :param only_one: if True, only the first record returned by DB is returned, else all are returned
     :return: record(s) if found, else None
     """
     find_catalogue = MySQL.select(self.TABLE, ['author_year'], ['='])
     return super(Catalogue, self).find(
         find_catalogue,
         {'author_year': self.columns['author_year'].strip()}, connection,
         only_one)
コード例 #4
0
 def find(self, connection, only_one=True):
     """
     Finds in the database for this planet
     :param connection: open connection
     :param only_one: if True, only the first record returned by DB is returned, else all are returned
     :return: record(s) if found, else None
     """
     find_planet_sql = MySQL.select(self.TABLE, ['hip', 'name'], ['=', '='],
                                    ['AND'])
     return super(Planet, self).find(find_planet_sql, {
         'hip': self.columns['hip'],
         'name': self.columns['name']
     }, connection, only_one)
コード例 #5
0
 def find(self, connection, only_one=True):
     """
     Finds in the database for this composition
     :param connection: open connection
     :param only_one: if True, only the first record returned by DB is returned, else all are returned
     :return: record(s) if found, else None
     """
     find_composition = MySQL.select(self.TABLE, ['solarnorm', 'hip', 'cid', 'element'],
                                     ['=', '=', '=', '='], ['AND', 'AND', 'AND'])
     return super(Composition, self).find(find_composition,
                                          {'solarnorm': self.columns['solarnorm'], 'hip': self.columns['hip'],
                                           'cid': self.columns['cid'], 'element': self.columns['element'].strip()},
                                          connection, only_one)
コード例 #6
0
 def find(self, connection, only_one=True):
     """
     Finds in the database for this composition
     :param connection: open connection
     :param only_one: if True, only the first record returned by DB is returned, else all are returned
     :return: record(s) if found, else None
     """
     find_composition = MySQL.select(self.TABLE,
                                     ['solarnorm', 'hip', 'cid', 'element'],
                                     ['=', '=', '=', '='],
                                     ['AND', 'AND', 'AND'])
     return super(Composition, self).find(
         find_composition, {
             'solarnorm': self.columns['solarnorm'],
             'hip': self.columns['hip'],
             'cid': self.columns['cid'],
             'element': self.columns['element'].strip()
         }, connection, only_one)