SqueakDBX

The relational access answer for Squeak/Pharo

GLORP integration

The integration of GLORP with Squeak is completely hardcoded with PostgreSQL driver.
We has stated with the SqueakDBX/Glorp integration. Our intention is to make a refactor over glorp that will permit the background compatibility and support different drivers. So, if you want to use SqueakDBX in an actual Glorp application, it will have no problems. You will be able to replace the native driver with SqueakDBX driver, in a quickly and easy way. We invited Alan Night to have dinner with us when he came to Argentina. We told him our ideas and discuss for a while till we get a first design of this refactor.

Design

This is the classes diagram of GLORP. You can see that Glorp in Squeak, has coupled PostgreSQL native driver, using PGConnection Class into SqueakDatabaseAccesor. PGConnection is a connection class of the Posgres native driver in Squeak.


Glorp_class_diagram

Our solution is create an abstract layer to uncoupling the native Driver. The Next image is the our refactor to GLORP. You can see, that DatabaseDriver is the new layer charged of this. Then, It has two implementations. First, the native driver implementation (NativePosgresDriver) and second the squeakDBX implementation (SqueakDBXDriver).

GlorpDBX_class_diagram2

Progress

For now, we have made the refactor to keep the background compatibility and we have all Glorp Test running successful. We has started with the squeakDBX driver
development and running some test successful with the squeakDBX driver to posgres. The Glorp tests successful are those for running DDL scripts.

Installation:

You can install just Glorp or GlorpDBX.

To load Glorp with the native PostgreSQL driver you must evaluate:

Installer ss

project: ’Glorp’;

install: ’GlorpPharoLoader’.

And then evaluate:

GlorpPharoLoader loadGlorpWithNativePostgreSQLDriver

You can also install GlorpDBX. This will apply the path to support underscore in selectors, load Glorp and the GlorpPharoAdaptor. Then it will apply the path to Glorp to support different database drivers (our refactor) and will load the SqueakDBX Glorp Driver and also will load SqueakDBX and FFI. You don’t nee to explicitly download SqueakDBX in this case.

Installer ss

project: ’SqueakDBX’;

install: ’SqueakDBXPharoLoader’.

And then evaluate:

SqueakDBXPharoLoader loadGlorpDBX

Unit tests:

We are testing GlorpDBX using Glorp Tests. We are working on Glorp Test to make sure that all functionallities are implemented and they have not errors. You can execute them before to begin your develop.

You have to modify the DBXGlorpBackendFacility class deppending on the driver to test. There is a facility to each driver. You can change the configuration parameters in the class methods:

  • nativeDriverPostgresFacility (to use PostgreSQL Native Driver)
  • postgresDBXFacility (to use OpenDBX Driver to PostgreSQL)
  • oracleDBXFacility (Use OpenDBX Driver to Oracle)

For Example:

login := (Login new)

database: PostgreSQLPlatform new;

username: ’sodbxtest’;

password: ’sodbxtest’;

connectString: ’127.0.0.1_sodbxtest’.

You must change username and password and the connectring. The connectString is the IP with the database name. It continous on this way because we decided to respect the background compatibility with Glorp.

Then, open a Test Runner and execute the test of:

  • NativePostgresqlDriverMainBackendTest

if you want execute Glorp Test using PostgreSQL Native Driver.

  • DBXGlorpMainBackendTestPostgresql

if you want execute Glorp Test using OpenDBX Driver to PostgreSQL.

  • DBXGlorpMainBackendTestOracle

if you want execute Glorp Test using OpenDBX Driver to Oracle.

Then, just execute the Glorp Test.

Common Problems

May be, All Glorp Test will fail at first execution. It is very possible that Glorp did not create the TABLES into the database. So, you can force to do this. We have a test in GlorpDBX that create all TABLES needed to execute the Glorp Test. Please, execute DBXGlorpQueryDMLTest with Test runner. You do not forget to execute the Test that set the Facility. (Previous subject)

Coming soon:

We have in mind that we would prefer to finish the SqueakDBX development to PostgreSQL, running all Glorp test successfully and then we will started with others backends link oracle, mysql, MS SQL Server, ODBC and Sqlite.

Summarizing:

Through this integration, the squeak and pharo community will hopefully be able to interact with major database engines, such as oracle and mssql, besides those which are open source, like postgresql and mysql. Moreover, by integrating this plugin with GLORP, will allow us to generate a complete and open source solution to relational data base access.