1 |
joko |
1.1 |
<?php |
2 |
|
|
/** |
3 |
|
|
* This file contains the DataSource::Adapter::Free |
4 |
|
|
* adapter class that inherits from nothing. (It's free!) |
5 |
|
|
* |
6 |
|
|
* @author Andreas Motl <andreas.motl@ilo.de> |
7 |
|
|
* @package org.netfrag.glib |
8 |
|
|
* @name DataSource::Adapter::Free |
9 |
|
|
* |
10 |
|
|
*/ |
11 |
|
|
|
12 |
|
|
/** |
13 |
|
|
* Cvs-Log: |
14 |
|
|
* |
15 |
|
|
* $Id: DataSource.php,v 1.1 2003/03/27 01:21:30 jonen Exp $ |
16 |
|
|
* |
17 |
|
|
* $Log: DataSource.php,v $ |
18 |
|
|
* |
19 |
|
|
*/ |
20 |
|
|
|
21 |
|
|
/** |
22 |
|
|
* This file contains the DataSource::Adapter::Free |
23 |
|
|
* adapter class that inherits from nothing. (It's free!) |
24 |
|
|
* |
25 |
|
|
* @author Andreas Motl <andreas.motl@ilo.de> |
26 |
|
|
* @copyright (c) 2003 - All Rights reserved. |
27 |
|
|
* @license GNU LGPL (GNU Lesser General Public License) |
28 |
|
|
* |
29 |
|
|
* @link http://www.netfrag.org/~joko/ |
30 |
|
|
* @link http://www.gnu.org/licenses/lgpl.txt |
31 |
|
|
* |
32 |
|
|
* @package org.netfrag.glib |
33 |
|
|
* @subpackage DataSource |
34 |
|
|
* @name DataSource::Adapter::Free |
35 |
|
|
* |
36 |
|
|
*/ |
37 |
|
|
class DataSource_Adapter_Free { |
38 |
|
|
//class DataSource_Adapter_Simple extends MemoryDataSource { |
39 |
|
|
|
40 |
|
|
/** |
41 |
|
|
* The constructor. |
42 |
|
|
* |
43 |
|
|
* @param DesignPattern::Proxy - a Proxy instance |
44 |
|
|
* |
45 |
|
|
*/ |
46 |
|
|
function DataSource_Adapter_Free(&$proxy) { |
47 |
|
|
|
48 |
|
|
if (!isset($proxy)) { |
49 |
|
|
user_error("Please pass Proxy instance to the Adapter!"); |
50 |
|
|
return; |
51 |
|
|
} |
52 |
|
|
|
53 |
|
|
$this->_proxy = &$proxy; |
54 |
|
|
|
55 |
|
|
// tracing |
56 |
|
|
//$this->trace_payload('DataSource_Adapter_phpHtmlLib_DataListSource', $proxy); |
57 |
|
|
|
58 |
|
|
// transfer data to "memory" |
59 |
|
|
//$this->_memory = &$payload; |
60 |
|
|
|
61 |
|
|
//return 1; |
62 |
|
|
|
63 |
|
|
} |
64 |
|
|
|
65 |
|
|
function fetch($force = 0) { |
66 |
|
|
$this->_result = $this->_proxy->get_result(); |
67 |
|
|
//print "result: " . Dumper($this->_result); |
68 |
|
|
//print "size: " . sizeof($this->_result) . "<br/>"; |
69 |
|
|
if (!sizeof($this->_result) || $force) { |
70 |
|
|
$this->_result = $this->_proxy->query_data(); |
71 |
|
|
} |
72 |
|
|
//print "result: " . Dumper($this->_result); |
73 |
|
|
$this->propagate(); |
74 |
|
|
} |
75 |
|
|
|
76 |
|
|
function propagate() { |
77 |
|
|
//$this->handle_result(); |
78 |
|
|
} |
79 |
|
|
|
80 |
|
|
|
81 |
|
|
|
82 |
|
|
function get_header_tmp() { |
83 |
|
|
$this->fetch(); |
84 |
|
|
$this->read_labels_from_result(); |
85 |
|
|
return $this->get_labels(); |
86 |
|
|
} |
87 |
|
|
|
88 |
|
|
function do_prequery_tmp() { |
89 |
|
|
} |
90 |
|
|
|
91 |
|
|
function do_query() { |
92 |
|
|
$this->fetch(); |
93 |
|
|
} |
94 |
|
|
|
95 |
|
|
function get_result() { |
96 |
|
|
return $this->_result; |
97 |
|
|
} |
98 |
|
|
|
99 |
|
|
} |
100 |
|
|
|
101 |
|
|
?> |