summaryrefslogtreecommitdiffstats
path: root/vendor/ipl/sql/src/Filter
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/ipl/sql/src/Filter')
-rw-r--r--vendor/ipl/sql/src/Filter/Exists.php14
-rw-r--r--vendor/ipl/sql/src/Filter/In.php24
-rw-r--r--vendor/ipl/sql/src/Filter/InAndNotInUtils.php62
-rw-r--r--vendor/ipl/sql/src/Filter/NotExists.php14
-rw-r--r--vendor/ipl/sql/src/Filter/NotIn.php24
5 files changed, 138 insertions, 0 deletions
diff --git a/vendor/ipl/sql/src/Filter/Exists.php b/vendor/ipl/sql/src/Filter/Exists.php
new file mode 100644
index 0000000..e1951d0
--- /dev/null
+++ b/vendor/ipl/sql/src/Filter/Exists.php
@@ -0,0 +1,14 @@
+<?php
+
+namespace ipl\Sql\Filter;
+
+use ipl\Sql\Select;
+use ipl\Stdlib\Filter;
+
+class Exists extends Filter\Condition
+{
+ public function __construct(Select $select)
+ {
+ parent::__construct('', $select);
+ }
+}
diff --git a/vendor/ipl/sql/src/Filter/In.php b/vendor/ipl/sql/src/Filter/In.php
new file mode 100644
index 0000000..c126af6
--- /dev/null
+++ b/vendor/ipl/sql/src/Filter/In.php
@@ -0,0 +1,24 @@
+<?php
+
+namespace ipl\Sql\Filter;
+
+use ipl\Sql\Select;
+use ipl\Stdlib\Filter;
+
+class In extends Filter\Condition
+{
+ use InAndNotInUtils;
+
+ /**
+ * Create a new sql IN condition
+ *
+ * @param string[]|string $column
+ * @param Select $select
+ */
+ public function __construct($column, Select $select)
+ {
+ $this
+ ->setColumn($column)
+ ->setValue($select);
+ }
+}
diff --git a/vendor/ipl/sql/src/Filter/InAndNotInUtils.php b/vendor/ipl/sql/src/Filter/InAndNotInUtils.php
new file mode 100644
index 0000000..6f26de1
--- /dev/null
+++ b/vendor/ipl/sql/src/Filter/InAndNotInUtils.php
@@ -0,0 +1,62 @@
+<?php
+
+namespace ipl\Sql\Filter;
+
+use ipl\Sql\Select;
+
+trait InAndNotInUtils
+{
+ /** @var string[]|string */
+ protected $column;
+
+ /** @var Select */
+ protected $value;
+
+ /**
+ * Get the columns of this condition
+ *
+ * @return string[]|string
+ */
+ public function getColumn()
+ {
+ return $this->column;
+ }
+
+ /**
+ * Set the columns of this condition
+ *
+ * @param string[]|string $column
+ *
+ * @return $this
+ */
+ public function setColumn($column): self
+ {
+ $this->column = $column;
+
+ return $this;
+ }
+
+ /**
+ * Get the value of this condition
+ *
+ * @return Select
+ */
+ public function getValue(): Select
+ {
+ return $this->value;
+ }
+
+ /**
+ * Set the value of this condition
+ *
+ * @param Select $value
+ *
+ * @return $this
+ */
+ public function setValue($value): self
+ {
+ $this->value = $value;
+
+ return $this;
+ }
+}
diff --git a/vendor/ipl/sql/src/Filter/NotExists.php b/vendor/ipl/sql/src/Filter/NotExists.php
new file mode 100644
index 0000000..bb8be35
--- /dev/null
+++ b/vendor/ipl/sql/src/Filter/NotExists.php
@@ -0,0 +1,14 @@
+<?php
+
+namespace ipl\Sql\Filter;
+
+use ipl\Sql\Select;
+use ipl\Stdlib\Filter;
+
+class NotExists extends Filter\Condition
+{
+ public function __construct(Select $select)
+ {
+ parent::__construct('', $select);
+ }
+}
diff --git a/vendor/ipl/sql/src/Filter/NotIn.php b/vendor/ipl/sql/src/Filter/NotIn.php
new file mode 100644
index 0000000..cdf6241
--- /dev/null
+++ b/vendor/ipl/sql/src/Filter/NotIn.php
@@ -0,0 +1,24 @@
+<?php
+
+namespace ipl\Sql\Filter;
+
+use ipl\Sql\Select;
+use ipl\Stdlib\Filter;
+
+class NotIn extends Filter\Condition
+{
+ use InAndNotInUtils;
+
+ /**
+ * Create a new sql NOT IN condition
+ *
+ * @param string[]|string $column
+ * @param Select $select
+ */
+ public function __construct($column, Select $select)
+ {
+ $this
+ ->setColumn($column)
+ ->setValue($select);
+ }
+}