I created a new version of this wrapper library. This version now runs against the official dynamic link library 3.6.13 from the author of SQLite.
Available from: VASTGoodies
Several new API calls have been wrapped and lots of bugs have been fixed.
New API calls - Encoding
Some API calls have been wrapped to get/set information about the current connection client encoding style.
This method returns a string (e.h. “UTF8″) describing the internal PostgreSQL encoding id “anID”. Its a helper method, which is used by the class PGConn.
This method returns the internal encoding id for the current connection
This method returns a textual representation of the internal encoding id for the current connection
New API calls - Escaping
Some API calls have been wrapped to help creating correct string for sql command.
This method returns a correct escaped string
This method returns a correct escaped byte array
New API calls - Asynchronous command execution
Some API calls have been wrapped execute multiple SQL-commands with ONE server call.
This method sends a SQL command to the server. The SQL command may consist out of several commands
Helper method to manage incoming data from the server
Helper method to check, if the server is still executing some commands
And here an example how to use it …
| aPGResult sqlCommandString resultCounter result abort| sqlCommandString := 'INSERT into weather (city, prcp) values(''Hamburg'',12.6);INSERT into weather (city, prcp) values(''Berlin'',13.2);INSERT into weather (city, prcp) values(''Bremen'',32.1)'. dbConnection sendQuery: sqlCommandString. resultCounter := 0. abort := false. [ abort ] whileFalse:[ dbConnection consumesInput. dbConnection isBusy ifTrue:[ (Delay forMilliseconds: 100) wait ] ifFalse:[ result := dbConnection getResult. result isNil ifTrue:[ abort := true ] ifFalse:[ resultCounter := resultCounter + 1. result clear ] ]. ]. self assert: (resultCounter = 3).
I changed the structure of the MSKPostgreSQL project. I created an additional application (and configuration map) named “MSKPostgreSQLAbtDBMLayer”, where all source code is located to make the wrapper compatible with the VASmalltalk database layer.
I created a new version of this wrapper library. This version now runs against the official dynamic link library from the author of SQLite. I do not build an alternative library from the sources any more and hope, that the different calling conventions do not matter.
The source code is available from:
Adding all this support for the native binary result format is pretty hard. The reason is pretty simple: it is not documented. One has to query the conversion methods for each datatype from a running PostgreSQl database, then lookup the method within the PostgreSQL source code and interpet the code.
Therefore the next version will be published, when most of these datatypes have been done. Up to now int2, int4 and int8 has been done, box, boolean, strings. I now working on numerical and decimal, which is reverse engineering. Then date, time and timestamps are coming and then - at last - most of the other “special” datatypes.