blob: 39bd28f4a050d4ac456a366619c73004391fae48 [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2009 IBM Corporation and others.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0.
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* IBM Corporation - initial API and implementation
* Zend Technologies
*******************************************************************************/
package org.eclipse.dltk.core.index.sql;
import java.sql.Connection;
import java.sql.SQLException;
/**
* Element file data access object
*
* @author michael
*
*/
public interface IFileDao {
/**
* Inserts new type into FILES table.
*
* @param connection
* Database connection
* @param path
* Element file
* @param timestamp
* File last update time
* @param containerId
* Container path
* @return new file DAO associated with added row
* @throws SQLException
*/
public File insert(Connection connection, String path, long timestamp,
int containerId) throws SQLException;
/**
* Selects file by path
*
* @param connection
* Database connection
* @param path
* Element file
* @param containerId
* Container path id
* @return file DAO or <code>null</code> in case it doesn't exist
* @throws SQLException
*/
public File select(Connection connection, String path, int containerId)
throws SQLException;
/**
* Selects files by conatiner path
*
* @param connection
* Database connection
* @param containerId
* Container path id
* @return files DAO array
* @throws SQLException
*/
public File[] selectByContainerId(Connection connection, int containerId)
throws SQLException;
/**
* Selects file by key
*
* @param connection
* Database connection
* @param id
* Primary key
* @return file DAO or <code>null</code> in case it doesn't exist
* @throws SQLException
*/
public File selectById(Connection connection, int id) throws SQLException;
/**
* Deletes file from the database
*
* @param connection
* Database connection
* @param path
* File path
* @param containerId
* Container path ID
* @throws SQLException
*/
public void delete(Connection connection, String path, int containerId)
throws SQLException;
/**
* Deletes file from the database by primary key
*
* @param connection
* Database connection
* @param id
* Primary key
* @throws SQLException
*/
public void deleteById(Connection connection, int id) throws SQLException;
}