21 |
* $Id$ |
* $Id$ |
22 |
* |
* |
23 |
* $Log$ |
* $Log$ |
24 |
|
* Revision 1.7 2004/10/07 14:16:39 jonen |
25 |
|
* + updates related to HACK at DataSource/Generic (page-control!) |
26 |
|
* |
27 |
|
* Revision 1.6 2004/05/06 17:11:55 jonen |
28 |
|
* bugfix related to new phphtmllib-v2.4.1 of Apr 01, 2004 |
29 |
|
* |
30 |
|
* Revision 1.5 2003/07/14 10:07:07 jonen |
31 |
|
* clean up |
32 |
|
* |
33 |
|
* Revision 1.4 2003/04/18 17:26:14 joko |
34 |
|
* minor fix: updated log api |
35 |
|
* |
36 |
* Revision 1.3 2003/04/18 13:48:27 joko |
* Revision 1.3 2003/04/18 13:48:27 joko |
37 |
* minor updates to comments |
* minor updates to comments |
38 |
* |
* |
168 |
$this->trace_payload('MemoryDataSource', $payload); |
$this->trace_payload('MemoryDataSource', $payload); |
169 |
|
|
170 |
// transfer data to "memory" |
// transfer data to "memory" |
171 |
$this->_memory = &$payload; |
$this->_memory = &$payload; |
172 |
|
|
173 |
} |
} |
174 |
|
|
175 |
function read_labels_from_result() { |
function read_labels_from_result() { |
176 |
$this->set_labels($this->_result[0]); |
// NEW 2004-10-07: read last entries labes instead of first, |
177 |
|
// because of a HACK at DataSource/Generic, first could be an empty one |
178 |
|
$count = count($this->_result); |
179 |
|
$this->set_labels($this->_result[$count-1]); |
180 |
$this->propagate_schema(); |
$this->propagate_schema(); |
181 |
} |
} |
182 |
|
|
207 |
function O_do_prequery() { |
function O_do_prequery() { |
208 |
$this->_read_schema(); |
$this->_read_schema(); |
209 |
} |
} |
|
function O_do_prequery() { |
|
|
} |
|
210 |
|
|
211 |
/** |
/** |
212 |
* This function does the query |
* This function does the query |
220 |
|
|
221 |
function handle_result() { |
function handle_result() { |
222 |
$this->debug("handle_result", "HANDLE RESULT!<br>"); |
$this->debug("handle_result", "HANDLE RESULT!<br>"); |
223 |
$this->propagate_result(); |
return $this->propagate_result(); |
224 |
} |
} |
225 |
|
|
226 |
function propagate_result() { |
function propagate_result() { |
235 |
} |
} |
236 |
} |
} |
237 |
} |
} |
238 |
|
if ($count > 0) { |
239 |
$this->set_total_rows( $count ); |
$this->set_total_rows($count); |
240 |
$this->sort(); |
$this->sort(); |
241 |
|
return true; |
242 |
|
} else { |
243 |
|
return false; |
244 |
|
} |
245 |
} |
} |
246 |
|
|
247 |
/** |
/** |
258 |
$index = $this->get_data_index(); |
$index = $this->get_data_index(); |
259 |
$limit = $this->get_limit(); |
$limit = $this->get_limit(); |
260 |
$offset = $this->get_offset(); |
$offset = $this->get_offset(); |
261 |
|
|
262 |
if ($limit == -1) { |
if ($limit == -1) { |
263 |
//don't limit the data |
//don't limit the data |
264 |
if ($index > $this->get_total_rows()) { |
if ($index > $this->get_total_rows()) { |
268 |
} |
} |
269 |
} else { |
} else { |
270 |
$left_to_show = $limit - ($index - $offset); |
$left_to_show = $limit - ($index - $offset); |
271 |
if ($left_to_show > 0) { |
if ($left_to_show > 0 ) { |
272 |
return $this->_data[$index]; |
return $this->_data[$index]; |
273 |
} else { |
} else { |
274 |
return NULL; |
return NULL; |
297 |
*/ |
*/ |
298 |
|
|
299 |
if (!is_array($this->_schema[labels] )) { |
if (!is_array($this->_schema[labels] )) { |
300 |
logp(get_class($this) . "->propagate_schema: No schema data could be read from result.", PEAR_LOG_WARNING); |
php::log(get_class($this) . "->propagate_schema: No schema data could be read from result.", PEAR_LOG_WARNING); |
301 |
return; |
return; |
302 |
} |
} |
303 |
|
|
344 |
|
|
345 |
//print "add_row!<br/>"; |
//print "add_row!<br/>"; |
346 |
|
|
347 |
if ($row != NULL) { |
// NEW 2004-10-07: ignore empty entries, |
348 |
|
// because of a HACK at DataSource/Generic, there could be empty one's |
349 |
|
//if ($row != NULL) { |
350 |
if ($this->get_searchby_value()) { |
if ($this->get_searchby_value()) { |
351 |
//user wants to search the data |
//user wants to search the data |
352 |
if ($this->_find_data($row) ) { |
if ($this->_find_data($row) ) { |
359 |
$this->_data[] = $row; |
$this->_data[] = $row; |
360 |
return TRUE; |
return TRUE; |
361 |
} |
} |
362 |
} else { |
//} else { |
363 |
return FALSE; |
// return FALSE; |
364 |
} |
//} |
365 |
} |
} |
366 |
|
|
367 |
function sort() { |
function sort() { |