PostgreSQLProtocol.h
ŠP3 Consulting, 2003 All Rights Reserved
This is a Cocoa-wrapper around the libcpg functions for connecting to a PostgreSQL database.
As some of you will notice most of the following API is designed to be
- as far as possible - source code compatible with OpenBase Basic API.
This is due to the simple fact that I also used OpenBase and want to migrate as easely
as possible some of my own code to PostgreSQL.
In order to support uniqueRowIdForTable functionnality of OpenBase, you have to had a
_rowid BIGSERIAL NOT NULL UNIQUE PRIMARY KEY
field to every table you plan to use with uniqueRowIdForTable.
Differences with OpenBase API:
markRow and removeMarkOnRow are not implemented -
LOCKING strategy is not impemented that way in PostgreSQL
please refer to PostgreSQL doc and use executeCommand to
achieve desired functionality
databaseEncodingName is not implemented
notification mechanism is different
we use LISTEN
(and UNLISTEN
to disable a notification)
to register a PgSQLListener object that will be called
by an NSTimer at a user specified interval, if a PostgreSQL
notification is detected at that time, the pgSQLNotify method
(defined in PgSQLListener protocol) of a user specified object
will be called.
large object support has different - but close - API
- Oid are used instead of char[] to hold large object reference
- more functionnality is available including reading and
writing part of large object.
****************** DEMO WARNING ******************
demonstration version limited to:
no more than 50 records are returned from any query
methods affected are
nextRow: returns false when 50th record is reached
afterLastRow: position cursor on 50th record
resultAsDictionary: only the first 50 rows are returned
Be careful: rowsAffected method returns the REAL result count from the query
Methods not implemented:
beginTransaction, endTransaction, rollbackTransaction
****************** END DEMO WARNING ******************
PostgreSQL limitation:
resultTableName is not implemented (returns "NOT_SUPPORTED_BY_POSTGRESQL"
)
I don't have found yet a way to returns the name of the originating table of a query's resulting column
(Last Updated 12/27/2002)
HTML documentation generated by HeaderDoc