Thanks Sven :) On Tue, Jan 1, 2019 at 11:54 PM Tudor Girba via Pharo-users < pharo-users@lists.pharo.org> wrote:
Very cool. Thanks!
Doru
On Dec 31, 2018, at 12:33 PM, Sven Van Caekenberghe <sven@stfx.eu> wrote:
Hi,
I created a new release of P3, the modern, lean and mean PostgreSQL client for Pharo.
Version 1.1 contains the following changes:
- added support for Postgres Extended Query protocol (P3PreparedStatement) (thx Jan @jvdsandt) - added support for reading array type values (currently INTEGER[] FLOAT[] BOOLEAN[] TEXT[] VARCHAR[]) - added P3-Tests package and moved all tests there - more comments - more unit tests
https://github.com/svenvc/P3/releases/tag/v1.1
Especially Jan's contribution adds a lot of functionality: the ability to work with prepared statements.
Here is an example doing a batch insert of 100 records (which is more efficient).
| client statement |
client := P3Client url: 'psql://sven@localhost'.
client execute: 'DROP TABLE IF EXISTS table1'. client execute: 'CREATE TABLE table1 (id SERIAL PRIMARY KEY, created_at TIMESTAMP DEFAULT NOW(), name TEXT)'.
statement := client prepare: 'INSERT INTO table1 (name) VALUES ($1)'. statement executeBatch: ((1 to: 100) collect: [ :index | Array with: ('Text #', index printString) ]).
client query: 'SELECT * FROM table1'. client execute: 'DROP TABLE table1'.
statement close. client close.
Season's Greetings to you all.
Sven
-- Sven Van Caekenberghe Proudly supporting Pharo http://pharo.org http://association.pharo.org http://consortium.pharo.org
-- www.feenk.com
"To utilize feedback, you first have to acquire it."
-- Guille Polito Research Engineer Centre de Recherche en Informatique, Signal et Automatique de Lille CRIStAL - UMR 9189 French National Center for Scientific Research - *http://www.cnrs.fr <http://www.cnrs.fr>* *Web:* *http://guillep.github.io* <http://guillep.github.io> *Phone: *+33 06 52 70 66 13