Java SQL PreparedStatement loadColumnTableNameList(PreparedStatement stmt)

Here you can find the source of loadColumnTableNameList(PreparedStatement stmt)

Description

Return table name list which is related on columns.

License

Open Source License

Parameter

Parameter Description
stmt PreparedStatement

Declaration

public static List<String> loadColumnTableNameList(PreparedStatement stmt) 

Method Source Code


//package com.java2s;

import java.sql.PreparedStatement;

import java.sql.ResultSetMetaData;

import java.util.ArrayList;
import java.util.List;

public class Main {
    /**//from   w  ww.  j a va 2  s.c  om
     * Return table name list which is related on columns.
     *
     * @param stmt PreparedStatement
     * @return
     */
    public static List<String> loadColumnTableNameList(PreparedStatement stmt) {
        List<String> tableNames = new ArrayList<String>();
        try {
            ResultSetMetaData rsMetaData = stmt.getMetaData();
            if (rsMetaData != null) {
                for (int i = 1; i <= rsMetaData.getColumnCount(); i++) {
                    tableNames.add(rsMetaData.getTableName(i));
                }
            }
        } catch (Exception ignored) {
        }
        return tableNames;
    }
}

Related

  1. getPriorID(Connection conn, PreparedStatement stmt)
  2. getScalarValue(PreparedStatement ps)
  3. importCsvDataInTable(int offsetIndex, Connection connection, PreparedStatement preparedStatement, String[] columnMapping, List> data, Map> notInsertedData)
  4. intToArray(final int[] arr)
  5. isClosed(PreparedStatement ps, boolean defaultValue)
  6. LockRow(PreparedStatement pstmt, String tablename, boolean exclusiveMode)
  7. logPreparedStatement(PreparedStatement p)
  8. prepareStatement( Connection conn, String query, List params)
  9. prepareStatement(Connection con,String sql,Object...params)