package de.lcag.csv;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

class CsvStatementTest {
	private static CsvDriver dbDriver = new CsvDriver();
	private static Connection conn = null;
	private static Statement stmt = null;

	@BeforeAll
	static void setUpBeforeClass() throws Exception {
		conn = DriverManager.getConnection("jdbc:csv:src/test/resources/CsvTable");
		stmt = conn.createStatement();
	}

	@BeforeEach
	void setUp() throws Exception {
	}

	@Test
	void testExecuteQuery() throws SQLException {
		ResultSet rs = stmt.executeQuery("SELECT * FROM NameList.csv");

		while (rs.next())
			System.out.println(rs.getString(1) + " - " + rs.getString(2));
	}

}
