public function prepSelect($data, $ldiv = 'AND')
    {
        $operator     = null;
        $conditions   = [];
        $conditionsII = [];
        foreach ($data as $column => $value) {
            if (is_integer($column)) {
                $conditionsII[] = $value;
                continue;
            }
            if (($column == $this->keyColumn) && ($this->keyColumn == '')) {
                continue;
            }
            if (is_string($value) && (($value == '!=""') || ($value == "!=''"))) {
                $conditions[] = ' '.$this->getColumnComa().$column.$this->getColumnComma()." !='' ";
                continue;
            }

            if (is_null($value)) {
                $value    = 'null';
                $operator = ' IS ';
            } else {
                if (strlen($value) && ($value[0] == '!')) {
                    $operator = ' != ';
                    $value    = substr($value, 1);
                } else {
                    if (($value === '!null') || (strtoupper($value) === 'IS NOT NULL')) {
                        $value    = 'null';
                        $operator = 'IS NOT';
                    } else {
                        if (is_null($operator)) {
                            $operator = ' = ';
                        }
                    }
                }
                if (is_bool($value)) {
                    if ($value === null) {
                        $value .= ' null,';
                    } elseif ($value) {
                        $value = ' TRUE';
                    } else {
                        $value = ' FALSE';
                    }
                } elseif (!is_string($value)) {
                    $value = " $value";
                } else {
                    if (strtoupper($value) == 'NOW()') {
                        $value = " 'NOW()'";
                    } else {
                        if ($value != 'null') {
                            $value = " '".addslashes($value)."'";
                        }
                    }
                    if ($operator == ' != ') {
                        $operator = ' NOT LIKE ';
                    } else {
                        if (is_null($operator)) {
                            $operator = ' LIKE ';
                        }
                    }
                }
            }

            $conditions[] = ' '.$this->getColumnComma().$column.$this->getColumnComma()."$operator $value ";
        }

        return trim(implode($ldiv, $conditions).' '.implode(' ', $conditionsII));
    }
public function prepSelect($data, $ldiv = 'AND')
    {
        $operator     = null;
        $conditions   = [];
        $conditionsII = [];
        foreach ($data as $column => $value) {
            if (is_integer($column)) {
                $conditionsII[] = $value;
                continue;
            }
            if (($column == $this->keyColumn) && ($this->keyColumn == '')) {
                continue;
            }
            if (is_string($value) && (($value == '!=""') || ($value == "!=''"))) {
                $conditions[] = ' '.$this->getColumnComa().$column.$this->getColumnComma()." !='' ";
                continue;
            }

            if (is_null($value)) {
                $value    = 'null';
                $operator = ' IS ';
            } else {
                if (strlen($value) && ($value[0] == '!')) {
                    $operator = ' != ';
                    $value    = substr($value, 1);
                } else {
                    if (($value === '!null') || (strtoupper($value) === 'IS NOT NULL')) {
                        $value    = 'null';
                        $operator = 'IS NOT';
                    } else {
                        if (is_null($operator)) {
                            $operator = ' = ';
                        }
                    }
                }
                if (is_bool($value)) {
                    if ($value === null) {
                        $value .= ' null,';
                    } elseif ($value) {
                        $value = ' TRUE';
                    } else {
                        $value = ' FALSE';
                    }
                } elseif (!is_string($value)) {
                    $value = " $value";
                } else {
                    if (strtoupper($value) == 'NOW()') {
                        $value = " 'NOW()'";
                    } else {
                        if ($value != 'null') {
                            $value = " '".addslashes($value)."'";
                        }
                    }
                    if ($operator == ' != ') {
                        $operator = ' NOT LIKE ';
                    } else {
                        if (is_null($operator)) {
                            $operator = ' LIKE ';
                        }
                    }
                }
            }

            $conditions[] = ' '.$this->getColumnComma().$column.$this->getColumnComma()."$operator $value ";
        }

        return trim(implode($ldiv, $conditions).' '.implode(' ', $conditionsII));
    }
public function prepSelect ( $ data , $ ldiv = 'AND' ) { $ operator = null ; $ conditions = [ ] ; $ conditionsII = [ ] ; foreach ( $ data as $ column => $ value ) { if ( is_integer ( $ column ) ) { $ conditionsII [ ] = $ value ; continue ; } if ( ( $ column == $ this -> keyColumn ) && ( $ this -> keyColumn == '' ) ) { continue ; } if ( is_string ( $ value ) && ( ( $ value == '!=""' ) || ( $ value == "!=''" ) ) ) { $ conditions [ ] = ' ' . $ this -> getColumnComa ( ) . $ column . $ this -> getColumnComma ( ) . " !='' " ; continue ; } if ( is_null ( $ value ) ) { $ value = 'null' ; $ operator = ' IS ' ; } else { if ( strlen ( $ value ) && ( $ value [ 0 ] == '!' ) ) { $ operator = ' != ' ; $ value = substr ( $ value , 1 ) ; } else { if ( ( $ value === '!null' ) || ( strtoupper ( $ value ) === 'IS NOT NULL' ) ) { $ value = 'null' ; $ operator = 'IS NOT' ; } else { if ( is_null ( $ operator ) ) { $ operator = ' = ' ; } } } if ( is_bool ( $ value ) ) { if ( $ value === null ) { $ value .= ' null,' ; } elseif ( $ value ) { $ value = ' TRUE' ; } else { $ value = ' FALSE' ; } } elseif ( ! is_string ( $ value ) ) { $ value = " $value" ; } else { if ( strtoupper ( $ value ) == 'NOW()' ) { $ value = " 'NOW()'" ; } else { if ( $ value != 'null' ) { $ value = " '" . addslashes ( $ value ) . "'" ; } } if ( $ operator == ' != ' ) { $ operator = ' NOT LIKE ' ; } else { if ( is_null ( $ operator ) ) { $ operator = ' LIKE ' ; } } } } $ conditions [ ] = ' ' . $ this -> getColumnComma ( ) . $ column . $ this -> getColumnComma ( ) . "$operator $value " ; } return trim ( implode ( $ ldiv , $ conditions ) . ' ' . implode ( ' ' , $ conditionsII ) ) ; }
Generuje fragment MySQL dotazu z pole data.

@param array  $data Pokud hodnota zacina znakem ! Je tento odstranen a generovan je negovany test
@param string $ldiv typ generovane podminky AND/OR

@return string
Generuje fragment MySQL dotazu z pole data .