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
36
|
# $Id$
import MySQLdb, rpki.config
def test(filename, section):
print "[Checking " + filename + "]\n"
cfg = rpki.config.parser(filename)
db = MySQLdb.connect(user = cfg.get(section, "sql-username"),
db = cfg.get(section, "sql-database"),
passwd = cfg.get(section, "sql-password"))
cur = db.cursor()
def duh(db, cmd, header):
cur.execute(cmd)
print header
print "-" * len(header)
print cur.description
for i in cur.fetchall():
print i[0]
print
duh(db, "SHOW DATABASES", "Databases")
duh(db, "SELECT DATABASE()", "Current database")
duh(db, "SHOW TABLES", "Current tables")
db.close()
print MySQLdb.Timestamp(2007,6,9,9,45,51), MySQLdb.DateFromTicks(1000), \
MySQLdb.Binary("Hi, Mom!"), MySQLdb.STRING, MySQLdb.BINARY, MySQLdb.NUMBER, MySQLdb.NULL, "\n"
test("re.conf", "rpki")
test("irbe.conf", "irdb")
|