|
@@ -132,6 +132,14 @@ class Pdo extends Base
|
|
|
{
|
|
|
return $this->load($table, $param, $set, $field, $version)->fetch();
|
|
|
}
|
|
|
+ public function column($table, $param, $set, $field, $version)
|
|
|
+ {
|
|
|
+ return $this->load($table, $param, $set, $field, $version)->fetchColumn();
|
|
|
+ }
|
|
|
+ public function columns($table, $param, $set, $field, $version)
|
|
|
+ {
|
|
|
+ return $this->load($table, $param, $set, $field, $version)->fetchAll(\PDO::FETCH_COLUMN);
|
|
|
+ }
|
|
|
public function count($table, $param, $field)
|
|
|
{
|
|
|
return $this->load($table, $param, array('col'=>'count(*)'), $field, false)->fetch(\PDO::FETCH_NUM)[0];
|
|
@@ -149,6 +157,12 @@ class Pdo extends Base
|
|
|
$this->query($sql, $bind, 'update');
|
|
|
return $this->update->lastInsertId();
|
|
|
}
|
|
|
+ public function inserts($table, $data, $field)
|
|
|
+ {
|
|
|
+ $sql = $this->tool->inserts($table, $data);
|
|
|
+ $this->query($sql, [], 'update');
|
|
|
+ return $this->update->lastInsertId();
|
|
|
+ }
|
|
|
public function update($table, $param, $data, $field)
|
|
|
{
|
|
|
$bind = [];
|
|
@@ -161,11 +175,21 @@ class Pdo extends Base
|
|
|
$sql = $this->tool->delete($table, $param, $bind, $field);
|
|
|
return $this->query($sql, $bind, 'update')->rowCount();
|
|
|
}
|
|
|
+ public function copy($table, $dest, $param, $field)
|
|
|
+ {
|
|
|
+ $bind = [];
|
|
|
+ $sql = $this->tool->copy($table, $dest, $param, $bind, $field);
|
|
|
+ return $this->query($sql, $bind, 'update')->rowCount();
|
|
|
+ }
|
|
|
public function optimize($table)
|
|
|
{
|
|
|
$sql = $this->tool->optimize($table) . ';' . $this->tool->analyze($table);
|
|
|
return $this->query($sql, [], 'update');
|
|
|
}
|
|
|
+ public function inTransaction()
|
|
|
+ {
|
|
|
+ return $this->update->inTransaction();
|
|
|
+ }
|
|
|
public function begin()
|
|
|
{
|
|
|
$this->update->beginTransaction();
|