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

Source for file case03_debug.php

Documentation is available at case03_debug.php

  1. <?php
  2. require_once 'XML/Query2XML.php';
  3. require_once 'MDB2.php';
  4. $query2xml XML_Query2XML::factory(MDB2::factory('mysql://root@localhost/Query2XML_Tests'));
  5.  
  6. require_once 'Log.php';
  7. $debugLogger &Log::factory('file''case03.log''Query2XML');
  8. $query2xml->enableDebugLog($debugLogger);
  9.  
  10. $query2xml->startProfiling();
  11.  
  12.  
  13. $dom $query2xml->getXML(
  14.     "SELECT
  15.         *
  16.      FROM
  17.         artist
  18.      ORDER BY
  19.         artistid",
  20.     array(
  21.         'rootTag' => 'music_library',
  22.         'rowTag' => 'artist',
  23.         'idColumn' => 'artistid',
  24.         'elements' => array(
  25.             'artistid',
  26.             'name',
  27.             'birth_year',
  28.             'birth_place',
  29.             'genre',
  30.             'albums' => array(
  31.                 'sql' => array(
  32.                     'data' => array(
  33.                         'artistid'
  34.                     ),
  35.                     'query' => 'SELECT * FROM album WHERE artist_id = ?'
  36.                 ),
  37.                 'sql_options' => array(
  38.                     'uncached'      => true,
  39.                     'single_record' => false,
  40.                     'merge'         => false,
  41.                     'merge_master'  => false
  42.                 ),
  43.                 'rootTag' => 'albums',
  44.                 'rowTag' => 'album',
  45.                 'idColumn' => 'albumid',
  46.                 'elements' => array(
  47.                     'albumid',
  48.                     'title',
  49.                     'published_year',
  50.                     'comment'
  51.                 )
  52.             )
  53.         )
  54.     )
  55. );
  56.  
  57. header('Content-Type: application/xml');
  58.  
  59. $dom->formatOutput = true;
  60. print $dom->saveXML();
  61.  
  62. require_once 'File.php';
  63. $fp = new File();
  64. $fp->write('case03.profile'$query2xml->getProfile()FILE_MODE_WRITE);
  65. ?>

Documentation generated on Mon, 11 Mar 2019 14:56:24 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.