Subversion-Projekte lars-tiefland.php_share

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
1 lars 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', 'case02.log', 'Query2XML');
8
$query2xml->enableDebugLog($debugLogger);
9
 
10
$query2xml->startProfiling();
11
 
12
 
13
$dom = $query2xml->getXML(
14
    "SELECT
15
        *
16
     FROM
17
        artist
18
        LEFT JOIN album ON album.artist_id = artist.artistid
19
     ORDER BY
20
        artist.artistid,
21
        album.albumid",
22
    array(
23
        'rootTag' => 'music_library',
24
        'rowTag' => 'artist',
25
        'idColumn' => 'artistid',
26
        'elements' => array(
27
            'artistid',
28
            'name',
29
            'birth_year',
30
            'birth_place',
31
            'genre',
32
            'albums' => array(
33
                'rootTag' => 'albums',
34
                'rowTag' => 'album',
35
                'idColumn' => 'albumid',
36
                'elements' => array(
37
                    'albumid',
38
                    'title',
39
                    'published_year',
40
                    'comment'
41
                )
42
            )
43
        )
44
    )
45
);
46
 
47
header('Content-Type: application/xml');
48
 
49
$dom->formatOutput = true;
50
print $dom->saveXML();
51
 
52
require_once 'File.php';
53
$fp = new File();
54
$fp->write('case02.profile', $query2xml->getProfile(), FILE_MODE_WRITE);
55
?>