app 
[ doc home ] [ class tree: app ] [ index: app ] [ all elements ]

Class: IsterAppConfigureReaderSql

Source Location: /IsterAppConfigureReaderSql.php

Class Overview

IsterObject
   |
   --IsterCapability
      |
      --IsterAppConfigureReader
         |
         --IsterAppConfigureReaderSql

This class represents a configuaration reader capable of reading options from database tables.


Author(s): Ingo Schramm   

Copyright: Copyright (c) 2005 Ister.ORG Ingo Schramm

Methods


Inherited Constants

Inherited Variables

Inherited Methods

Class: IsterAppConfigureReader

IsterAppConfigureReader::IsterAppConfigureReader()
Constructor
IsterAppConfigureReader::getAll()
Read the configuration from source and return all options.
IsterAppConfigureReader::getOpt()
Get the value of an option.

Class: IsterCapability

IsterCapability::IsterCapability()
Constructor
IsterCapability::hasCap()
Check reader for a capability.

Class: IsterObject

IsterObject::IsterObject()
Constructor
IsterObject::abstractMethodError()
Report attempt to call an abstract method.
IsterObject::addLogger()
Add an IsterLogger to process log messages.
IsterObject::deleteLogger()
Delete an already registered IsterLogger.
IsterObject::getLoggerNames()
Fetch the names of all currently registered IsterLoggers.
IsterObject::getMem()
Return maximum amount of memory an application has allocated at this point.
IsterObject::log()
Trigger a log message.
IsterObject::passPHPmessage()
Catch PHP E_WARNING and E_NOTICE messages.
IsterObject::serialize()
Serialize the object.
IsterObject::setLogLocal()
Set logging local for the current object.
IsterObject::setupLogger()
Setup a logger.
IsterObject::triggerError()
Alias for log();
IsterObject::unserialize()
Unserialize the object.
IsterObject::__sleep()
Executed prior to serialize().
IsterObject::__wakeup()
Executed prior to unserialize().

Class Details

This class represents a configuaration reader capable of reading options from database tables.

A configuration table looks like this for MySQL

  1. CREATE TABLE config (
  2. id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
  3. cnfset CHAR(32) NOT NULL DEFAULT "default",
  4. sect CHAR(32) NOT NULL DEFAULT "default",
  5. opt CHAR(32) NOT NULL DEFAULT "",
  6. opt_t ENUM("scalar", "array") NOT NULL,
  7. val VARCHAR(255) NOT NULL,
  8. val_t ENUM("string", "integer", "double", "boolean") NOT NULL
  9. );
and for PostgreSQL
  1. CREATE TABLE testconfig (
  2. id SERIAL PRIMARY KEY,
  3. cnfset VARCHAR(32) NOT NULL DEFAULT 'default',
  4. sect VARCHAR(32) NOT NULL DEFAULT 'default',
  5. opt VARCHAR(32) NOT NULL DEFAULT '',
  6. opt_t VARCHAR(8) NOT NULL,
  7. val VARCHAR(255) NOT NULL,
  8. val_t VARCHAR(8) NOT NULL
  9. );
Note: Arrays must be stored one row each value.


copyright:  Copyright (c) 2005 Ister.ORG Ingo Schramm
author:  Ingo Schramm
see:  IsterAppConfigureFactory,


[ Top ]


Class Methods


constructor IsterAppConfigureReaderSql

IsterAppConfigureReaderSql IsterAppConfigureReaderSql( object IsterSqlFunction $function, [object IsterSqlFunction $default = null])

Constructor

The IsterSqlFunction object must have defined a function 'getopt'. Also, the object must have a valid connection set up to execute the function. An optional second function object '$default' can be given to lookup default configuration settings.


Parameters:

object IsterSqlFunction   $function  
object IsterSqlFunction   $default  

[ Top ]

method getOpt

object IsterAppConfigureOption getOpt( string $name, string $section, string $set)

Get the value of an option.

If no value is found in the configuration table and an IsterSqlFunction object to check a table with defaults has been defined, the option will be fetched from the defaults table.


Overrides IsterAppConfigureReader::getOpt() (Get the value of an option.)

Parameters:

string   $name  
string   $section  
string   $set  

[ Top ]


Documentation generated on Tue, 20 Dec 2005 11:20:27 +0100 by phpDocumentor 1.3.0RC4