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

Class: IsterSqlDataObject

Source Location: /IsterSqlDataObject.php

Class Overview

IsterObject
   |
   --IsterAttributeSet
      |
      --IsterSqlDataObject

This class represents a persistent data container.


Author(s): Ingo Schramm   

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

Variables

Methods


Inherited Constants

Inherited Variables

Inherited Methods

Class: IsterAttributeSet

IsterAttributeSet::IsterAttributeSet()
Constructor
IsterAttributeSet::addAttribute()
depricated
IsterAttributeSet::addAttributeReference()
depricated
IsterAttributeSet::addAttributesArray()
depricated
IsterAttributeSet::delete()
Delete all attributes.
IsterAttributeSet::deleteAttribute()
Delete an aAttribute.
IsterAttributeSet::getAttribute()
Get the value of an attribute.
IsterAttributeSet::getAttributeNames()
Return an array containing the names of all attributes.
IsterAttributeSet::getAttributeReference()
Get the reference value of an attribute.
IsterAttributeSet::getAttributesArray()
Get all attributes.
IsterAttributeSet::hasAttribute()
Check whether an attribute has been set.
IsterAttributeSet::setAttribute()
Set a new attribute or overwrite an already existing attribute.
IsterAttributeSet::setAttributeReference()
Set an attribute and store only a reference of the attribute.
IsterAttributeSet::setAttributesArray()
Set an array of key value pairs, each pair an attribute.

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 persistent data container.

An IsterSqlDataObject does not create any tables in the database. These must already exist. The attributes of this object have not to be columns of a single table. They may be spread upon any number of tables. It is up to the different SQL functions to select these into a single result set. The column names of the result set become the names of the object's attributes.


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


[ Top ]


Class Variables

protected mixed $id The object's unique identifier.
[ Top ]



Class Methods


constructor IsterSqlDataObject

IsterSqlDataObject IsterSqlDataObject( [string $pk = 'id'])

Constructor

The constructor expects an unique identifier, either a number or a string. Usually this may be the value of the primary key in a database table. The name of the primary key column may be specified with $pk.


Parameters:

string   $pk  

[ Top ]

method delete

boolean delete( )

Delete the object's data from database.

Overrides IsterAttributeSet::delete() (Delete all attributes.)

[ Top ]

method escape

string escape( string $str, [mixed $binary = false])

Escape a string.

Parameters:

string   $str  

[ Top ]

method func

mixed func( string $name, array $args)

Execute a function on the database.

Returns an array of resulting IsterSqlRow objects or false if no row was found.


access:  protected

Parameters:

string   $name  
array   $args  

[ Top ]

method getID

array getID( )

Get the object's unique identifier name and value.

[ Top ]

method getLastMethod

integer getLastMethod( )

Get id of last executed method.

Either ISTER_SQL_SELECT, ISTER_SQL_INSERT, ISTER_SQL_UPDATE or ISTER_SQL_DELETE.


since:  0.4.6
[ Top ]

method getName

string getName( )

Get the name of the object.

since:  0.4.6
[ Top ]

method hasList

boolean hasList( mixed $parbuf)

Test if a requested list has already be created.

Useful if you need to overwrite mklist(). The tes expects $parbuf as mklist() does and a list name in $parbuf[0].


since:  0.4.6
[ Top ]

method insert

integer insert( )

Insert object's attributes into database.

[ Top ]

method makeID

integer makeID( [mixed $object = null])

Generate an initial ID.

This method must be overriden, otherwise 0 will be returned. Usually you will write a method generating an ID by the current session state or request. If you use this object in conjunction with an IsterUIFormConnector this method will be called with the current application object .

Note: use setID() in your own method to set the new ID.


Parameters:

mixed   $object  

[ Top ]

method mklist

mixed mklist( array $parbuf)

Generate a list using a previously defined SQL function.

The first call of this method executes the sql function named by $parbuf[0] and returns a single array filled with data of the resultset, if any. Each following call of this method returns another array until no rows are left on the resultset and null will be returned. False will be returned on error.

If a prefix is given in $parbuf[1], each key of the returned array will have the form '<prefix><column>' otherwise it will be simply the name of the column.

This method may be useful in block templates.


return:  array or null

Parameters:

array   $parbuf  

[ Top ]

method postRun

boolean postRun( integer $m, boolean $ok)

Do something.

This method does actually nothing but may be overwritten. It is


since:  0.4.6

Parameters:

integer   $m   number of calling method
boolean   $ok   whether the previous method succeeded or not

[ Top ]

method preRun

boolean preRun( integer $m)

Do something.

This method does actually nothing but may be overwritten. It is called prior to select, insert, delete, update.


since:  0.4.6

Parameters:

integer   $m   number of calling method

[ Top ]

method select

boolean select( [mixed $run = true])

Select data into the object.

Return false if no id has been set for this object or id equals 0.


[ Top ]

method setAutoEscape

boolean setAutoEscape( integer $int)

Set auto escape behavior.

If set true, each property will be autmatically escaped when written and unescaped when read. The default behavior is not to automatically escape. If you set this to ISTER_SQL_AUTOESC_BINARY, all attributes will be binary escaped.


Parameters:

integer   $int   either ISTER_SQL_AUTOESC or ISTER_SQL_AUTOESC_BINARY

[ Top ]

method setFunctionNames

boolean setFunctionNames( array $array)

Set names of SQL functions.

  1. array( 'insert' => <name>,
  2. 'select' => <name>,
  3. 'update' => <name>,
  4. 'delete' => <name> )


Parameters:

array   $array  

[ Top ]

method setID

boolean setID( mixed $id)

Set the object's unique identifier.

Parameters:

mixed   $id  

[ Top ]

method setName

boolean setName( mixed $name)

Set a unique name of the object.

since:  0.4.6
[ Top ]

method setSqlFunction

boolean setSqlFunction( object IsterSqlFunction &$function)

Set the object's IsterSqlFunction object.

Parameters:

object IsterSqlFunction   &$function  

[ Top ]

method unescape

string unescape( string $str, [mixed $binary = false])

Unescape a string.

Parameters:

string   $str  

[ Top ]

method update

boolean update( )

Update database with object's data.

[ Top ]


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