Java SQL Query executeCsvQuery(Connection csv, String csvTableName)

Here you can find the source of executeCsvQuery(Connection csv, String csvTableName)

Description

Executes a query on provided CSV connection.

License

Open Source License

Declaration

public static ResultSet executeCsvQuery(Connection csv, String csvTableName) throws SQLException 

Method Source Code

//package com.java2s;
/*/*  w w w  .  ja va2s .  c o  m*/
 * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
 * or more contributor license agreements. Licensed under the Elastic License;
 * you may not use this file except in compliance with the Elastic License.
 */

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

public class Main {
    /**
     * Executes a query on provided CSV connection.
     * <p>
     * The supplied table name is only used for the test identification.
     */
    public static ResultSet executeCsvQuery(Connection csv, String csvTableName) throws SQLException {
        ResultSet expected = csv.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY)
                .executeQuery("SELECT * FROM " + csvTableName);
        // trigger data loading for type inference
        expected.beforeFirst();
        return expected;
    }
}

Related

  1. createInQueryStatement(String query, long[] ids, Connection conn)
  2. executeDDL(String query, Connection connection)
  3. executeForResult(Connection conn, String query, String... args)
  4. ExecuteNoneQuerys(String cmdtext, Object[] parms)
  5. executeQuery(Connection c, String query)