public function compile(Database $db = NULL): string {
        if ($db === null) {
            // Get the database instance
            $db = \Mii::$app->db;
        }

        $value = $this->value();

        if (!empty($this->_parameters)) {
            // Quote all of the parameter values
            $params = array_map([$db, 'quote'], $this->_parameters);

            // Replace the values in the expression
            $value = strtr($value, $params);
        }

        return $value;
    }