Chapter 6. Development tools and interfaces 215
Cursor handling in isqltcl (for SELECTs or EXECUTE PROCEDURE):
set stmt [sql open {select * from sometable}]
This statement does a PREPARE, DECLARE, OPEN and returns a statement
number (id) or a negative error and optionally takes arguments for placeholders.
set row [sql fetch $stmt 1]
This command collects one row of data and creates it as a Tcl list in the variable
‘row’. The 1 is optional and means strip trailing blanks and the list is empty if
there is no more data.
sql reopen $stmt ?arg1? ?arg2?
Reopens the statement, with new parameters.
sql close $stmt
Indicates that you have no further use for the statement and it frees both the
cursor and statement!
6.2.4 Python, Informix DB-2.2 and IDS V10
Python is an increasingly popular, general-purpose, object-oriented
programming language. Python is free and Open Source, and runs on a variety
of platforms, including Linux, UNIX, Windows, and Macintosh. Python has a
clean, elegant syntax that many developers find to be a tremendous time-saver.
Python also has powerful built-in object types that allow you to express complex
ideas in a few lines of easily maintainable code. In addition, Python comes with a
standard library of modules that provide extensive functionality and support for
such tasks as file handling, network protocols, threads and processes, XML
processing, encryption, object serialization, and E-mail and news group
message processing.
The DB-API is a standard for Python modules that provide an interface to a
DBMS. This standard ensures that Python programs can use a similar syntax to
connect to, and access data from, any supported DBMS including IDS V10.
The most current Informix IDS implementation of the Python DB-API 2.0
specifications is called InformixDB-2.2, was developed by Carsten Haese and
released in March 2006. You can find more detailed information and downloads
related to the Informix Python module at:
http://informixdb.sourceforge.net/

Get Informix Dynamic Server V10 . . . Extended Functionality for Modern Business now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.