]> scripts.mit.edu Git - autoinstallsdev/mediawiki.git/blobdiff - includes/libs/rdbms/encasing/LikeMatch.php
MediaWiki 1.30.2
[autoinstallsdev/mediawiki.git] / includes / libs / rdbms / encasing / LikeMatch.php
diff --git a/includes/libs/rdbms/encasing/LikeMatch.php b/includes/libs/rdbms/encasing/LikeMatch.php
new file mode 100644 (file)
index 0000000..98812a5
--- /dev/null
@@ -0,0 +1,31 @@
+<?php
+
+namespace Wikimedia\Rdbms;
+
+/**
+ * Used by Database::buildLike() to represent characters that have special
+ * meaning in SQL LIKE clauses and thus need no escaping. Don't instantiate it
+ * manually, use Database::anyChar() and anyString() instead.
+ */
+class LikeMatch {
+       /** @var string */
+       private $str;
+
+       /**
+        * Store a string into a LikeMatch marker object.
+        *
+        * @param string $s
+        */
+       public function __construct( $s ) {
+               $this->str = $s;
+       }
+
+       /**
+        * Return the original stored string.
+        *
+        * @return string
+        */
+       public function toString() {
+               return $this->str;
+       }
+}