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('DB.php');
  4. $query2xml XML_Query2XML::factory(DB::connect('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.     array(
  19.         'rootTag' => 'music_library',
  20.         'rowTag' => 'artist',
  21.         'idColumn' => 'artistid',
  22.         'elements' => array(
  23.             'artistid',
  24.             'name',
  25.             'birth_year',
  26.             'birth_place',
  27.             'genre',
  28.             'albums' => array(
  29.                 'sql' => array(
  30.                     'data' => array(
  31.                         'artistid'
  32.                     ),
  33.                     'query' => 'SELECT * FROM album WHERE artist_id = ?'
  34.                 ),
  35.                 'sql_options' => array(
  36.                     'uncached'      => true,
  37.                     'single_record' => false,
  38.                     'merge'         => false,
  39.                     'merge_master'  => false
  40.                 ),
  41.                 'rootTag' => 'albums',
  42.                 'rowTag' => 'album',
  43.                 'idColumn' => 'albumid',
  44.                 'elements' => array(
  45.                     'albumid',
  46.                     'title',
  47.                     'published_year',
  48.                     'comment'
  49.                 )
  50.             )
  51.         )
  52.     )
  53. );
  54.  
  55. header('Content-Type: application/xml');
  56. echo '<?xml version="1.0" encoding="UTF-8"?>' "\n";
  57.  
  58. require_once('XML/Beautifier.php');
  59. $beautifier = new XML_Beautifier();
  60. print $beautifier->formatString($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:39:31 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.