Java SQL ResultSet String Read getString(ResultSet rs, String name, String ifnull)

Here you can find the source of getString(ResultSet rs, String name, String ifnull)

Description

get String

License

Apache License

Declaration

public static String getString(ResultSet rs, String name, String ifnull) throws SQLException 

Method Source Code

//package com.java2s;
/*//from   w w  w. java  2 s.c om
 * Copyright (c) Jim Coles (jameskcoles@gmail.com) 2018 through present.
 *
 * Licensed under the following license agreement:
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Also see the LICENSE file in the repository root directory.
 */

import java.sql.*;

public class Main {
    public static String getString(ResultSet rs, String name, String ifnull) throws SQLException {
        String val = rs.getString(name);
        return ((val != null) ? val : ifnull);
    }
}

Related

  1. getString(ResultSet rs, int ix, int sql_type)
  2. getString(ResultSet rs, String column)
  3. getString(ResultSet rs, String columnLabel)
  4. getString(ResultSet rs, String columnName)
  5. getString(ResultSet rs, String name)
  6. getStringChunks(ResultSet rs, int colIndex, StringBuffer buf)
  7. getStringFromResultSetEmptyIsNull(ResultSet rset, String fieldName)
  8. getStringList(ResultSet resultSet, String columnName)
  9. getStringSuppressSQLException(final ResultSet rs, final String columnLabel)