File: example.py

package info (click to toggle)
sql-editor 0.17
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 200 kB
  • ctags: 190
  • sloc: python: 1,636; makefile: 45; sh: 12
file content (35 lines) | stat: -rw-r--r-- 541 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#example of usage of MySQLdb and _mysql
import MySQLdb
import _mysql
import classes
import sys

if not sys.modules.has_key('gtk'):
    import pygtk
    pygtk.require('1.2')

import gtk

thedb="test"
thetable="visit"
thehost="localhost"
theuser="root"
thepasswd=""


#connect
db = MySQLdb.connect(host=thehost, user=theuser,
                     passwd=thepasswd)

for t in ["person", "visit","lecture","event","classroom","course"]:
    w = classes.editor(db,thedb,t)
    w.connect("delete_event", gtk.mainquit)


gtk.mainloop()

del db