void DbToXml(
object An
&$objDBResult, [array
$arrCallBacks = array()], [object a
$objDocRef = null], [object a
$ndStub = null]
)
|
|
Constructor method
Perform requirements checks and initialised resources.
Parameters:
object An |
&$objDBResult: |
instance of a PEAR DB result object or a 2d associative array. |
array |
$arrCallBacks: |
An associative array mapping result column names to methods (call back functions) of the class. |
object a |
$objDocRef: |
reference to an existing DOM document |
object a |
$ndStub: |
DOM node in the referenced document where the results from this calss will be appended. |
Convert the RDBMS data into XML elements.
Run the fetch method on the result object to obtain the result data in a 2D array. Iterate over this 2D array to first obtain the rows and then the fields which are created and appended as elements using DOM XML methods.
void GroupBy(
string
$strColName
)
|
|
Group records in the output tree by element corresponding to column.
This is a very handy way to quickly group output elements by a selected element.
Parameters:
string |
$strColName: |
name of the column used for grouping |
void odbcToReadable(
object a
&$objDOM, node
&$ndField, string
$odbcTs
)
|
|
ODBC timestamp date call-back mutator function
This call-back function is placed here for convenience and can be used to produce create a unix timestamp from an ODBC compliant timestamp. This unix timestap is then sent to $this->unixTsToReadable where nice attributes are added :)
Parameters:
object a |
&$objDOM: |
reference to the current PHP DOM XML object instance |
node |
&$ndField: |
a reference to the element node representing a field |
string |
$odbcTs: |
a copy of the text content that would normally be assigned to this field elemeent. |
API Tags:
Clean up function to flush existing data.
Calling this function is needed if the constructor is to be called more than once.
void RowConstructor(
object a
&$objDoc, node
&$ndRow
)
|
|
Row Contructor
This abstract method may be overwritten by the child class in order to perform an operation just _prior_ to the execution of a row in the execute() method of this class
Parameters:
object a |
&$objDoc: |
reference to the current PHP DOM XML object instance |
node |
&$ndRow: |
a reference to the element node representing a row |
API Tags:
void RowDestructor(
object a
&$objDoc, node
&$ndRow
)
|
|
Row Destructor
This abstract method may be overwritten by the child class in order to perform an operation just _after_ the execution of a row in the execute() method of this class
Parameters:
object a |
&$objDoc: |
reference to the current PHP DOM XML object instance |
node |
&$ndRow: |
a reference to the element node representing a row |
API Tags:
void unixTsToReadable(
object a
&$objDoc, node
&$ndField, string
$intTs
)
|
|
unix timestamp date call-back mutator function
This call-back function is placed here for convenience and can be used to produce an element with a more convenient schema for representing a date from a unix timestamp. It also provides a useful example of the call-back capability of this class. What it does is add a set of attributes to the element in context which each represent a conventional date component.
Parameters:
object a |
&$objDoc: |
reference to the current PHP DOM XML object instance |
node |
&$ndField: |
a reference to the element node representing a field |
string |
$intTs: |
a copy of the text content that would normally be assigned to this field elemeent. |
API Tags: