A Smalltalk driver has been developed for PostgreSQL. It consists of
two libraries, the driver library is implemented in terms of PostgreSQL
interface concepts (message etc.), and the second library is a mapping
of the driver library to the ViaualWorks EXDI (think of JDBC) interface.
I've included a couple of example of the libraries being used below.
What steps need to be taken to get these Smalltalk libraries listed on
the PostgreSQL web site?
Thanks. Bruce Badger
-------------------------------------
Code examples
Using the driver layer ...
| parameterSet connection result |parameterSet := ConnectionParameterSet new.parameterSet host: '192.168.12.12';
port:5432; databaseName:
'test1'; userName: 'bbadger'.connection := PostgreSQLConnection using: parameterSet.connection executeQuery: 'create
tabletest04 (a int2, b int2)'.connection executeQuery: 'insert into test04 values (1, 1)'.connection executeQuery:
'insertinto test04 values (2, 1)'.connection executeQuery: 'insert into test04 values (3, 1)'.result := connection
executeQuery:'select a, b from test04'.connection executeQuery: 'drop table test04'.connection close.^result
Using the EXDI layer ...
| connection session |connection := PostgreSQLEXDIConnection new.connection username: 'bbadger'; environment:
'192.168.12.12_test1'.connectionconnect.session := connection getSession.session prepare: 'INSERT INTO exdiTest06
(name,phone) VALUES(?, ?)'.#(#('Curly' 'x47') #('Moe' 'x29') #('Larry' 'x83')) do: [:entry |
session bindInput: entry; execute; answer].connection disconnect.^self