Guest User

Untitled

a guest
Oct 14th, 2018
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.11 KB | None | 0 0
  1. '''test script to investigate implementation into bot'''
  2.  
  3. import sqlite3
  4.  
  5. conn = sqlite3.connect('example.db')
  6.  
  7. c = conn.cursor()
  8.  
  9. try:
  10.     c.execute('''CREATE TABLE members
  11.                 (bangorid text, surname text, forename text, email text, mobile text, school text, studyyear int)''')
  12. except sqlite3.Error, e:
  13.     print "An error occured: " + e.args[0]
  14.  
  15. c.execute('''DELETE FROM members''')
  16.  
  17. c.execute('''INSERT INTO members VALUES ('psuc44', 'Preston', 'Shaun', 'shaunpreston1991@gmail.com', '07510309724', 'SEECS', 2)''')
  18. c.execute('''INSERT INTO members VALUES ('psuc45', 'Preston', 'Shaun', 'shaunpreston1992@gmail.com', '07510309724', 'SEECS', 1)''')
  19. c.execute('''INSERT INTO members VALUES ('psuc46', 'Preston', 'Shaun', 'shaunpreston1993@gmail.com', '07510309724', 'SEECS', 2)''')
  20. c.execute('''INSERT INTO members VALUES ('psuc47', 'Preston', 'Shaun', 'shaunpreston1994@gmail.com', '07510309724', 'SEECS', 3)''')
  21.  
  22. conn.commit()
  23.  
  24. userid = 'psuc44'
  25.  
  26. if c.execute('SELECT forename FROM members WHERE bangorid=\''+userid+'\'') != '':
  27.     print 'True'
  28.  
  29.  
  30.  
  31. for row in c.execute('SELECT * FROM members'):
  32.     print row
Add Comment
Please, Sign In to add comment