Aug-19-2017, 03:33 PM
Hi,
I'm fetching the data from the database and I would like to check the data above of the data in the same rows as the per channel to see if the cell is empty.
Here is for example table:
---------------------------
| channel | program_id
---------------------------
| ITV |
| ITV | 3021
| ITV | 3022
| ITV | 3023
Here is the code:
How I can check in a database to see if the data above of the string is empty or not?
I'm fetching the data from the database and I would like to check the data above of the data in the same rows as the per channel to see if the cell is empty.
Here is for example table:
---------------------------
| channel | program_id
---------------------------
| ITV |
| ITV | 3021
| ITV | 3022
| ITV | 3023
Here is the code:
def update_in_database(self):
profilePath = xbmc.translatePath(os.path.join('special://userdata/addon_data/script.tvguide', 'source.db'))
conn = database.connect(profilePath)
cur = conn.cursor()
program_id = ''.join(str(x) for x in self.program_id)
cur.execute('SELECT channel, program_id FROM programs WHERE program_id=?;', (program_id,))
data = cur.fetchone()
if data:
#check if the data above the 3021 in a database is emptyHere is the output for the data:(u'103 ITV', u'3021')I have got a string of program_id which it is
3021, so I want to check the string in a database to see if the data above of the 3021 is empty so I could do something.How I can check in a database to see if the data above of the string is empty or not?
