XML_Query2XML
[ class tree: XML_Query2XML ] [ index: XML_Query2XML ] [ all elements ]

Class: XML_Query2XML_Driver_Array

Source Location: /XML_Query2XML-1.7.2/XML/Query2XML/Driver/Array.php

Class Overview

XML_Query2XML_Driver
   |
   --XML_Query2XML_Driver_Array

Array-based driver.


Author(s):

Version:

  • Release: @package_version@

Copyright:

  • 2008 Lukas Feiler

Methods


Inherited Variables

Inherited Methods

Class: XML_Query2XML_Driver

XML_Query2XML_Driver::factory()
Factory method.
XML_Query2XML_Driver::getAllRecords()
This method, when implemented executes the query passed as the first argument and returns all records from the result set.
XML_Query2XML_Driver::preprocessQuery()
Pre-processes a query specification and returns a string representation of the query.

Class Details

[line 66]
Array-based driver.

usage:

  1.  $arrayDriver XML_Query2XML_Driver_Array::factory();
  2.  $arrayDriver->addResultSet(
  3.   'RESULT_SET_NAME'// to be used for $sql or $options['sql']
  4.   array(
  5.     array('column' => 'value'...)// record #1
  6.     array('column' => 'value'...)  // record #2
  7.   )
  8.  );
Usage scenario:
  • Transform an array of associative arrays to XML: $query2xml->getFlatXML('RESULT_SET_ARTISTS_FLAT');
  • Transform an array of index arrays to XML: $dom = $query2xml->getXML( 'RESULT_SET_ARTISTS_FLAT', array( 'rootTag' => 'data', 'rowTag' => 'row', 'idColumn' => false, 'elements' => array( 'name' => '0', 'ID' => '1', 'info' => '2' ) ) );
  • Easy integration of other data sources without having to write a separate driver.
  • Easy lookup table for static data. $options['sql']['data'] can be used to specify the matching record.



[ Top ]


Method Detail

addResultSet   [line 82]

void addResultSet( string $name, array $resultSet)

Add a named result set.
  • Access: public

Parameters:

string   $name   —  The name of the result set.
array   $resultSet   —  An indexed array of associative arrays.

[ Top ]

factory   [line 109]

XML_Query2XML_Driver_Array factory( [array $resultSet = null], [string $resultSetName = ''])

Factory method
  • Access: public

Overrides XML_Query2XML_Driver::factory() (Factory method.)

Parameters:

array   $resultSet   —  An index array of associative arrays. This argument is optional.
string   $resultSetName   —  The name of the result set. This argument is optional. The default is an empty string.

[ Top ]

getAllRecords   [line 126]

array getAllRecords( array $query, string $configPath)

Returns all records from a named result set.
  • Return: An index array of associative arrays.
  • Access: public

Overrides XML_Query2XML_Driver::getAllRecords() (This method, when implemented executes the query passed as the first argument and returns all records from the result set.)

Parameters:

array   $query   —  An array with at least one element: 'query'.
string   $configPath   —  The configuration path.

[ Top ]

removeResultSet   [line 94]

void removeResultSet( string $name)

Remove a named result set.
  • Access: public

Parameters:

string   $name   —  The name of the result set to remove

[ Top ]


Documentation generated on Mon, 11 Mar 2019 15:43:30 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.