src/Context/SQLHandler.php
public function constructSQLClause($glue, array $columns)
    {
        $whereClause = [];

        foreach ($columns as $column => $value) {
            $newValue = ltrim($value, '!');
            $quotedValue = $this->quoteOrNot($newValue);
            $comparator = '%s=';
            $notOperator = '';

            // Check if the supplied value is null, if so change the format.
            if (strtolower($newValue) == 'null') {
                $comparator = 'is%s';
            }

            // Check if a not is applied to the value.
            if ($newValue !== $value) {
                if (strtolower($newValue) == 'null') {
                    $notOperator = ' not';
                } else {
                    $notOperator = '!';
                }
            }

            // Check if the value is surrounded by wildcards. If so, we'll want to use a LIKE comparator.
            if (preg_match('/^%.+%$/', $value)) {
                $comparator = 'LIKE';
            }

            // Make up the sql.
            $comparator = sprintf($comparator, $notOperator);

            $whereClause[] = sprintf('%s %s %s', $column, $comparator, $quotedValue);
        }

        return implode($glue, $whereClause);
    }
public function constructSQLClause($glue, array $columns)
    {
        $whereClause = [];

        foreach ($columns as $column => $value) {
            $newValue = ltrim($value, '!');
            $quotedValue = $this->quoteOrNot($newValue);
            $comparator = '%s=';
            $notOperator = '';

            // Check if the supplied value is null, if so change the format.
            if (strtolower($newValue) == 'null') {
                $comparator = 'is%s';
            }

            // Check if a not is applied to the value.
            if ($newValue !== $value) {
                if (strtolower($newValue) == 'null') {
                    $notOperator = ' not';
                } else {
                    $notOperator = '!';
                }
            }

            // Check if the value is surrounded by wildcards. If so, we'll want to use a LIKE comparator.
            if (preg_match('/^%.+%$/', $value)) {
                $comparator = 'LIKE';
            }

            // Make up the sql.
            $comparator = sprintf($comparator, $notOperator);

            $whereClause[] = sprintf('%s %s %s', $column, $comparator, $quotedValue);
        }

        return implode($glue, $whereClause);
    }
public function constructSQLClause ( $ glue , array $ columns ) { $ whereClause = [ ] ; foreach ( $ columns as $ column => $ value ) { $ newValue = ltrim ( $ value , '!' ) ; $ quotedValue = $ this -> quoteOrNot ( $ newValue ) ; $ comparator = '%s=' ; $ notOperator = '' ; // Check if the supplied value is null, if so change the format. if ( strtolower ( $ newValue ) == 'null' ) { $ comparator = 'is%s' ; } // Check if a not is applied to the value. if ( $ newValue !== $ value ) { if ( strtolower ( $ newValue ) == 'null' ) { $ notOperator = ' not' ; } else { $ notOperator = '!' ; } } // Check if the value is surrounded by wildcards. If so, we'll want to use a LIKE comparator. if ( preg_match ( '/^%.+%$/' , $ value ) ) { $ comparator = 'LIKE' ; } // Make up the sql. $ comparator = sprintf ( $ comparator , $ notOperator ) ; $ whereClause [ ] = sprintf ( '%s %s %s' , $ column , $ comparator , $ quotedValue ) ; } return implode ( $ glue , $ whereClause ) ; }
Constructs a clause based on the glue, to be used for where and update clause.
Constructs a clause based on the glue to be used for where and update clause .