Skip to content

Commit

Permalink
getReadQueryRaw() fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
mlevent committed Nov 10, 2021
1 parent bb4a41d commit 8af9b5c
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -561,7 +561,7 @@ $db->in('id', [33922, 31221, 45344, 35444])...

## Find In Set

Metodlar: `findInSet()`, `orFindInSet()`
Metodlar: `findInSet()`, `orFindInSet()`, `notFindInSet()`, `orNotFindInSet()`

```php
$db->findInSet('categoryId', 139)...
Expand Down
25 changes: 24 additions & 1 deletion src/Pdb.php
Original file line number Diff line number Diff line change
Expand Up @@ -900,6 +900,29 @@ public function orFindInSet($column, $search){
return $this->findInSet($column, $search, _OR);
}

/**
* notFindInSet
*
* @param string $column
* @param string $search
* @param string $andOr
* @return $this
*/
public function notFindInSet($column, $search, $andOr = _AND){
return $this->whereFactory(null, $search, $andOr, "NOT FIND_IN_SET(?, {$column})");
}

/**
* orNotFindInSet
*
* @param string $column
* @param string $search
* @return $this
*/
public function orNotFindInSet($column, $search){
return $this->notFindInSet($column, $search, _OR);
}

/**
* like
*
Expand Down Expand Up @@ -1226,7 +1249,7 @@ public function getReadQuery($deny = []){
* @return string
*/
public function getReadQueryRaw($deny = []){
return vsprintf(str_replace('?', '%s', $this->getReadQuery($deny)), $this->getReadParams());
return vsprintf(str_replace('?', '%s', $this->getReadQuery($deny)), array_map(function($item){ return $this->quote($item); }, $this->getReadParams()));
}

/**
Expand Down

0 comments on commit 8af9b5c

Please sign in to comment.