protected function paramArrays(&$query, &$params)
    {
        if (!is_array($params)) {
            return;
        }

        $newParams = [];

        $this->modifyQuery($query, function ($part) use (&$params, &$newParams) {
            $newPart = "";
            $tmpPart = $part;

            while (count($params) > 0) {
                $pos = strpos($tmpPart, "?");
                if ($pos === false) {
                    break;
                }

                $val = array_shift($params);

                $newPart .= substr($tmpPart, 0, $pos);
                $tmpPart = substr($tmpPart, $pos + 1);

                # If this is just a straight value then don't do anything to it
                if (!is_array($val)) {
                    $newPart .= "?";
                    $newParams[] = $val;
                    continue;
                }

                # If the array is only 1 element (or no elements) long then convert it to an = (or <> for NOT IN)
                if (count($val) < 2) {
                    $newPart = preg_replace("/\s*\bNOT\s+IN\s*$/i", "<>", $newPart);
                    $newPart = preg_replace("/\s*\bIN\s*$/i", "=", $newPart);
                    $newPart .= "?";
                    $newParams[] = reset($val);
                    continue;
                }

                # Convert each element of the array to a separate marker
                $markers = [];
                foreach ($val as $v) {
                    $markers[] = "?";
                    $newParams[] = $v;
                }
                $newPart .= "(" . implode(",", $markers) . ")";
            }

            $newPart .= $tmpPart;

            return $newPart;
        });

        $params = $newParams;
    }
protected function paramArrays(&$query, &$params)
    {
        if (!is_array($params)) {
            return;
        }

        $newParams = [];

        $this->modifyQuery($query, function ($part) use (&$params, &$newParams) {
            $newPart = "";
            $tmpPart = $part;

            while (count($params) > 0) {
                $pos = strpos($tmpPart, "?");
                if ($pos === false) {
                    break;
                }

                $val = array_shift($params);

                $newPart .= substr($tmpPart, 0, $pos);
                $tmpPart = substr($tmpPart, $pos + 1);

                # If this is just a straight value then don't do anything to it
                if (!is_array($val)) {
                    $newPart .= "?";
                    $newParams[] = $val;
                    continue;
                }

                # If the array is only 1 element (or no elements) long then convert it to an = (or <> for NOT IN)
                if (count($val) < 2) {
                    $newPart = preg_replace("/\s*\bNOT\s+IN\s*$/i", "<>", $newPart);
                    $newPart = preg_replace("/\s*\bIN\s*$/i", "=", $newPart);
                    $newPart .= "?";
                    $newParams[] = reset($val);
                    continue;
                }

                # Convert each element of the array to a separate marker
                $markers = [];
                foreach ($val as $v) {
                    $markers[] = "?";
                    $newParams[] = $v;
                }
                $newPart .= "(" . implode(",", $markers) . ")";
            }

            $newPart .= $tmpPart;

            return $newPart;
        });

        $params = $newParams;
    }
protected function paramArrays ( & $ query , & $ params ) { if ( ! is_array ( $ params ) ) { return ; } $ newParams = [ ] ; $ this -> modifyQuery ( $ query , function ( $ part ) use ( & $ params , & $ newParams ) { $ newPart = "" ; $ tmpPart = $ part ; while ( count ( $ params ) > 0 ) { $ pos = strpos ( $ tmpPart , "?" ) ; if ( $ pos === false ) { break ; } $ val = array_shift ( $ params ) ; $ newPart .= substr ( $ tmpPart , 0 , $ pos ) ; $ tmpPart = substr ( $ tmpPart , $ pos + 1 ) ; # If this is just a straight value then don't do anything to it if ( ! is_array ( $ val ) ) { $ newPart .= "?" ; $ newParams [ ] = $ val ; continue ; } # If the array is only 1 element (or no elements) long then convert it to an = (or <> for NOT IN) if ( count ( $ val ) < 2 ) { $ newPart = preg_replace ( "/\s*\bNOT\s+IN\s*$/i" , "<>" , $ newPart ) ; $ newPart = preg_replace ( "/\s*\bIN\s*$/i" , "=" , $ newPart ) ; $ newPart .= "?" ; $ newParams [ ] = reset ( $ val ) ; continue ; } # Convert each element of the array to a separate marker $ markers = [ ] ; foreach ( $ val as $ v ) { $ markers [ ] = "?" ; $ newParams [ ] = $ v ; } $ newPart .= "(" . implode ( "," , $ markers ) . ")" ; } $ newPart .= $ tmpPart ; return $ newPart ; } ) ; $ params = $ newParams ; }
If any of the parameters are arrays, then convert the single marker from the query to handle them
If any of the parameters are arrays then convert the single marker from the query to handle them