Table of Contents
Example 5.1. Show data
horst@horstnotebook:~> python
Python 2.2.2 (#1, Mar 17 2003, 15:17:58)
[GCC 3.3 20030226 (prerelease) (SuSE Linux)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from hk_classes import *
>>> dr=hk_drivermanager()
>>> con=dr.new_connection("mysql")
>>> con.set_password("secret")
>>> con.connect()
1
>>> db=con.new_database("exampledb")
>>> table=db.new_table("authors")
>>> i=0
>>> table.enable()
SQL : SELECT * FROM `authors`
1
>>> table.goto_first()
1
>>> while i< table.max_rows():
... table.show_currentrow()
... table.goto_next()
... i=i+1
['1', 'Goethe,Johann Wolfgang', '1749', '1832', 'FALSE']
1
['2', 'Schiller, Friedrich von', '1759', '1805', 'TRUE']
1
['3', 'Lessing, Gotthold Ephraim', '1729', '1781', 'TRUE']
1
['4', 'Kleist', '1400', '0', 'FALSE']