Reorder and new queries, also change to Query/Builder
This commit is contained in:
8
src/Database/Query/MySQL/Create.php
Normal file
8
src/Database/Query/MySQL/Create.php
Normal file
@ -0,0 +1,8 @@
|
||||
<?php
|
||||
namespace ProVM\Database\Query\MySQL;
|
||||
|
||||
use ProVM\Implement\Database\Query;
|
||||
|
||||
class Create extends Query\Create
|
||||
{
|
||||
}
|
@ -1,7 +1,8 @@
|
||||
<?php
|
||||
namespace ProVM\Database\Query\MySQL;
|
||||
|
||||
use ProVM\Alias\Database\Query\Delete as Base;
|
||||
use ProVM\Implement\Database\Query;
|
||||
|
||||
class Delete extends Base
|
||||
{}
|
||||
class Delete extends Query\Delete
|
||||
{
|
||||
}
|
||||
|
8
src/Database/Query/MySQL/Drop.php
Normal file
8
src/Database/Query/MySQL/Drop.php
Normal file
@ -0,0 +1,8 @@
|
||||
<?php
|
||||
namespace ProVM\Database\Query\MySQL;
|
||||
|
||||
use ProVM\Implement\Database\Query;
|
||||
|
||||
class Drop extends Query\Drop
|
||||
{
|
||||
}
|
@ -1,7 +1,8 @@
|
||||
<?php
|
||||
namespace ProVM\Database\Query\MySQL;
|
||||
|
||||
use ProVM\Alias\Database\Query\Insert as Base;
|
||||
use ProVM\Implement\Database\Query;
|
||||
|
||||
class Insert extends Base
|
||||
{}
|
||||
class Insert extends Query\Insert
|
||||
{
|
||||
}
|
||||
|
@ -1,9 +1,9 @@
|
||||
<?php
|
||||
namespace ProVM\Database\Query\MySQL;
|
||||
|
||||
use ProVM\Alias\Database\Query\Select as Base;
|
||||
use ProVM\Implement\Database\Query;
|
||||
|
||||
class Select extends Base
|
||||
class Select extends Query\Select
|
||||
{
|
||||
public function limit(int $limit, ?int $offset = null): Select
|
||||
{
|
||||
@ -13,38 +13,45 @@ class Select extends Base
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
protected int $limit;
|
||||
public function setLimit(int $limit): Select
|
||||
{
|
||||
$this->limit = $limit;
|
||||
return $this;
|
||||
}
|
||||
protected int $offset;
|
||||
|
||||
public function getLimit(): int
|
||||
{
|
||||
return $this->limit;
|
||||
}
|
||||
protected int $offset;
|
||||
public function setOffset(int $offset): Select
|
||||
{
|
||||
$this->offset = $offset;
|
||||
return $this;
|
||||
}
|
||||
public function getOffset(): int
|
||||
{
|
||||
return $this->offset;
|
||||
}
|
||||
|
||||
public function setLimit(int $limit): Select
|
||||
{
|
||||
$this->limit = $limit;
|
||||
return $this;
|
||||
}
|
||||
public function setOffset(int $offset): Select
|
||||
{
|
||||
$this->offset = $offset;
|
||||
return $this;
|
||||
}
|
||||
|
||||
protected function getLimitString(): string
|
||||
{
|
||||
return (isset($this->limit)) ? " LIMIT {$this->getLimit()}{$this->getOffsetString()}" : '';
|
||||
}
|
||||
protected function getOffsetString(): string
|
||||
{
|
||||
return (isset($this->offset)) ? " OFFSET {$this->getOffset()}" : '';
|
||||
}
|
||||
|
||||
public function build(): string
|
||||
{
|
||||
$query = [parent::build()];
|
||||
if (isset($this->limit)) {
|
||||
$query []= 'LIMIT';
|
||||
$query []= $this->getLimit();
|
||||
if (isset($this->offset)) {
|
||||
$query []= 'OFFSET';
|
||||
$query []= $this->getOffset();
|
||||
}
|
||||
}
|
||||
return implode(' ', $query);
|
||||
$query = [
|
||||
parent::build(),
|
||||
$this->getLimitString()
|
||||
];
|
||||
return implode('', $query);
|
||||
}
|
||||
}
|
||||
|
8
src/Database/Query/MySQL/Truncate.php
Normal file
8
src/Database/Query/MySQL/Truncate.php
Normal file
@ -0,0 +1,8 @@
|
||||
<?php
|
||||
namespace ProVM\Database\Query\MySQL;
|
||||
|
||||
use ProVM\Implement\Database\Query;
|
||||
|
||||
class Truncate extends Query\Truncate
|
||||
{
|
||||
}
|
@ -1,7 +1,8 @@
|
||||
<?php
|
||||
namespace ProVM\Database\Query\MySQL;
|
||||
|
||||
use ProVM\Alias\Database\Query\Update as Base;
|
||||
use ProVM\Implement\Database\Query;
|
||||
|
||||
class Update extends Base
|
||||
{}
|
||||
class Update extends Query\Update
|
||||
{
|
||||
}
|
||||
|
Reference in New Issue
Block a user