I'm using this function :
def checker(name,s)
MY_T = "SELECT count(*) FROM `"+session.SessionInfo.Name where EventName='"+name+"'"
I want to check if the table exists, how can I do it ?
I saw some examples using : XXXX.execute()
what does it mean?
Here is what I saw :
query = cursor.execute("""SELECT count(*) FROM scan WHERE prefix = %s and code_id = %s and answer = %s and station_id = %s""",
(prefix, code_id, answer, station,))
if query != 1:
I tried printing MY_T to see if it returns -1 for example but it just prints "select count (*)...... "
How can I check it? Any help would be very appreciated.
query = cursor.execute("""SELECT count(*) FROM scan WHERE prefix = %s and code_id = %s and answer = %s and station_id = %s""", (prefix, code_id, answer, station,))
This is very unsafe, you should use binded variables instead. – mishik Jun 11 '13 at 12:43SELECT * FROM sqlite_master WHERE type = 'table' AND name = 'the_table_name'
– michaelmeyer Jun 11 '13 at 12:45