Using the Pharo v40592 image with which I had verified NBSQLite3 for Glorp, in this blog post I go through doing the same with the PostgresV2 pure-Smalltalk database driver.
Outside of Smalltalk, create the database 'sodbxtest', user 'sodbxtest' with password 'sodbxtest':
# su postgres -c psql
postgres=# create role sodbxtest with password 'sodbxtest' login;
CREATE ROLE
postgres=# create database sodbxtest;
CREATE DATABASE
postgres=# \q
#
In Smalltalk, firstly, install PostgresV2:
Gofer it
smalltalkhubUser: 'PharoExtras'
project: 'PostgresV2';
package: 'ConfigurationOfPostgresV2';
load.
((Smalltalk at: #ConfigurationOfPostgresV2) project version: '2.4') load.
Open Test Runner and runs the PostgresV2 tests. On my Linux Mint machine, using a vanilla PostgreSQL 9.3 installation, 23 of 24 tests passed, and TestPGConnection>>#testNotify2 erred.
Now that we know the PostgresV2 driver can talk to our database, using the Monticello browser, open the PostgresV2 repository and load the package GlorpDriverPostgreSQL. Here I had to edit NativePostgresDriver>>connectionArgsFromCurrentLogin: to comment out the second last line:
connectionArgs clientEncoding: aLogin encodingStrategy asSymbol
This is because GlorpDatabaseLoginResource class>defaultPostgreSQLLocalLogin does not specify encodingStrategy, meaning it is nil and will respond to #asSymbol with DNU.
Next, in a playground, execute the following:
GlorpDemoTablePopulatorResource invalidateSetup.
GlorpDatabaseLoginResource
defaultLogin: GlorpDatabaseLoginResource defaultPostgreSQLLocalLogin
Open Test Runner and run the Glorp tests.
Tested on Linux Mint 17.
Tags: Glorp, OODB, PostgreSQL