- Test for psycopg bindings
git-svn-id: file:///home/www/usr01/svn/gnuviechadmin/gnuviech.info/gnuviechadmin/trunk@103 a67ec6bc-e5d5-0310-a910-815c51eb3124
This commit is contained in:
parent
96dc383526
commit
f754b033fb
1 changed files with 29 additions and 0 deletions
29
backend/psycopgtest.py
Normal file
29
backend/psycopgtest.py
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
import psycopg
|
||||||
|
|
||||||
|
cnx = psycopg.connect("user=exim4 password=CotOgigmeIk5 dbname=gnuviechadmin")
|
||||||
|
|
||||||
|
cr = cnx.cursor()
|
||||||
|
|
||||||
|
print "-- Information from mailalias --"
|
||||||
|
cr.execute('SELECT * FROM mailalias')
|
||||||
|
cnx.commit()
|
||||||
|
|
||||||
|
print cr.description
|
||||||
|
|
||||||
|
result = cr.fetchall()
|
||||||
|
for line in result:
|
||||||
|
print line
|
||||||
|
|
||||||
|
print "-- Information from mailpasswd --"
|
||||||
|
cr.execute('SELECT * FROM mailpasswd')
|
||||||
|
cnx.commit()
|
||||||
|
result = cr.fetchall()
|
||||||
|
for line in result:
|
||||||
|
print line
|
||||||
|
|
||||||
|
print "-- Domains --"
|
||||||
|
cr.execute('SELECT DISTINCT domain FROM mailalias')
|
||||||
|
cnx.commit()
|
||||||
|
result = cr.fetchall()
|
||||||
|
for line in result:
|
||||||
|
print line
|
Loading…
Reference in a new issue