/***************************************************************************** * Copyright (C) 2008 EnterpriseDB Corporation. * Copyright (C) 2011 Stado Global Development Group. * * This file is part of Stado. * * Stado is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Stado is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Stado. If not, see <http://www.gnu.org/licenses/>. * * You can find Stado at http://www.stado.us * ****************************************************************************/ package org.postgresql.driver.copy; import java.sql.SQLException; /** * Copy bulk data from client into a PostgreSQL table very fast. */ public interface CopyIn extends CopyOperation { /** * Writes specified part of given byte array to an open and writable copy operation. * @param buf array of bytes to write * @param off offset of first byte to write (normally zero) * @param siz number of bytes to write (normally buf.length) * @throws SQLException if the operation fails */ void writeToCopy(byte[] buf, int off, int siz) throws SQLException; /** * Force any buffered output to be sent over the network to the * backend. In general this is a useless operation as it will get * pushed over in due time or when endCopy is called. Some specific * modified server versions (Truviso) want this data sooner. * If you are unsure if you need to use this method, don't. */ void flushCopy() throws SQLException; /** * Finishes copy operation succesfully. * @return number of updated rows for server 8.2 or newer (see getHandledRowCount()) * @throws SQLException if the operation fails. */ public long endCopy() throws SQLException; }