PCLT-DB-0.1.1: An addon to PCLT package: enchance PCLT catalog with PostgreSQL powers.




Some instances of ReadableFromDB for reading PCLT catalog and related objects from DB.

DBMS is PostgreSQL v8.4. Not earlier, since PCLT-DB relies on a feature that appeared in PostgresSQL only in v8.4. - the WITH clause for SELECT query (also WITH RECURSIVE).


Instances of ReadableFromDB

newtype CatalogNeedsToBeUpdated_DoesIt Source

Container for a flag, that is read from DB.

For each catalog in DB there is stored a special flag "catalog data or config changed". The flag gets raised by an army of triggers, that watches every table, and is thought to get dropped by a program, which uses DB catalog. Drop the flag right before catalog update from DB.

Unfortunately, the current implementation of this flagging system constraints the number of agents that update their catalogs from DB by only one (because, when agent updates it's catalog, it drops the flag, and other agents don't know that flag was risen, so they can't know if version of catalog in their operative memory is older then in DB or is it not).

But this limitation removal is planned as a first ToDo in the next version of PCLT-DB.

Drop flag "catalog data or config changed" in DB

Consider catalog update

emptyCUE :: CatalogUpdateFromDBErrors -> BoolSource

Checks if catalog is read without a single error.

cfhie2cue :: CatalogFromHSRTInitErrors -> CatalogUpdateFromDBErrorsSource

There is a one way relation from CatalogFromHSRTInitErrors to CatalogUpdateFromDBErrors. That's because subject operations are similar it their abstractions.

considerCatalogUpdate :: Connection -> PCLT_CatalogID -> IO (Maybe PCLT_Catalog, Maybe CatalogUpdateFromDBErrors)Source

Check if the flag "catalog data or config changed" is up in DB. If so, drop it and try to read from DB

  1. PCLT_InnerConfig
  2. RawCatalogDataReadFromDBResult
  3. CatalogReadFromDBResult