astrodatagui: StarsDB: add functions to read inserted information
This commit is contained in:
@@ -104,3 +104,26 @@ class StarDB():
|
|||||||
VALUES(\"{mainName}\", \"{source}\", {sequence}, \"{file}\")""")
|
VALUES(\"{mainName}\", \"{source}\", {sequence}, \"{file}\")""")
|
||||||
|
|
||||||
self.connection.commit()
|
self.connection.commit()
|
||||||
|
|
||||||
|
def getAllStars(self):
|
||||||
|
res = self.dbCursor.execute("""SELECT DISTINCT mainName FROM stars
|
||||||
|
ORDER BY mainName""")
|
||||||
|
return res.fetchall()
|
||||||
|
|
||||||
|
def getStarData(self, mainName):
|
||||||
|
res = self.dbCursor.execute(f"""SELECT sourceName, sequence FROM stars
|
||||||
|
WHERE mainName = \"{mainName}\"
|
||||||
|
ORDER BY
|
||||||
|
sourceName ASC,
|
||||||
|
sequence ASC""")
|
||||||
|
return res.fetchall()
|
||||||
|
|
||||||
|
def getFilePath(self, mainName, source, sequence):
|
||||||
|
print(f"Trying for {mainName}, {source}, {sequence}")
|
||||||
|
res = self.dbCursor.execute(f"""SELECT filename FROM stars
|
||||||
|
WHERE
|
||||||
|
mainName = \"{mainName}\" AND
|
||||||
|
sourceName = \"{source}\" AND
|
||||||
|
sequence = {sequence}
|
||||||
|
""")
|
||||||
|
return res.fetchone()[0]
|
||||||
|
|||||||
Reference in New Issue
Block a user