All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.mongodb.jdbc.MongoResultDoc Maven / Gradle / Ivy

There is a newer version: 2.2.0
Show newest version
package com.mongodb.jdbc;

import java.sql.SQLException;
import java.util.List;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

public class MongoResultDoc {
    public Boolean emptyResultSet;
    public List values;

    public MongoResultDoc() {}

    public MongoResultDoc(List cols, boolean isEmpty) {
        values = cols;
        this.emptyResultSet = isEmpty;
    }

    List getValues() {
        return values;
    }

    boolean isEmpty() {
        return emptyResultSet != null && emptyResultSet;
    }

    // MongoResultDoc[emptyResultSet=,values=[Column{database=, table=, tableAlias=, column=, columnAlias=, value=}]]
    @Override
    public String toString() {
        return ToStringBuilder.reflectionToString(this, ToStringStyle.SHORT_PREFIX_STYLE);
    }

    public int columnCount() throws SQLException {
        if (values == null) {
            throw new SQLException("Invalid input");
        }
        return values.size();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy