2011-03-03 23:06:18 +00:00
|
|
|
<?php defined('SYSPATH') or die('No direct access allowed.');
|
|
|
|
|
|
|
|
/**
|
|
|
|
* TSM database result. See [Results](/database/results) for usage and examples.
|
|
|
|
*
|
|
|
|
* @package PTA
|
|
|
|
* @subpackage TSM
|
|
|
|
* @category Query/Result
|
|
|
|
* @author Deon George
|
|
|
|
* @copyright (c) 2010 phpTSMadmin Development Team
|
|
|
|
* @license http://phptsmadmin.sf.net/license.html
|
|
|
|
*/
|
|
|
|
class Database_TSM_Result extends Database_Result {
|
2011-06-24 01:27:21 +00:00
|
|
|
public function __construct($result, $sql, $as_object = FALSE, array $params = NULL) {
|
2011-03-03 23:06:18 +00:00
|
|
|
parent::__construct($result, $sql, $as_object, $params);
|
|
|
|
|
2011-04-07 05:03:05 +00:00
|
|
|
$start = FALSE;
|
2011-08-31 21:36:33 +00:00
|
|
|
// Is this a DB2 result?
|
|
|
|
if (is_resource($result) AND function_exists('db2_fetch_object')) {
|
|
|
|
// If we are running a DB2 set command, we can return
|
|
|
|
if (preg_match('/^SET/',$sql))
|
|
|
|
return;
|
2011-04-07 05:03:05 +00:00
|
|
|
|
2011-08-31 21:36:33 +00:00
|
|
|
while ($r = db2_fetch_object($result))
|
|
|
|
$this->_rows[$this->_internal_row++] = (array)$r;
|
|
|
|
|
|
|
|
// Is this an DSMADMC result?
|
|
|
|
} elseif (is_array($result))
|
|
|
|
foreach ($result as $line) {
|
|
|
|
if (! trim($line)) {
|
|
|
|
if ($start)
|
|
|
|
$this->_internal_row++;
|
2011-03-03 23:06:18 +00:00
|
|
|
|
2011-08-31 21:36:33 +00:00
|
|
|
continue;
|
|
|
|
}
|
2011-03-03 23:06:18 +00:00
|
|
|
|
2011-08-31 21:36:33 +00:00
|
|
|
list($k,$v) = explode(':',$line,2);
|
|
|
|
|
|
|
|
$this->_rows[$this->_internal_row][trim($k)] = trim($v);
|
|
|
|
$start = TRUE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
throw new Kohana_Exception('Unknown result :result',array(':result'=>$result));
|
2011-03-03 23:06:18 +00:00
|
|
|
|
|
|
|
$this->_total_rows = $this->_internal_row;
|
|
|
|
$this->_internal_row = 0;
|
|
|
|
}
|
2011-06-24 01:27:21 +00:00
|
|
|
}
|
2011-03-03 23:06:18 +00:00
|
|
|
?>
|