Files
kiri-core/Database/Query.php
T

55 lines
673 B
PHP
Raw Normal View History

2020-08-31 12:38:32 +08:00
<?php
/**
* Created by PhpStorm.
* User: whwyy
* Date: 2018/6/27 0027
* Time: 17:49
*/
2020-10-29 18:17:25 +08:00
declare(strict_types=1);
2021-02-24 18:34:57 +08:00
2020-08-31 12:38:32 +08:00
namespace Database;
use Database\Traits\QueryTrait;
2020-12-17 14:09:14 +08:00
use Exception;
2020-08-31 12:38:32 +08:00
/**
2021-03-27 02:59:15 +08:00
* Class Query
2020-08-31 12:38:32 +08:00
* @package Database
*/
2021-03-27 02:59:15 +08:00
class Query implements ISqlBuilder
2020-08-31 12:38:32 +08:00
{
2021-02-24 18:34:57 +08:00
2020-08-31 12:38:32 +08:00
use QueryTrait;
2021-02-24 18:34:57 +08:00
2021-08-09 18:56:09 +08:00
/**
* @throws Exception
*/
public function __construct()
{
$this->builder = SqlBuilder::builder($this);
}
2020-08-31 12:38:32 +08:00
/**
* @return string
2020-12-17 14:09:14 +08:00
* @throws Exception
2020-08-31 12:38:32 +08:00
*/
2020-12-17 14:09:14 +08:00
public function getSql(): string
2020-08-31 12:38:32 +08:00
{
2021-08-09 18:56:09 +08:00
return $this->builder->get();
2020-08-31 12:38:32 +08:00
}
2021-02-24 18:34:57 +08:00
/**
* @return string
* @throws Exception
*/
public function getCondition(): string
{
2021-08-09 18:56:09 +08:00
return $this->builder->getCondition();
2021-02-24 18:34:57 +08:00
}
2020-08-31 12:38:32 +08:00
}