com.technophobia.substeps.database.impl.Database Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of database-substeps Show documentation
Show all versions of database-substeps Show documentation
Database step implementations
The newest version!
/*
* Copyright Technophobia Ltd & Alan Raison 2013
*
* This file is part of Substeps.
*
* Substeps is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Substeps 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Substeps. If not, see .
*/
package com.technophobia.substeps.database.impl;
import static com.technophobia.substeps.database.runner.DatabaseSetupTearDown.getExecutionContext;
import java.io.IOException;
import java.io.InputStream;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.junit.Assert;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.technophobia.substeps.database.runner.DatabaseSetupTearDown;
import com.technophobia.substeps.model.exception.SubstepsException;
/**
* Encapsulate DB operations
*
* @author imoore
*
*/
public class Database {
private static final Logger logger = LoggerFactory.getLogger(Database.class);
/**
* This class should be solely responsible for executing queries and
* returning results, what happens with those results is the responsibility
* of the caller, typically to stash them, however this may not always be
* the case
*
* @deprecated
* @param sql
*/
@Deprecated
public static void execute(final String sql) {
final List