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;
    }