|
@ -61,9 +61,9 @@ abstract class Model |
|
|
return new ModelSelectResult($res); |
|
|
return new ModelSelectResult($res); |
|
|
case 'insert': |
|
|
case 'insert': |
|
|
case 'replac': |
|
|
case 'replac': |
|
|
return new ModelInsertResult($this->handler, $res); //$res for postgreSQL
|
|
|
|
|
|
|
|
|
return new ModelInsertResult($this->handler); |
|
|
default: |
|
|
default: |
|
|
return new ModelChangeResult($this->handler, $res); //$res for postgreSQL
|
|
|
|
|
|
|
|
|
return new ModelChangeResult($this->handler); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -182,28 +182,6 @@ class ModelSelectResult extends ModelResult |
|
|
} |
|
|
} |
|
|
return $array; |
|
|
return $array; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* Fetches all SQL result rows as an array of key-value pairs. |
|
|
|
|
|
* |
|
|
|
|
|
* The first column is the key, the second column is the |
|
|
|
|
|
* value. |
|
|
|
|
|
* |
|
|
|
|
|
* @return array |
|
|
|
|
|
*/ |
|
|
|
|
|
public function fetchPairs() |
|
|
|
|
|
{ |
|
|
|
|
|
if (!method_exists('DBConnector', 'fetchArray')) { |
|
|
|
|
|
throw new Exception('Method not implemented yet.'); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$data = array(); |
|
|
|
|
|
while ($row = DBConnector::fetchArray($this->result, DBConnector::FETCH_NUM)) { |
|
|
|
|
|
$data[$row[0]] = $row[1]; |
|
|
|
|
|
} |
|
|
|
|
|
return $data; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function count() |
|
|
function count() |
|
|
{ |
|
|
{ |
|
@ -224,9 +202,9 @@ class ModelChangeResult extends ModelResult |
|
|
{ |
|
|
{ |
|
|
public $affected; |
|
|
public $affected; |
|
|
|
|
|
|
|
|
function __construct($resource, $result) |
|
|
|
|
|
|
|
|
function __construct($resource) |
|
|
{ |
|
|
{ |
|
|
$this->affected = DBConnector::affectedRows($resource, $result); |
|
|
|
|
|
|
|
|
$this->affected = DBConnector::affectedRows($resource); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
function count() |
|
|
function count() |
|
@ -239,9 +217,9 @@ class ModelInsertResult extends ModelChangeResult |
|
|
{ |
|
|
{ |
|
|
public $id; |
|
|
public $id; |
|
|
|
|
|
|
|
|
function __construct($resource, $result) |
|
|
|
|
|
|
|
|
function __construct($resource) |
|
|
{ |
|
|
{ |
|
|
parent::__construct($resource, $result); |
|
|
|
|
|
|
|
|
parent::__construct($resource); |
|
|
$this->id = DBConnector::getId($resource); |
|
|
$this->id = DBConnector::getId($resource); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|