view src/main/java/nl/cwi/monetdb/embedded/AbstractStatementResult.java @ 36:18432f31d1e3 embedded

Updated JNI calls
author Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
date Wed, 02 Nov 2016 17:04:24 +0100 (2016-11-02)
parents 5e58809cfbed
children 8a65996a8dc0
line wrap: on
line source
/*
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0.  If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 *
 * Copyright 2016 MonetDB B.V.
 */

package nl.cwi.monetdb.embedded;

import java.io.Closeable;

/**
 * The base class for a query result.
 *
 * @author <a href="mailto:pedro.ferreira@monetdbsolutions.com">Pedro Ferreira</a>
 */
public abstract class AbstractStatementResult implements Closeable {

    /**
     * The corresponding connection of this result.
     */
    private final MonetDBEmbeddedConnection connection;

    protected AbstractStatementResult(MonetDBEmbeddedConnection connection) {
        this.connection = connection;
    }

    /**
     * Get the corresponding connection to this statement result.
     *
     * @return A MonetDBEmbeddedConnection instance
     */
    public MonetDBEmbeddedConnection getConnection() { return connection; }

    @Override
    public void close() {
        this.connection.removeQueryResult(this);
    }
}