Skip to content

Commit

Permalink
:octocat:
Browse files Browse the repository at this point in the history
  • Loading branch information
codemasher committed Aug 27, 2024
1 parent 871bfee commit cad000f
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/Query/BindValues.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

namespace chillerlan\Database\Query;

interface BindValues{
interface BindValues extends Statement{

public function getBindValues():array;

Expand Down
2 changes: 1 addition & 1 deletion src/Query/CachedQuery.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

namespace chillerlan\Database\Query;

interface CachedQuery{
interface CachedQuery extends Query{

public function cached(int|null $ttl = null):static;

Expand Down
4 changes: 1 addition & 3 deletions src/Query/Query.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@

namespace chillerlan\Database\Query;

interface Query{

public function getSQL(bool|null $multi = null):string;
interface Query extends Statement{

/**
* @throws \chillerlan\Database\Query\QueryException
Expand Down
4 changes: 2 additions & 2 deletions src/Query/Select.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
* @link https://www.firebirdsql.org/file/documentation/reference_manuals/fblangref25-en/html/fblangref25-dml-select.html
* @link https://www.sqlite.org/lang_select.html
*/
class Select extends StatementAbstract implements Where, Limit, BindValues, Query, CachedQuery{
class Select extends StatementAbstract implements Where, Limit, BindValues, CachedQuery{

protected bool $distinct = false;
protected array $cols = [];
Expand Down Expand Up @@ -104,7 +104,7 @@ public function count():int{
$sql = $this->dialect->selectCount($this->from, $this->getWhere(), $this->distinct, $this->groupby);
$result = $this->db->prepared(implode(' ', $sql), $this->bindValues);

if($result instanceof ResultInterface && $result->count() > 0){
if($result->count() > 0){
return (int)$result[0]->count;
}

Expand Down
2 changes: 2 additions & 0 deletions src/Query/Statement.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,6 @@ interface Statement{
*/
public function setLogger(LoggerInterface $logger):static;

public function getSQL(bool|null $multi = null):string;

}
2 changes: 1 addition & 1 deletion src/Query/Update.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public function set(array $set, bool|null $bind = null):static{

foreach($set as $k => $v){

if($v instanceof Query){
if($v instanceof Statement){
$this->set[] = $this->dialect->quote($k).' = ('.$v->getSQL().')';

if($v instanceof BindValues){
Expand Down

0 comments on commit cad000f

Please sign in to comment.