Java SQL Table Column readString(final ResultSet resultSet, final String columnName)

Here you can find the source of readString(final ResultSet resultSet, final String columnName)

Description

Helper function that exists primarily to fool poedit to stop localizing column names.

License

Open Source License

Parameter

Parameter Description
resultSet The result set to read from.
columnName Name of the column to read.

Exception

Parameter Description
SQLException Thrown if the column could not be read.

Return

The string value read from the given column.

Declaration

public static String readString(final ResultSet resultSet, final String columnName) throws SQLException 

Method Source Code

//package com.java2s;
/*/*w  w  w . ja  va2  s  .co  m*/
Copyright 2015 Google Inc. All Rights Reserved.
    
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
    
http://www.apache.org/licenses/LICENSE-2.0
    
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

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

public class Main {
    /**
     * Helper function that exists primarily to fool poedit to stop localizing column names. This
     * function simply reads a string from a result set.
     *
     * @param resultSet The result set to read from.
     * @param columnName Name of the column to read.
     *
     * @return The string value read from the given column.
     *
     * @throws SQLException Thrown if the column could not be read.
     */
    public static String readString(final ResultSet resultSet, final String columnName) throws SQLException {
        return resultSet.getString(columnName);
    }
}

Related

  1. lookupColumnIndex(final ResultSetMetaData resultSetMetaData, final String columnName)
  2. lookupColumnIndex(ResultSetMetaData resultSetMetaData, String name)
  3. lookupColumnName(ResultSetMetaData resultSetMetaData, int columnIndex)
  4. printTableColumn(Connection conn, String sql)
  5. readMultiDouble(ResultSet resultSet, String columnName)
  6. readStringFromBlob(ResultSet resultSet, String columnLabel)
  7. resultSetAsCount(ResultSet rs, String countColumn)
  8. resultSetContainsColumn(ResultSet rs, String column)
  9. resultSetHasColumn(ResultSet rs, String sColumnName)