4 * SearchQueryFragment represents the a fragment of a SQL where clause that contains both the SQL statement and the
5 * parameterized bound values that will be used in the SQL statement.
7 * @link http://www.open-emr.org
8 * @author Stephen Nielson <stephen@nielson.org>
9 * @copyright Copyright (c) 2021 Stephen Nielson <stephen@nielson.org>
10 * @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
13 namespace OpenEMR\Services\Search
;
15 class SearchQueryFragment
28 public function __construct($fragment = "", $boundValues = null)
30 $this->setFragment($fragment);
31 $this->boundValues
= is_array($boundValues) ?
$boundValues : [];
37 public function getBoundValues(): array
39 return $this->boundValues
;
43 * @param mixed $boundValue
45 public function addBoundValue($boundValue): void
47 $this->boundValues
[] = $boundValue;
53 public function getFragment(): string
55 return $this->fragment
;
59 * @param string $fragment
61 public function setFragment(string $fragment): void
63 $this->fragment
= $fragment;
66 public function setQueryFragment(string $fragment, $boundValue)
68 $this->setFragment($fragment);
69 $this->addBoundValue($boundValue);
73 * Helper statement useful for debugging the query fragment.
76 public function __toString()
78 return "(fragment=" . $this->getFragment() . ", boundValues=[" . implode(",", $this->boundValues
) . "])";