1 |
joko |
1.1 |
<?php |
2 |
|
|
/** |
3 |
|
|
* This file contains the GenericDataSource child class |
4 |
|
|
* |
5 |
|
|
* @author Andreas Motl <andreas.motl@ilo.de> |
6 |
joko |
1.2 |
* @package org.netfrag.glib |
7 |
|
|
* @name DataSource::Generic |
8 |
joko |
1.1 |
* |
9 |
|
|
*/ |
10 |
|
|
|
11 |
|
|
/** |
12 |
joko |
1.19 |
* Cvs-Log: |
13 |
joko |
1.6 |
* |
14 |
jonen |
1.20 |
* $Id: Generic.php,v 1.19 2003/04/18 15:40:51 joko Exp $ |
15 |
joko |
1.2 |
* |
16 |
|
|
* $Log: Generic.php,v $ |
17 |
jonen |
1.20 |
* Revision 1.19 2003/04/18 15:40:51 joko |
18 |
|
|
* NEW: tree data handling |
19 |
|
|
* introduced new adapter: DataSource::Adapter::Free |
20 |
|
|
* enhanced datasource_handler_buildoptions: now handles a) case 'tree' b) _query[filter] |
21 |
|
|
* |
22 |
joko |
1.19 |
* Revision 1.18 2003/04/11 00:55:49 joko |
23 |
|
|
* updated 'datasource_handler_buildoptions': action dispatcher now aware of 'delete' |
24 |
|
|
* |
25 |
joko |
1.18 |
* Revision 1.17 2003/04/09 02:07:33 joko |
26 |
|
|
* CHANGE: renamed key 'classname' through 'nodename' |
27 |
|
|
* |
28 |
joko |
1.17 |
* Revision 1.16 2003/04/08 17:55:20 joko |
29 |
|
|
* CHANGE: renamed property 'datasource' to 'transport' |
30 |
|
|
* NEW: new case 'method' in 'function datasource_handler_buildoptions' |
31 |
|
|
* minor fixes: updated logging/debugging messages |
32 |
|
|
* |
33 |
joko |
1.16 |
* Revision 1.15 2003/04/06 04:46:33 joko |
34 |
|
|
* renamed linking function |
35 |
|
|
* mozilla fixes |
36 |
|
|
* |
37 |
joko |
1.15 |
* Revision 1.14 2003/04/04 21:19:21 joko |
38 |
|
|
* modified exception handling (enhanced, purged redundant code) |
39 |
|
|
* |
40 |
joko |
1.14 |
* Revision 1.13 2003/04/04 02:37:14 jonen |
41 |
|
|
* _query[action] == write |
42 |
|
|
* |
43 |
jonen |
1.13 |
* Revision 1.12 2003/03/29 08:00:48 joko |
44 |
|
|
* modified ErrorBoxing |
45 |
|
|
* |
46 |
joko |
1.12 |
* Revision 1.11 2003/03/28 06:45:26 joko |
47 |
|
|
* VERBOSE mode |
48 |
|
|
* |
49 |
joko |
1.11 |
* Revision 1.10 2003/03/28 03:01:02 joko |
50 |
|
|
* more fancy debugging-output |
51 |
|
|
* |
52 |
joko |
1.10 |
* Revision 1.9 2003/03/27 16:24:26 jonen |
53 |
|
|
* + mugled namespace |
54 |
|
|
* + added enhanced 'queryData' |
55 |
|
|
* |
56 |
jonen |
1.9 |
* Revision 1.8 2003/03/20 07:22:14 jonen |
57 |
|
|
* + modified case 'object' to 'objects' |
58 |
|
|
* (cause its loads all *objects* of a given classname) |
59 |
|
|
* |
60 |
jonen |
1.8 |
* Revision 1.7 2003/03/11 01:43:00 joko |
61 |
|
|
* + fixed metadata for phpDocumentor |
62 |
|
|
* |
63 |
joko |
1.7 |
* Revision 1.6 2003/03/11 01:22:25 joko |
64 |
|
|
* + fixed metadata for phpDocumentor |
65 |
|
|
* |
66 |
joko |
1.6 |
* Revision 1.5 2003/03/11 00:12:49 joko |
67 |
|
|
* + fixed metadata for phpDocumentor |
68 |
|
|
* |
69 |
joko |
1.5 |
* Revision 1.4 2003/03/10 23:25:03 joko |
70 |
|
|
* + fixed metadata for phpDocumentor |
71 |
|
|
* |
72 |
joko |
1.4 |
* Revision 1.3 2003/03/09 15:50:36 joko |
73 |
|
|
* + additional metadata for Autodia |
74 |
|
|
* |
75 |
joko |
1.3 |
* Revision 1.2 2003/03/05 17:28:43 joko |
76 |
|
|
* updated docu (phpDocumentor testing....) |
77 |
|
|
* |
78 |
joko |
1.2 |
* Revision 1.1 2003/03/05 12:04:00 joko |
79 |
|
|
* + initial commit, from GenericDataSource |
80 |
joko |
1.1 |
* |
81 |
|
|
* Revision 1.3 2003/03/03 21:24:18 joko |
82 |
|
|
* now based on DesignPattern::RemoteProxy |
83 |
|
|
* |
84 |
|
|
* Revision 1.2 2003/03/02 01:05:13 joko |
85 |
|
|
* - purged old code |
86 |
|
|
* |
87 |
|
|
* Revision 1.1 2003/03/01 21:47:15 joko |
88 |
|
|
* renamed from AbstractDataSource.inc |
89 |
|
|
* |
90 |
|
|
* Revision 1.1 2003/03/01 20:17:15 joko |
91 |
|
|
* renamed from GenericDataSource.inc |
92 |
|
|
* replaced '_proxy' through '_handler' to better associate the ability to act as a generic dispatcher handler |
93 |
|
|
* |
94 |
|
|
* Revision 1.3 2003/03/01 15:36:11 joko |
95 |
|
|
* + debugging |
96 |
|
|
* + renamed some methods regarding new proposal (build_handler_options, fetch_result, etc.) |
97 |
|
|
* |
98 |
|
|
* Revision 1.2 2003/03/01 04:50:27 joko |
99 |
|
|
* encapsulated all output into tracing mode |
100 |
|
|
* disabled tracing |
101 |
|
|
* |
102 |
|
|
* Revision 1.1 2003/03/01 03:10:40 joko |
103 |
|
|
* + initial commit |
104 |
|
|
* |
105 |
|
|
*/ |
106 |
|
|
|
107 |
|
|
/** |
108 |
|
|
* This requires the MemoryDataSource base class |
109 |
|
|
* |
110 |
|
|
*/ |
111 |
|
|
|
112 |
|
|
// V1: compile-time-include, stable since years ;-) |
113 |
|
|
//include_once($phphtmllib."/widgets/data_source/MemoryDataSource.inc"); |
114 |
|
|
|
115 |
|
|
// V2: runtime-load proposal, more flexible |
116 |
|
|
// loadModule('MemoryDataSource', 'inc'); // doesn't work (would do if basepath of module is in libpath) |
117 |
|
|
// loadModule($phphtmllib . '::widgets::data_source::MemoryDataSource', 'inc'); // works (by accident) |
118 |
|
|
// loadModule($phphtmllib . "/widgets/data_source/MemoryDataSource", "inc"); // works (should be stable) |
119 |
|
|
// loadModule($phphtmllib . "/widgets/data_source/MemoryDataSource.inc", null); // works (should be stable) |
120 |
|
|
|
121 |
|
|
|
122 |
|
|
|
123 |
|
|
/** |
124 |
|
|
* Have to have PEAR and DB included |
125 |
|
|
* the pear dir must be in the |
126 |
|
|
* include path. |
127 |
|
|
*/ |
128 |
|
|
// require_once("PEAR.php"); // FIXME: what about PEAR::XML::RPC? |
129 |
|
|
// require_once("DB.php"); |
130 |
|
|
|
131 |
joko |
1.2 |
|
132 |
|
|
loadModule('DesignPattern::Proxy'); |
133 |
|
|
loadModule('DesignPattern::TransparentProxy'); |
134 |
|
|
loadModule('DesignPattern::RemoteProxy'); |
135 |
|
|
|
136 |
|
|
//class GenericDataSource extends MemoryDataSource { |
137 |
|
|
//class GenericDataSource extends DesignPattern_Proxy { |
138 |
|
|
//class GenericDataSource extends DesignPattern_RemoteProxy { |
139 |
|
|
//class GenericDataSource extends DesignPattern_TransparentProxy { |
140 |
|
|
|
141 |
|
|
//class GenericDataSource extends MemoryDataSource { |
142 |
|
|
//loadModule("DataSource::Proxy::Memory"); |
143 |
|
|
//class GenericDataSource extends DataSource_Proxy_Memory { |
144 |
|
|
//class DataSource_GenericDataSource extends DataSource_Proxy_Memory { |
145 |
|
|
//class DataSource_GenericDataSource extends DesignPattern_Proxy { |
146 |
|
|
//class DataSource_GenericDataSource extends DataSource_Proxy_Memory { |
147 |
|
|
|
148 |
|
|
// now independent!!! new class-inheritance-tree possible now! |
149 |
|
|
// solved by having an Adapter *and* a Proxy here! |
150 |
|
|
//class GenericDataSource { |
151 |
|
|
|
152 |
|
|
loadModule('DesignPattern::AdapterProxy'); |
153 |
|
|
|
154 |
|
|
|
155 |
|
|
|
156 |
joko |
1.1 |
/** |
157 |
|
|
* This GenericDataSource child class is *completely* independent |
158 |
|
|
* of a specific storage implementation and intended to be a wrapper |
159 |
joko |
1.2 |
* class on the way from phpHtmlLib to Xyz. <br> |
160 |
joko |
1.1 |
* ("Yyz" gets represented by Data::Storage by now.....) |
161 |
|
|
* |
162 |
|
|
* GenericDataSource interacts with an intermediate "proxy" object |
163 |
joko |
1.2 |
* (e.g. Data::Driver::Proxy) when doing queries. <br> |
164 |
|
|
* <pre> |
165 |
joko |
1.1 |
* Don't mix this up with a persistent database handle which gets |
166 |
|
|
* reused each and every time for different queries. |
167 |
|
|
* Here *is* a new instance of Data::Driver::Proxy for *each* query. |
168 |
joko |
1.2 |
* </pre> |
169 |
joko |
1.1 |
* |
170 |
|
|
* But the point is: Caching! The actual *data* isn't read redundant! |
171 |
|
|
* |
172 |
joko |
1.2 |
* <pre> |
173 |
|
|
* --- snipped into here from above --- |
174 |
|
|
* that may use arbitrary code modules as database handlers. |
175 |
|
|
* It's aims are to get together: |
176 |
|
|
* o phpHtmlLibs "source-handlers" |
177 |
|
|
* o PEAR's database handlers |
178 |
|
|
* o custom ones (e.g. Data::Driver::Proxy object, which talks to a remote rpc server) |
179 |
|
|
* --- snipped into here from above --- |
180 |
|
|
* </pre> |
181 |
|
|
* |
182 |
joko |
1.7 |
* <p> |
183 |
joko |
1.1 |
* !!!!!! refactor this to Data::Driver::Proxy !!!!!! <----------------- |
184 |
|
|
* |
185 |
|
|
* Data::Driver::Proxy instantiates "handlers" below itself |
186 |
|
|
* which act as encapsulated workers to actually do the stuff to do. |
187 |
|
|
* It can cache data for "disconnected mode" using the |
188 |
|
|
* php PEAR DB abstraction objects. |
189 |
|
|
* One worker already implemented is Data::Driver::RPC::Remote, which |
190 |
|
|
* talks to a RPC::XML server (todo: talk SOAP!) using PEAR::XML::RPC. |
191 |
|
|
* |
192 |
joko |
1.2 |
* <pre> |
193 |
joko |
1.1 |
* --- refactored here, but: redundant somehow --- |
194 |
|
|
* Data::Driver::Proxy uses a PEAR XML::RPC object to actually |
195 |
|
|
* talk HTTP and serialize data chunks to and from XML, |
196 |
|
|
* but adds some caching to this "process of fetching data from a remote side". |
197 |
|
|
* It "proxies" arbitrary data chunks a) inside a native php4 session, |
198 |
|
|
* b) by talking to a rdbms (single proxy-table) or c) [TODO] using PEAR::Cache. |
199 |
|
|
* --- refactored here, but: redundant somehow --- |
200 |
joko |
1.2 |
* </pre> |
201 |
joko |
1.1 |
* |
202 |
|
|
* !!!!!! refactor this to Data::Driver::Proxy !!!!!! <----------------- |
203 |
joko |
1.7 |
* </p> |
204 |
joko |
1.1 |
* |
205 |
|
|
* |
206 |
joko |
1.7 |
* <p> |
207 |
joko |
1.2 |
* <b>How to use?</b> |
208 |
joko |
1.1 |
* |
209 |
|
|
* Pass an array holding "locator metadata" to the constructor. |
210 |
|
|
* GenericDataSource takes care of the rest. |
211 |
|
|
* |
212 |
joko |
1.7 |
* <pre> |
213 |
joko |
1.1 |
* Pass an array to the constructor: (e.g.) |
214 |
|
|
* |
215 |
|
|
* 1. doing rpc-calls.... |
216 |
joko |
1.2 |
* <code> |
217 |
joko |
1.1 |
* $locator = array( |
218 |
|
|
* type => 'rpc', |
219 |
|
|
* metadata => array( Host => 'localhost', Port => '8765' ), |
220 |
|
|
* ); |
221 |
joko |
1.3 |
* $source = ne w GenericDataSource($locator); |
222 |
joko |
1.1 |
* $this->set_data_source( &$source ); |
223 |
joko |
1.2 |
* </code> |
224 |
joko |
1.1 |
* |
225 |
|
|
* 2. [proposal] common datahandles.... |
226 |
joko |
1.2 |
* <code> |
227 |
joko |
1.1 |
* $locator = array( |
228 |
|
|
* type => 'mysql', |
229 |
|
|
* dsn => 'known dsn markup', |
230 |
|
|
* ); |
231 |
joko |
1.3 |
* $source = ne w GenericDataSource($locator); |
232 |
joko |
1.1 |
* $this->set_data_source( &$source ); |
233 |
joko |
1.2 |
* </code> |
234 |
joko |
1.7 |
* </pre> |
235 |
|
|
* </p> |
236 |
|
|
* |
237 |
joko |
1.1 |
* |
238 |
joko |
1.2 |
* @link http://www.netfrag.org/~joko/ |
239 |
joko |
1.1 |
* @author Andreas Motl <andreas.motl@ilo.de> |
240 |
joko |
1.2 |
* |
241 |
|
|
* @link http://www.netfrag.org/~jonen/ |
242 |
joko |
1.1 |
* @author Sebastian Utz <seut@tunemedia.de> |
243 |
joko |
1.2 |
* |
244 |
joko |
1.1 |
* @copyright (c) 2003 - All Rights reserved. |
245 |
joko |
1.2 |
* |
246 |
|
|
* @link http://www.gnu.org/licenses/lgpl.txt |
247 |
joko |
1.1 |
* @license GNU LGPL (GNU Lesser General Public License) |
248 |
|
|
* |
249 |
|
|
* |
250 |
joko |
1.2 |
* @package org.netfrag.glib |
251 |
|
|
* @subpackage DataSource |
252 |
|
|
* @name DataSource::Generic |
253 |
joko |
1.1 |
* |
254 |
joko |
1.4 |
* @todo this: |
255 |
joko |
1.5 |
* o mungle this to be able to be wrapped around phpHtmlLib's own storage-handles |
256 |
|
|
* o implement another Data::Driver::Proxy container |
257 |
joko |
1.1 |
* |
258 |
joko |
1.5 |
* <pre> |
259 |
joko |
1.4 |
* !!!!!!!! THIS IS THE PROBLEM !!!!!!!! |
260 |
|
|
* !!!!!!!! here is it where we have to break inheritance again !!!!!!!! |
261 |
|
|
* |
262 |
|
|
* THE CONFLICT: Beeing in phpHtmlLib *and* DesignPattern::TransparentProxy |
263 |
|
|
* inheritance trees at the same time, which is *not* possible at |
264 |
|
|
* declare-time. We *do* need some runtime-infrastructure to solve this! |
265 |
|
|
* |
266 |
|
|
* TODO: move build- and check-locator stuff from ObjectList to this place!!! |
267 |
|
|
* |
268 |
|
|
* ABOUT: |
269 |
|
|
* 1. otherwhere: WebApp - scope: |
270 |
|
|
* x handles page vs. block vs. widget; dispatches MVC-View |
271 |
|
|
* 2. here: DataSource - scope: |
272 |
|
|
* x handles bridge to frameworks (e.g. phpHtmlLib) vs. actual data driver libs (PEAR, etc.)) |
273 |
|
|
* o clean implementation using a DesignPattern::AdapterProxy |
274 |
joko |
1.5 |
* </pre> |
275 |
joko |
1.4 |
* |
276 |
|
|
* |
277 |
|
|
*/ |
278 |
joko |
1.1 |
class DataSource_Generic extends DesignPattern_AdapterProxy { |
279 |
|
|
|
280 |
|
|
// !!!!!!!! here is it where we have to break inheritance again !!!!!!!! |
281 |
|
|
// !!!!!!!! THIS IS THE PROBLEM !!!!!!!! |
282 |
|
|
|
283 |
|
|
|
284 |
|
|
|
285 |
|
|
/** |
286 |
|
|
* This var holds the locator metadata hash |
287 |
|
|
* that is used to feed metadata to a per-query-instance |
288 |
|
|
* of an Adapter object. |
289 |
|
|
* |
290 |
|
|
*/ |
291 |
|
|
//var $_locator = NULL; |
292 |
|
|
|
293 |
|
|
/** |
294 |
|
|
* This var holds the locator metadata hash |
295 |
|
|
* which is built from some predefined rules |
296 |
|
|
* using metadata from $_options and some |
297 |
|
|
* other presets. |
298 |
|
|
* |
299 |
|
|
* See '_buildLocator' which acts as a dispatcher |
300 |
joko |
1.16 |
* depending on $_options[transport]. |
301 |
joko |
1.1 |
* (main dispatching level) |
302 |
|
|
* |
303 |
|
|
* The structure of a full blown locator looks like this: |
304 |
|
|
* |
305 |
|
|
* $locator = array( |
306 |
|
|
* type => '<your type specifying the datasource-type>', |
307 |
|
|
* metadata => array( |
308 |
|
|
* ... your arbitrary deep metadata structure ... |
309 |
|
|
* ), |
310 |
|
|
* [dsn => '<your dsn markup>'], |
311 |
|
|
* ); |
312 |
|
|
* |
313 |
|
|
* Example 1 - data is inside a rdbms, using a dsn to connect to it: |
314 |
|
|
* $locator = array( |
315 |
|
|
* type => 'sql', |
316 |
|
|
* dsn => 'mysql://username:password@localhost/database', |
317 |
|
|
* ); |
318 |
|
|
* |
319 |
|
|
* Example 2 - data is inside an odbms, reachable by doing remote procedure calls (rpc): |
320 |
|
|
* $locator = array( |
321 |
|
|
* type => 'rpc', |
322 |
|
|
* metadata => array( |
323 |
|
|
* package => 'Data::Driver::Proxy', |
324 |
|
|
* Host => 'localhost', |
325 |
|
|
* Port => '8765', |
326 |
|
|
* ) |
327 |
|
|
* ); |
328 |
|
|
* |
329 |
|
|
*/ |
330 |
|
|
var $_locator = NULL; |
331 |
|
|
|
332 |
|
|
|
333 |
|
|
/** |
334 |
|
|
* This var holds the module information required to |
335 |
|
|
* create instances of a Proxy and an Adapter. |
336 |
|
|
* Information might get extracted from a |
337 |
|
|
* DataSource::Locator instance. |
338 |
|
|
* |
339 |
|
|
* --- A skeleton: |
340 |
|
|
* |
341 |
|
|
* $this->_modules = array( |
342 |
|
|
* _proxy => array( _id => '', _module => '', _options = array(), _instance => &$obj), |
343 |
|
|
* _adapter => array( _id => '', _module => '', _options = array(), _instance => &$obj), |
344 |
|
|
* ); |
345 |
|
|
* |
346 |
|
|
* |
347 |
|
|
* --- An example: |
348 |
|
|
* |
349 |
|
|
* $this->_modules = array( |
350 |
|
|
* _proxy => array( _id => 'rpc', _module => 'DesignPattern::RemoteProxy', _instance => &$obj), |
351 |
|
|
* _adapter => array( _id => 'phpHtmlLib', _module => 'DataSource::Adapter::phpHtmlLib::DataListSource', _instance => &$obj), |
352 |
|
|
* ); |
353 |
|
|
* |
354 |
|
|
* |
355 |
|
|
*/ |
356 |
|
|
//var $_modules = NULL; |
357 |
|
|
|
358 |
|
|
|
359 |
|
|
/** |
360 |
|
|
* This var holds the query hash |
361 |
|
|
* that is used to feed as query to a per-query-instance |
362 |
|
|
* of a Data::Driver::Proxy object. |
363 |
|
|
* |
364 |
|
|
*/ |
365 |
|
|
var $_query = NULL; |
366 |
|
|
|
367 |
|
|
|
368 |
|
|
/** |
369 |
|
|
* this holds the query result from the |
370 |
|
|
* Data::Driver::Proxy->queryXyz() call |
371 |
|
|
* |
372 |
|
|
*/ |
373 |
|
|
var $_result = NULL; |
374 |
|
|
|
375 |
|
|
|
376 |
|
|
|
377 |
|
|
/** |
378 |
|
|
* The constructor is used to pass in the |
379 |
|
|
* locator metadata hash. |
380 |
|
|
* |
381 |
|
|
* @param LocatorMetadataHash array - layout: array( type => '', metadata => '', dsn => '' ) |
382 |
|
|
* @param Query array - layout: array( type => '', metadata => '', dsn => '' ) |
383 |
|
|
*/ |
384 |
|
|
|
385 |
|
|
|
386 |
|
|
function DataSource_Generic( &$locator, $query ) { |
387 |
|
|
|
388 |
|
|
// copy parameter from query to locator |
389 |
joko |
1.16 |
//$this->_locator->merge_to($this->_locator, array( datasource_type => $query[transport] ), '_'); |
390 |
|
|
//$this->_locator->_datasource_type = $query[transport]; |
391 |
|
|
//$locator[_datasource_type] = $query[transport]; |
392 |
joko |
1.1 |
|
393 |
joko |
1.3 |
/** |
394 |
|
|
* <!-- Autodia --> |
395 |
|
|
* can do: (this is metadata supplied for Autodia, don't delete!) |
396 |
|
|
* $this->_locator = new DataSource_Locator() |
397 |
|
|
* |
398 |
|
|
*/ |
399 |
|
|
|
400 |
joko |
1.1 |
// build master locator |
401 |
joko |
1.16 |
$this->_locator = php::mkComponent('DataSource::Locator', $locator, array( datasource_type => $query[transport] ) ); |
402 |
joko |
1.1 |
//exit; |
403 |
|
|
//$this->_locator = php::mkComponent('DataSource::Locator'); |
404 |
|
|
|
405 |
|
|
$this->_locator->check(); |
406 |
|
|
|
407 |
|
|
// trace |
408 |
|
|
//print "locator-obj: " . Dumper($this->_locator); |
409 |
|
|
//print "locator-data: " . Dumper($locator_data); |
410 |
|
|
//exit; |
411 |
|
|
|
412 |
|
|
|
413 |
|
|
|
414 |
|
|
/* |
415 |
|
|
$this->_modules = array( |
416 |
|
|
_proxy => array( _id => $locator->_datasource_type ), |
417 |
|
|
_adapter => array( _id => $locator->_adapter_type ), |
418 |
|
|
); |
419 |
|
|
*/ |
420 |
|
|
|
421 |
|
|
//$this->set_locator( $locator ); |
422 |
|
|
$this->set_query( $query ); |
423 |
|
|
|
424 |
|
|
|
425 |
|
|
|
426 |
|
|
/* |
427 |
|
|
// V1: |
428 |
|
|
// pre-flight: establish and check locator metadata |
429 |
|
|
$this->_buildLocator(); |
430 |
|
|
$this->_checkLocator(); |
431 |
|
|
*/ |
432 |
|
|
|
433 |
|
|
|
434 |
|
|
|
435 |
|
|
// pre-flight: check locator metadata |
436 |
|
|
//$locator->build(); |
437 |
|
|
if (!$this->_locator->check()) { |
438 |
joko |
1.16 |
user_error("DataSource::Generic: locator-check failed." . "<br/>" . "Locator was: " . Dumper($this->_locator) ); |
439 |
|
|
//exit; |
440 |
|
|
return; |
441 |
joko |
1.1 |
} |
442 |
|
|
|
443 |
|
|
//exit; |
444 |
|
|
|
445 |
|
|
|
446 |
joko |
1.3 |
/** |
447 |
|
|
* <!-- Autodia --> |
448 |
|
|
* can do: (this is metadata supplied for Autodia, don't delete!) |
449 |
|
|
* $proxy = new DesignPattern_RemoteProxy() |
450 |
|
|
* |
451 |
|
|
*/ |
452 |
|
|
|
453 |
|
|
|
454 |
joko |
1.1 |
// --- Proxy selector/dispatcher ... |
455 |
|
|
|
456 |
|
|
switch ($this->_locator->_datasource_type) { |
457 |
|
|
case 'rpc': |
458 |
|
|
//$locator_data = $this->_locator->get_metadata(); |
459 |
|
|
//$this->_modules[_proxy][_options] = array( locator => $this->_locator, query => $query ); |
460 |
|
|
//$this->_modules[_proxy][_module] = 'DataSource::Proxy::XMLRPC'; |
461 |
|
|
|
462 |
|
|
//$this->_modules[_proxy][_module] = 'DesignPattern::RemoteProxy'; |
463 |
|
|
//$this->_modules[_proxy][_options] = $locator_data; |
464 |
|
|
|
465 |
|
|
//$this->set_component_name('DesignPattern::RemoteProxy'); |
466 |
|
|
//$this->set_component_options($locator_data); |
467 |
|
|
|
468 |
|
|
$this->set_component_name('DesignPattern::RemoteProxy'); |
469 |
|
|
|
470 |
|
|
break; |
471 |
|
|
default: |
472 |
|
|
user_error("Site::GenericPage: no Proxy could be selected!"); |
473 |
|
|
break; |
474 |
|
|
} |
475 |
|
|
|
476 |
|
|
|
477 |
|
|
|
478 |
|
|
/* |
479 |
|
|
// V1: |
480 |
|
|
// make up dummy args by now |
481 |
|
|
$args = array( |
482 |
|
|
adapter => 'phpHtmlLib', |
483 |
|
|
); |
484 |
|
|
*/ |
485 |
|
|
|
486 |
|
|
// V2: now propagated from caller! |
487 |
|
|
|
488 |
|
|
//print Dumper(array( locator => $locator, query => $query )); |
489 |
|
|
//exit; |
490 |
|
|
|
491 |
|
|
//$this->create_adapter($this->module, $this->function, $this->arguments); |
492 |
|
|
//$this->set_handler( $this->get_adapter() ); |
493 |
|
|
|
494 |
|
|
|
495 |
|
|
// --- Adapter selector/dispatcher ... |
496 |
|
|
// ... resolves this._modules.adapter._id to this._modules.adapter._module |
497 |
|
|
|
498 |
|
|
switch ($locator->_adapter_type) { |
499 |
joko |
1.19 |
|
500 |
joko |
1.1 |
case 'phpHtmlLib': |
501 |
|
|
//$adapter_arguments = $args[title]; |
502 |
jonen |
1.9 |
$this->set_adapter_module('DataSource::Adapter::phpHtmlLib::DataSource'); |
503 |
joko |
1.1 |
|
504 |
|
|
// in order to let the Adapter communicate with the Proxy, |
505 |
|
|
// instantiate a wrapper method in a third namespace via |
506 |
|
|
// Exporter::export_symbol(from, to) |
507 |
|
|
$this->set_adapter_options($this); |
508 |
joko |
1.19 |
break; |
509 |
joko |
1.1 |
|
510 |
joko |
1.19 |
// NEW [2003-04-17]: Freedom for the adapter! |
511 |
|
|
// phpHtmlLib didn't have a tree widget, but PEAR does. |
512 |
|
|
// So: Free us from the phpHtmlLib-adapter in this case. |
513 |
|
|
case 'free': |
514 |
|
|
$this->set_adapter_module('DataSource::Adapter::Free'); |
515 |
|
|
$this->set_adapter_options($this); |
516 |
|
|
break; |
517 |
joko |
1.1 |
|
518 |
|
|
default: |
519 |
joko |
1.19 |
user_error("DataSource::Generic: no Adapter could be selected: \$locator->_adapter_type='$locator->_adapter_type'"); |
520 |
joko |
1.1 |
break; |
521 |
|
|
} |
522 |
|
|
|
523 |
|
|
|
524 |
|
|
|
525 |
|
|
// --- module instantiation - Proxy and Adapter |
526 |
|
|
|
527 |
|
|
//user_error("handle proxy here!"); |
528 |
|
|
//$this->create_proxy(); |
529 |
|
|
|
530 |
|
|
//print Dumper($this); |
531 |
|
|
|
532 |
|
|
//print "this: " . Dumper($this); |
533 |
|
|
|
534 |
|
|
// V1: |
535 |
|
|
/* |
536 |
|
|
$proxy = php::mkComponent($this->_modules[_proxy][_module], $this->_modules[_proxy][_options]); |
537 |
|
|
print "proxy: " . Dumper($proxy); |
538 |
|
|
//exit; |
539 |
|
|
*/ |
540 |
|
|
|
541 |
|
|
// V2: |
542 |
|
|
/* |
543 |
|
|
$resultHandle = mkObject('DesignPattern::RemoteProxy', $cache_key, array( key => 1, command => $command, query => $query, remote => 1, rpcinfo => $rpcinfo, cache => array( db => 0, session => 1 ) ) ); |
544 |
|
|
$result = $resultHandle->getAttributes(); |
545 |
|
|
return $result; |
546 |
|
|
*/ |
547 |
|
|
|
548 |
|
|
// V3: |
549 |
|
|
// $this->set_handler( $proxy ); |
550 |
|
|
|
551 |
|
|
// V4: use _component_name & _component_options (proposal from GenericPage) |
552 |
|
|
// $this->_component_name = ... |
553 |
|
|
// $this->create_handler(); |
554 |
|
|
|
555 |
joko |
1.3 |
|
556 |
|
|
/** |
557 |
|
|
* <!-- Autodia --> |
558 |
|
|
* can do: (this is metadata supplied for Autodia, don't delete!) |
559 |
|
|
* $adapter = new DataSource_Adapter_phpHtmlLib_DataListSource() |
560 |
|
|
* |
561 |
|
|
*/ |
562 |
joko |
1.1 |
|
563 |
|
|
// V1: |
564 |
|
|
//$this->create_adapter($adapter_module, $this->function, $this->arguments); |
565 |
|
|
|
566 |
|
|
// V2: FIXME - better use V1? |
567 |
|
|
$adapter = php::mkComponent($this->get_adapter_module(), $this->get_adapter_options()); |
568 |
|
|
$this->set_adapter($adapter); |
569 |
|
|
|
570 |
|
|
|
571 |
|
|
|
572 |
|
|
|
573 |
|
|
} |
574 |
|
|
|
575 |
|
|
function make_adapter_transparent() { |
576 |
|
|
|
577 |
|
|
// ... known from Site::Adapter::php::Class: |
578 |
|
|
|
579 |
|
|
// At this place the Adapter becomes a Proxy. |
580 |
|
|
// This functionality currently correlates to the |
581 |
|
|
// name of our ancestor, DesignPattern::AdapterProxy. |
582 |
|
|
// FIXME: move this code to its namespace!!! |
583 |
|
|
// FIXME: rename to set_proxy... |
584 |
|
|
|
585 |
|
|
// The reason this has to occour here is required |
586 |
|
|
// by the TransparentProxy to actually make the |
587 |
|
|
// _handler (_proxy) transparent later.... |
588 |
|
|
//$this->set_proxy( $this->get_adapter() ); |
589 |
|
|
} |
590 |
|
|
|
591 |
|
|
/** |
592 |
|
|
* Set the metadata information |
593 |
|
|
* (a DataSource::Locator) we will use |
594 |
|
|
* to build encapsulated instances |
595 |
|
|
* of both a Proxy and an Adapter. |
596 |
|
|
* |
597 |
|
|
* @param LocatorMetadataHash array - |
598 |
|
|
* |
599 |
|
|
*/ |
600 |
|
|
function set_metadata( &$locator ) { |
601 |
|
|
$this->_locator = &$locator; |
602 |
|
|
} |
603 |
|
|
|
604 |
|
|
function &get_metadata() { |
605 |
|
|
return $this->_locator; |
606 |
|
|
} |
607 |
|
|
|
608 |
|
|
|
609 |
|
|
/** |
610 |
|
|
* Set the query metadata hash we will feed *completely* |
611 |
|
|
* to an encapsulated Proxy instance. |
612 |
|
|
* |
613 |
|
|
* @param QueryDeclaration array - |
614 |
|
|
* |
615 |
|
|
*/ |
616 |
|
|
function set_query( $query ) { |
617 |
|
|
$this->_query = $query; |
618 |
|
|
} |
619 |
|
|
|
620 |
|
|
/** |
621 |
|
|
* Issue remote/proxy call |
622 |
|
|
* Stolen from Application_AbstractBackend::_remote_method (RefactoringProposal?) |
623 |
|
|
* Tweaked a bit: proxy package now taken from $this->_handler_name |
624 |
|
|
* |
625 |
|
|
* Create a new instance of a proxy and store it for later reuse. |
626 |
|
|
* Read the locator metadata hash and create |
627 |
|
|
* the proxy handler instance using passed-in name. |
628 |
|
|
* |
629 |
|
|
* @param string - $proxy_name (namespaced classname - perl syntax - e.g.: Data::Driver::Proxy) |
630 |
|
|
* |
631 |
|
|
*/ |
632 |
|
|
function datasource_handler_call() { |
633 |
|
|
|
634 |
|
|
|
635 |
|
|
// 1. read args and build cache key |
636 |
|
|
|
637 |
|
|
$arg_list = func_get_args(); |
638 |
|
|
$command = array_shift($arg_list); |
639 |
|
|
$cache_key = join("-", array(session_id(), $command, join('_', $arg_list) )); |
640 |
|
|
//print "cache_key: $cache_key<br>"; |
641 |
|
|
|
642 |
|
|
// FIXME: what if arg_list still contains more elements after doing this? |
643 |
|
|
$query = array_shift($arg_list); |
644 |
|
|
|
645 |
|
|
// 2. prepare proxy-options (read from locator) |
646 |
|
|
|
647 |
|
|
//print "this: " . Dumper($this); |
648 |
|
|
//exit; |
649 |
|
|
|
650 |
|
|
// read from locator metadata |
651 |
|
|
//$proxy_name = $this->_locator[metadata][package]; |
652 |
|
|
|
653 |
|
|
// V1: |
654 |
|
|
//$rpcinfo = array( Host => $this->_locator[metadata][Host], Port => $this->_locator[metadata][Port] ); |
655 |
|
|
|
656 |
|
|
// V2: |
657 |
|
|
$rpcinfo = $this->_locator->get_metadata(); |
658 |
|
|
|
659 |
|
|
// FIXME! implement this into Data::Driver::RPC::Remote! |
660 |
|
|
//$rpcinfo[to_latin] = 1; |
661 |
|
|
|
662 |
|
|
// FIXME! patch query |
663 |
|
|
if (sizeof($query) == 1) { |
664 |
|
|
$query = $query[0]; |
665 |
|
|
} |
666 |
|
|
|
667 |
|
|
//print "query: " . Dumper($query); |
668 |
|
|
|
669 |
|
|
// !!! use DesignPattern::Proxy here !!! |
670 |
|
|
// $proxy = new DesignPattern_Proxy($proxy_name, ...) |
671 |
|
|
// or: |
672 |
|
|
// $proxy = mkObject('DesignPattern::Proxy'); |
673 |
|
|
// $this->set_handler( $proxy ); |
674 |
|
|
// or: |
675 |
|
|
// $proxy = mkObject('DesignPattern::Proxy'); |
676 |
|
|
// $proxy-> |
677 |
|
|
// $this->set_handler( $proxy ); |
678 |
|
|
|
679 |
|
|
|
680 |
|
|
|
681 |
|
|
//$this->set_component_name( $proxy_name ); |
682 |
|
|
$this->set_component_options( $cache_key, array( key => 1, command => $command, query => $query, remote => 1, rpcinfo => $rpcinfo, cache => array( db => 0, session => 1 ) ) ); |
683 |
|
|
//print Dumper($this); |
684 |
|
|
//exit; |
685 |
|
|
|
686 |
|
|
$this->create_proxy(); |
687 |
|
|
|
688 |
|
|
//print Dumper($this); |
689 |
|
|
//exit; |
690 |
|
|
|
691 |
|
|
/* |
692 |
|
|
// -------------------- clone this & modify ---------- |
693 |
|
|
$proxy = mkObject($proxy_name, $cache_key, array( key => 1, command => $command, query => $query, remote => 1, rpcinfo => $rpcinfo, cache => array( db => 0, session => 1 ) ) ); |
694 |
|
|
$this->set_handler( $proxy ); |
695 |
|
|
//$result = $resultHandle->getAttributes(); |
696 |
|
|
//return $result; |
697 |
|
|
//$this->_result = $resultHandle->getAttributes(); |
698 |
|
|
//$this->_result = $this->_handler->getAttributes(); |
699 |
|
|
// -------------------- clone this & modify ---------- |
700 |
|
|
*/ |
701 |
|
|
|
702 |
|
|
} |
703 |
|
|
|
704 |
|
|
|
705 |
|
|
function datasource_handler_buildoptions() { |
706 |
|
|
|
707 |
|
|
//print Dumper($this->_query); |
708 |
|
|
//exit; |
709 |
|
|
|
710 |
|
|
// make up a command from metadata |
711 |
|
|
// FIXME: abstract this some more (e.g. via a CommandMapper|Registry) |
712 |
|
|
switch ($this->_query[metatype]) { |
713 |
|
|
case 'data': |
714 |
jonen |
1.9 |
$command = 'queryData'; |
715 |
jonen |
1.13 |
|
716 |
jonen |
1.9 |
//$command = 'getObjects'; // FIXME!!! |
717 |
joko |
1.1 |
//$this->_locator->set_option('metadata.command', $command); |
718 |
jonen |
1.9 |
/* |
719 |
joko |
1.1 |
$args = array(); |
720 |
|
|
switch ($this->_query[vartype]) { |
721 |
jonen |
1.8 |
case 'objects': |
722 |
joko |
1.1 |
if (!$this->_query[classname]) { |
723 |
jonen |
1.8 |
$msg = "_query[vartype] == 'objects' requires _query[classname]"; |
724 |
joko |
1.16 |
user_error("DataSource::Generic: query_data() - failed: " . $msg); |
725 |
joko |
1.1 |
} |
726 |
|
|
array_push($args, $this->_query[classname]); |
727 |
|
|
break; |
728 |
|
|
} |
729 |
jonen |
1.9 |
*/ |
730 |
|
|
$query_args = array(); |
731 |
joko |
1.19 |
|
732 |
|
|
$msg_prefix = "DataSource::Generic::datasource_handler_buildoptions failed: "; |
733 |
jonen |
1.9 |
switch ($this->_query[abstract_type]) { |
734 |
joko |
1.19 |
case 'item': |
735 |
|
|
if (!$this->_query[nodename]) { |
736 |
|
|
$msg = "_query[vartype] == 'objects' requires _query[nodename]"; |
737 |
|
|
user_error($msg_prefix . $msg); |
738 |
|
|
} |
739 |
|
|
$query_args[guid] = $this->_query[ident]; |
740 |
|
|
$query_args[nodename] = $this->_query[nodename]; |
741 |
|
|
break; |
742 |
jonen |
1.9 |
case 'list': |
743 |
joko |
1.17 |
if (!$this->_query[nodename]) { |
744 |
|
|
$msg = "_query[vartype] == 'objects' requires _query[nodename]"; |
745 |
joko |
1.19 |
user_error($msg_prefix . $msg); |
746 |
jonen |
1.9 |
} |
747 |
joko |
1.17 |
//array_push($query_args, $this->_query[nodename]); |
748 |
|
|
$query_args[nodename] = $this->_query[nodename]; |
749 |
jonen |
1.20 |
if($this->_query[list_meta]) { $query_args[list_meta] = $this->_query[list_meta]; } |
750 |
jonen |
1.9 |
break; |
751 |
joko |
1.19 |
case 'tree': |
752 |
|
|
/* |
753 |
joko |
1.17 |
if (!$this->_query[nodename]) { |
754 |
|
|
$msg = "_query[vartype] == 'objects' requires _query[nodename]"; |
755 |
joko |
1.19 |
user_error($msg_prefix . $msg); |
756 |
jonen |
1.9 |
} |
757 |
joko |
1.19 |
*/ |
758 |
jonen |
1.9 |
$query_args[guid] = $this->_query[ident]; |
759 |
joko |
1.19 |
//$query_args[nodename] = $this->_query[nodename]; |
760 |
|
|
break; |
761 |
|
|
default: |
762 |
|
|
$msg = "\$this->_query[abstract_type] could not be dispatched as 'item', 'list' or 'tree'."; |
763 |
|
|
user_error($msg_prefix . $msg); |
764 |
|
|
break; |
765 |
|
|
} |
766 |
|
|
|
767 |
|
|
// filter??? |
768 |
|
|
if ($this->_query[filter]) { |
769 |
|
|
$query_args[filter] = $this->_query[filter]; |
770 |
jonen |
1.13 |
} |
771 |
joko |
1.18 |
|
772 |
|
|
// dispatch action |
773 |
|
|
if ($this->_query[action] == 'write') { |
774 |
jonen |
1.13 |
$query_args[action] = $this->_query[action]; |
775 |
|
|
$query_args[data] = $this->_query[data]; |
776 |
joko |
1.18 |
} elseif ($this->_query[action] == 'delete') { |
777 |
|
|
$query_args[action] = $this->_query[action]; |
778 |
jonen |
1.9 |
} |
779 |
joko |
1.19 |
|
780 |
jonen |
1.9 |
$args = array( |
781 |
|
|
'data_type' => $this->_query[abstract_type], |
782 |
|
|
'query_args' => $query_args |
783 |
|
|
); |
784 |
|
|
break; |
785 |
|
|
|
786 |
|
|
// querySchema |
787 |
joko |
1.1 |
case 'schema': |
788 |
jonen |
1.9 |
//print "Testing schema:" . "<br>"; |
789 |
joko |
1.1 |
$command = 'querySchema'; |
790 |
joko |
1.14 |
$args = array( $this->_query[filter] ); |
791 |
joko |
1.1 |
break; |
792 |
joko |
1.16 |
|
793 |
|
|
// remoteMethod |
794 |
|
|
case 'method': |
795 |
|
|
$command = $this->_query[method]; |
796 |
|
|
$args = $this->_query[args]; |
797 |
|
|
break; |
798 |
|
|
|
799 |
joko |
1.1 |
} |
800 |
|
|
|
801 |
joko |
1.16 |
|
802 |
|
|
// FIXME: bad behaviour? |
803 |
|
|
if (!is_array($args)) { $args = array( $args ); } |
804 |
joko |
1.1 |
|
805 |
|
|
/* |
806 |
|
|
$this->_query[rpc_command] = $command; |
807 |
|
|
$this->_query[rpc_args] = $command; |
808 |
|
|
*/ |
809 |
|
|
|
810 |
|
|
// methods!!! |
811 |
|
|
$this->_locator->_call[_method] = $command; |
812 |
|
|
$this->_locator->_call[_arguments] = $args; |
813 |
|
|
|
814 |
|
|
//$adapter = $this->get_adapter(); |
815 |
|
|
|
816 |
|
|
// trace |
817 |
|
|
/* |
818 |
|
|
print Dumper(null, '<b>= = = = = = = = = = = = = = = = = = = = = =</b>'); |
819 |
|
|
print Dumper('datasource_handler_buildoptions', array( |
820 |
|
|
"_locator" => $this->_locator, |
821 |
|
|
"_query" => $this->_query, |
822 |
|
|
"command" => '<b>' . $command . "</b>", |
823 |
|
|
"args" => $args |
824 |
|
|
)); |
825 |
|
|
*/ |
826 |
|
|
|
827 |
|
|
/* |
828 |
|
|
$this->_handler_options = array( |
829 |
|
|
method => $command, |
830 |
|
|
args => $args, |
831 |
|
|
); |
832 |
|
|
*/ |
833 |
|
|
|
834 |
|
|
} |
835 |
|
|
|
836 |
joko |
1.11 |
|
837 |
|
|
|
838 |
joko |
1.1 |
function &fetch_result() { |
839 |
joko |
1.19 |
|
840 |
|
|
//print Dumper($this); |
841 |
joko |
1.1 |
|
842 |
|
|
$this->datasource_handler_buildoptions(); |
843 |
|
|
|
844 |
joko |
1.11 |
$call = $this->_locator->get_call(); |
845 |
joko |
1.19 |
|
846 |
joko |
1.11 |
//print Dumper($call); |
847 |
joko |
1.19 |
//return; |
848 |
joko |
1.11 |
|
849 |
joko |
1.1 |
// pre-flight checks |
850 |
joko |
1.11 |
if (!$call[method]) { |
851 |
|
|
$msg = "Remote method is empty, please pass in proper metadata or check configuration."; |
852 |
joko |
1.16 |
user_error("DataSource::Generic: query_data() - failed: " . $msg); |
853 |
joko |
1.1 |
return; |
854 |
|
|
} |
855 |
|
|
|
856 |
|
|
//print "fetch_result: this->_handler=" . Dumper($this->_handler); |
857 |
|
|
|
858 |
|
|
// do remote call here and get result |
859 |
|
|
// FIXME: handle synchronous/asynchronous mode here!!! |
860 |
joko |
1.11 |
$this->datasource_handler_call($call[method], $call[args]); |
861 |
joko |
1.1 |
|
862 |
|
|
|
863 |
|
|
// TODO: ... = $this->poll_handler_result and $this->get_handler_result |
864 |
|
|
$proxy = $this->get_proxy(); |
865 |
|
|
$this->_result = $proxy->getResult(); |
866 |
|
|
//print "result: " . Dumper($this->_result); exit; |
867 |
|
|
|
868 |
|
|
$this->_result_count = sizeof($this->_result); |
869 |
|
|
|
870 |
|
|
// trace |
871 |
joko |
1.11 |
//if (constants::get('VERBOSE') && $this->_debug[notice]) { |
872 |
joko |
1.12 |
if (constants::get('VERBOSE') or constants::get('ERRORS_ONLY')) { |
873 |
joko |
1.1 |
//print "_result = " . Dumper($this->_result); |
874 |
joko |
1.11 |
//print "<div><b><font color=\"darkgreen\">Debug:</font></b> DataSource::Generic->_result_count = <b>" . $this->_result_count . "</b></div>"; |
875 |
|
|
$this->draw_status_box(); |
876 |
joko |
1.1 |
} |
877 |
joko |
1.11 |
|
878 |
joko |
1.1 |
return $this->_result; |
879 |
|
|
|
880 |
|
|
} |
881 |
|
|
|
882 |
joko |
1.11 |
function draw_status_box() { |
883 |
|
|
|
884 |
|
|
static $boxcount; |
885 |
|
|
|
886 |
|
|
$boxcount++; |
887 |
|
|
|
888 |
joko |
1.12 |
$box = container(); |
889 |
|
|
|
890 |
joko |
1.11 |
// box style |
891 |
|
|
$style = container( |
892 |
|
|
html_style("text/css", '.boxlabel_darkgreen { color: darkgreen; font-weight:bold; }'), |
893 |
|
|
html_style("text/css", '.box_dsg { background: #20ab39; color: white; border: 2px black groove; width:640px; padding:10px; margin:40px; }') |
894 |
|
|
); |
895 |
joko |
1.12 |
$box->add( $style ); |
896 |
joko |
1.11 |
|
897 |
|
|
// box content |
898 |
|
|
$statusbox = html_div('box_dsg'); |
899 |
|
|
$statusbox->add( html_b("DataSource::Generic"), html_br() ); |
900 |
|
|
$locatorbox = html_div('box_dsg'); |
901 |
|
|
$locatorbox->set_id("locatorbox_$boxcount"); |
902 |
|
|
$locatorbox->add( Dumper($this->_locator) ); |
903 |
joko |
1.14 |
|
904 |
|
|
// FIXME: ie/mozilla? |
905 |
joko |
1.15 |
//$locatorbox->set_style('display:none;'); |
906 |
|
|
//$locatorbox->set_style('visibility:hidden;'); |
907 |
|
|
// already duplicate inside Tracer!!! |
908 |
|
|
$locatorbox->set_style('visibility:hidden; position:absolute; z-index:1; margin-top:30px; padding:5px;'); |
909 |
joko |
1.11 |
|
910 |
joko |
1.15 |
$statusbox->add( html_span('boxlabel_darkgreen', "Locator:"), link::js_function( 'toggleVisibility', array("locatorbox_$boxcount"), '[show]'), $locatorbox, html_br() ); |
911 |
joko |
1.11 |
$call = $this->_locator->get_call(); |
912 |
|
|
$statusbox->add( html_span('boxlabel_darkgreen', "Method:"), $call[method], html_br() ); |
913 |
|
|
if (sizeof($call[args])) { |
914 |
|
|
$statusbox->add( html_span('boxlabel_darkgreen', "Arguments:"), Dumper($call[args]), html_br() ); |
915 |
|
|
} |
916 |
|
|
$statusbox->add( html_span('boxlabel_darkgreen', "Count:"), $this->get_result_count(), html_br() ); |
917 |
joko |
1.12 |
$box->add( $statusbox ); |
918 |
|
|
|
919 |
joko |
1.14 |
//print $box->render(); |
920 |
|
|
trace( $box ); |
921 |
joko |
1.11 |
|
922 |
|
|
} |
923 |
|
|
|
924 |
joko |
1.1 |
|
925 |
|
|
function &query_data() { |
926 |
|
|
//print "query!<br/>"; |
927 |
|
|
return $this->fetch_result(); |
928 |
|
|
//$this->handle_result(); |
929 |
|
|
} |
930 |
|
|
|
931 |
|
|
function query_schema() { |
932 |
|
|
user_error("FIXME: query_schema"); |
933 |
|
|
// $this->datasource_handler_call( ... ); |
934 |
|
|
} |
935 |
|
|
|
936 |
|
|
function &get_result() { |
937 |
|
|
return $this->_result; |
938 |
joko |
1.11 |
} |
939 |
|
|
|
940 |
|
|
function get_result_count() { |
941 |
|
|
return $this->_result_count; |
942 |
joko |
1.1 |
} |
943 |
|
|
|
944 |
|
|
} |
945 |
|
|
|
946 |
|
|
?> |