public function setType($type) {
        if (!in_array($type, [
            self::INSERT, self::MULTI_INSERT, self::SELECT, self::UPDATE, self::DELETE,
            self::TRUNCATE, self::CREATE_TABLE, self::CREATE_INDEX, self::DROP_TABLE, self::DROP_INDEX
        ], true)) {
            throw new UnsupportedTypeException(sprintf('Invalid query type %s', $type));
        }

        $this->_type = $type;

        // Reset data and binds when changing types
        $this->_data = [];
        $this->_bindings = [];

        return $this;
    }
public function setType($type) {
        if (!in_array($type, [
            self::INSERT, self::MULTI_INSERT, self::SELECT, self::UPDATE, self::DELETE,
            self::TRUNCATE, self::CREATE_TABLE, self::CREATE_INDEX, self::DROP_TABLE, self::DROP_INDEX
        ], true)) {
            throw new UnsupportedTypeException(sprintf('Invalid query type %s', $type));
        }

        $this->_type = $type;

        // Reset data and binds when changing types
        $this->_data = [];
        $this->_bindings = [];

        return $this;
    }
public function setType ( $ type ) { if ( ! in_array ( $ type , [ self :: INSERT , self :: MULTI_INSERT , self :: SELECT , self :: UPDATE , self :: DELETE , self :: TRUNCATE , self :: CREATE_TABLE , self :: CREATE_INDEX , self :: DROP_TABLE , self :: DROP_INDEX ] , true ) ) { throw new UnsupportedTypeException ( sprintf ( 'Invalid query type %s' , $ type ) ) ; } $ this -> _type = $ type ; // Reset data and binds when changing types $ this -> _data = [ ] ; $ this -> _bindings = [ ] ; return $ this ; }
Set the type of query.

@param string $type
@return $this
@throws \Titon\Db\Exception\UnsupportedTypeException
Set the type of query .