| tar xvf -
cd python setup.py build_ext
python setup.py install
Example Program
#!/usr/bin/python
import sys
import informixdb # import the InformixDB module
# ------------------------------------
# open connection to database 'stores'
# ------------------------------------
conn = informixdb.connect("stores")
# ----------------------------------
# allocate cursor and execute select
# ----------------------------------
cursor1 = conn.cursor(rowformat = informixdb.ROW_AS_DICT)
cursor1.execute('select code, sname from state')
# --------------------------
# prepare 'delete' statement
# --------------------------
cursor2 = conn.cursor()
# ---------------------
# fetch thru result set
# ---------------------
for row in cursor1:
# -------------------------------------------
# delete row if column 'code' begins with 'C'
# -------------------------------------------
if row['code'][0] == 'C':
cursor2.execute('delete from state where code = ?', (row['code'],))
print "DELETED: %-2s %-15s" % (row['code'], row['sname'])
continue
# --------
# show row
# --------
print "%-2s %-15s" % (row['code'], row['sname'])
# ---------------------------------------
# commit transaction and close connection
# ---------------------------------------
conn.commit()
conn.close()
sys.exit(0);
More Information on Python and InformixDB
Resource Location/URL
Python Home http://www.python.org
Learning Python http://docs.python.org/tut/tut.html
Download DB-API InformixDB DB-API InformixDB
C. Haese: The Python InformixDB API python_dbi_khaese.pdf收起