<?php
namespace nur\m\pdo\mysql;

use nur\m\IQuery;
use nur\m\IRowIncarnation;
use nur\m\pdo\PdoQuery;
use nur\sery\db\mysql\query;

class MysqlQuery extends PdoQuery {
  protected function newRowIncarnation(): IRowIncarnation {
    return new MysqlRowIncarnation();
  }

  function select($sql=null, ?array $filter=null): IQuery {
    if (is_array($sql)) [$sql, $filter] = query::with($sql, $filter);
    return parent::select($sql, $filter);
  }

  function update($sql=null, ?array $filter=null, $row=null, ?array &$results=null): IQuery {
    if (is_array($sql)) [$sql, $filter] = query::with($sql, $filter);
    return parent::update($sql, $filter, $row, $results);
  }

  function insert($sql=null, $row=null, ?array &$results=null): IQuery {
    if (is_array($sql)) [$sql, $row] = query::with($sql, $row);
    return parent::insert($sql, $row, $results);
  }
}
