ResultSet.getBoolean
Code IndexAdd Codota to your IDE (free)

Best code snippets using java.sql.ResultSet.getBoolean(Showing top 20 results out of 2,574)

Refine search

  • ResultSet.getString
  • ResultSet.getInt
  • ResultSet.next
  • ResultSet.getLong
  • ResultSet.getTimestamp
  • Common ways to obtain ResultSet
private void myMethod () {
ResultSet r =
  • PreparedStatement ps;ps.executeQuery()
  • Statement stmt;stmt.executeQuery(sql)
  • Statement statement;statement.getResultSet()
  • AI code suggestions by Codota
}
origin: prestodb/presto

  @Override
  public Table map(int index, ResultSet r, StatementContext ctx)
      throws SQLException
  {
    return new Table(
        r.getLong("table_id"),
        getOptionalLong(r, "distribution_id"),
        Optional.ofNullable(r.getString("distribution_name")),
        getOptionalInt(r, "bucket_count"),
        getOptionalLong(r, "temporal_column_id"),
        r.getBoolean("organization_enabled"));
  }
}
origin: prestodb/presto

  @Override
  public TableMetadataRow map(int index, ResultSet rs, StatementContext context)
      throws SQLException
  {
    return new TableMetadataRow(
        rs.getLong("table_id"),
        rs.getString("schema_name"),
        rs.getString("table_name"),
        getOptionalLong(rs, "temporal_column_id"),
        Optional.ofNullable(rs.getString("distribution_name")),
        getOptionalInt(rs, "bucket_count"),
        rs.getBoolean("organization_enabled"));
  }
}
origin: prestodb/presto

private static Object getValue(ResultSet resultSet, Type type, String columnName, JDBCType jdbcType)
    throws SQLException
{
  switch (jdbcType) {
    case BOOLEAN:
      return resultSet.getBoolean(columnName);
    case INTEGER:
      return resultSet.getInt(columnName);
    case BIGINT:
      return resultSet.getLong(columnName);
    case DOUBLE:
      return resultSet.getDouble(columnName);
    case VARBINARY:
      return wrappedBuffer(resultSet.getBytes(columnName)).toStringUtf8();
  }
  throw new IllegalArgumentException("Unhandled type: " + type);
}
origin: prestodb/presto

  @Override
  public TableColumn map(int index, ResultSet r, StatementContext ctx)
      throws SQLException
  {
    SchemaTableName table = new SchemaTableName(
        r.getString("schema_name"),
        r.getString("table_name"));
    String typeName = r.getString("data_type");
    Type type = typeManager.getType(parseTypeSignature(typeName));
    checkArgument(type != null, "Unknown type %s", typeName);
    return new TableColumn(
        table,
        r.getString("column_name"),
        type,
        r.getLong("column_id"),
        getOptionalInt(r, "bucket_ordinal_position"),
        getOptionalInt(r, "sort_ordinal_position"),
        r.getBoolean("temporal"));
  }
}
origin: elasticjob/elastic-job-lite

private List<JobExecutionEvent> getJobExecutionEvents(final Condition condition) {
  List<JobExecutionEvent> result = new LinkedList<>();
  try (
      Connection conn = dataSource.getConnection();
      PreparedStatement preparedStatement = createDataPreparedStatement(conn, TABLE_JOB_EXECUTION_LOG, FIELDS_JOB_EXECUTION_LOG, condition);
      ResultSet resultSet = preparedStatement.executeQuery()
      ) {
    while (resultSet.next()) {
      JobExecutionEvent jobExecutionEvent = new JobExecutionEvent(resultSet.getString(1), resultSet.getString(2), resultSet.getString(3), resultSet.getString(4),
          resultSet.getString(5), JobExecutionEvent.ExecutionSource.valueOf(resultSet.getString(6)), Integer.valueOf(resultSet.getString(7)), 
          new Date(resultSet.getTimestamp(8).getTime()), resultSet.getTimestamp(9) == null ? null : new Date(resultSet.getTimestamp(9).getTime()), 
          resultSet.getBoolean(10), new JobExecutionEventThrowable(null, resultSet.getString(11)) 
          );
      result.add(jobExecutionEvent);
    }
  } catch (final SQLException ex) {
    // TODO 记录失败直接输出日志,未来可考虑配置化
    log.error("Fetch JobExecutionEvent from DB error:", ex);
  }
  return result;
}

origin: com.h2database/h2

private String getDefaultSchemaName(DatabaseMetaData meta) {
  String defaultSchemaName = "";
  try {
    if (isOracle) {
      return meta.getUserName();
    } else if (isPostgreSQL) {
      return "public";
    } else if (isMySQL) {
      return "";
    } else if (isDerby) {
      return StringUtils.toUpperEnglish(meta.getUserName());
    } else if (isFirebird) {
      return null;
    }
    ResultSet rs = meta.getSchemas();
    int index = rs.findColumn("IS_DEFAULT");
    while (rs.next()) {
      if (rs.getBoolean(index)) {
        defaultSchemaName = rs.getString("TABLE_SCHEM");
      }
    }
  } catch (SQLException e) {
    // IS_DEFAULT not found
  }
  return defaultSchemaName;
}
origin: shardingjdbc/sharding-jdbc

  result = getCurrentResultSet().getObject(columnLabel);
} else if (boolean.class == type) {
  result = getCurrentResultSet().getBoolean(columnLabel);
} else if (byte.class == type) {
  result = getCurrentResultSet().getByte(columnLabel);
  result = getCurrentResultSet().getShort(columnLabel);
} else if (int.class == type) {
  result = getCurrentResultSet().getInt(columnLabel);
} else if (long.class == type) {
  result = getCurrentResultSet().getLong(columnLabel);
} else if (float.class == type) {
  result = getCurrentResultSet().getFloat(columnLabel);
  result = getCurrentResultSet().getDouble(columnLabel);
} else if (String.class == type) {
  result = getCurrentResultSet().getString(columnLabel);
} else if (BigDecimal.class == type) {
  result = getCurrentResultSet().getBigDecimal(columnLabel);
  result = getCurrentResultSet().getTime(columnLabel);
} else if (Timestamp.class == type) {
  result = getCurrentResultSet().getTimestamp(columnLabel);
} else if (URL.class == type) {
  result = getCurrentResultSet().getURL(columnLabel);
origin: apache/storm

try (ResultSet resultSet = preparedStatement.executeQuery()) {
  List<List<Column>> rows = Lists.newArrayList();
  while (resultSet.next()) {
    ResultSetMetaData metaData = resultSet.getMetaData();
    int columnCount = metaData.getColumnCount();
        row.add(new Column<Short>(columnLabel, resultSet.getShort(columnLabel), columnType));
      } else if (columnJavaType.equals(Boolean.class)) {
        row.add(new Column<Boolean>(columnLabel, resultSet.getBoolean(columnLabel), columnType));
      } else if (columnJavaType.equals(byte[].class)) {
        row.add(new Column<byte[]>(columnLabel, resultSet.getBytes(columnLabel), columnType));
      } else if (columnJavaType.equals(Long.class)) {
        row.add(new Column<Long>(columnLabel, resultSet.getLong(columnLabel), columnType));
      } else if (columnJavaType.equals(Date.class)) {
        row.add(new Column<Date>(columnLabel, resultSet.getDate(columnLabel), columnType));
        row.add(new Column<Time>(columnLabel, resultSet.getTime(columnLabel), columnType));
      } else if (columnJavaType.equals(Timestamp.class)) {
        row.add(new Column<Timestamp>(columnLabel, resultSet.getTimestamp(columnLabel), columnType));
      } else {
        throw new RuntimeException("type =  " + columnType + " for column " + columnLabel + " not supported.");
origin: prestodb/presto

booleans[i] = resultSet.getBoolean(i + 1);
nulls[i] = resultSet.wasNull();
if (!nulls[i]) {
longs[i] = resultSet.getLong(i + 1);
nulls[i] = resultSet.wasNull();
if (!nulls[i]) {
  long value = resultSet.getLong(i + 1);
  nulls[i] = resultSet.wasNull();
  strings[i] = nulls[i] ? null : format("%016x", value);
  String value = resultSet.getString(i + 1);
  nulls[i] = resultSet.wasNull();
  strings[i] = nulls[i] ? null : value;
origin: prestodb/presto

  throws SQLException
long id = resultSet.getLong("resource_group_id");
ResourceGroupNameTemplate nameTemplate = new ResourceGroupNameTemplate(resultSet.getString("name"));
String softMemoryLimit = resultSet.getString("soft_memory_limit");
int maxQueued = resultSet.getInt("max_queued");
Optional<Integer> softConcurrencyLimit = Optional.of(resultSet.getInt("soft_concurrency_limit"));
if (resultSet.wasNull()) {
  softConcurrencyLimit = Optional.empty();
int hardConcurrencyLimit = resultSet.getInt("hard_concurrency_limit");
Optional<String> schedulingPolicy = Optional.ofNullable(resultSet.getString("scheduling_policy"));
Optional<Integer> schedulingWeight = Optional.of(resultSet.getInt("scheduling_weight"));
if (resultSet.wasNull()) {
  schedulingWeight = Optional.empty();
Optional<Boolean> jmxExport = Optional.of(resultSet.getBoolean("jmx_export"));
if (resultSet.wasNull()) {
  jmxExport = Optional.empty();
Optional<String> softCpuLimit = Optional.ofNullable(resultSet.getString("soft_cpu_limit"));
Optional<String> hardCpuLimit = Optional.ofNullable(resultSet.getString("hard_cpu_limit"));
Optional<Long> parentId = Optional.of(resultSet.getLong("parent"));
if (resultSet.wasNull()) {
  parentId = Optional.empty();
origin: org.hibernate/hibernate-core

final ResultSet resultSet = metaData.getTypeInfo();
try {
  while ( resultSet.next() ) {
    typeInfoSet.add(
        new TypeInfo(
            resultSet.getString( "TYPE_NAME" ),
            resultSet.getInt( "DATA_TYPE" ),
            interpretCreateParams( resultSet.getString( "CREATE_PARAMS" ) ),
            resultSet.getBoolean( "UNSIGNED_ATTRIBUTE" ),
            resultSet.getInt( "PRECISION" ),
            resultSet.getShort( "MINIMUM_SCALE" ),
            resultSet.getShort( "MAXIMUM_SCALE" ),
            resultSet.getBoolean( "FIXED_PREC_SCALE" ),
            resultSet.getString( "LITERAL_PREFIX" ),
            resultSet.getString( "LITERAL_SUFFIX" ),
            resultSet.getBoolean( "CASE_SENSITIVE" ),
            TypeSearchability.interpret( resultSet.getShort( "SEARCHABLE" ) ),
            TypeNullability.interpret( resultSet.getShort( "NULLABLE" ) )
origin: mysql/mysql-connector-java

if (rs.next()) {
  this.autoCommit = rs.getBoolean(1);
  if (this.autoCommit != true) {
    overrideDefaultAutocommit = true;
origin: com.h2database/h2

while (rs.next()) {
  String name = rs.getString("INDEX_NAME");
  IndexInfo info = indexMap.get(name);
  if (info == null) {
    int t = rs.getInt("TYPE");
    String type;
    if (t == DatabaseMetaData.tableIndexClustered) {
      info = new IndexInfo();
      info.name = name;
      type = (rs.getBoolean("NON_UNIQUE") ?
          "${text.tree.nonUnique}" : "${text.tree.unique}") + type;
      info.type = type;
      info.columns = rs.getString("COLUMN_NAME");
      indexMap.put(name, info);
    info.columns += ", " + rs.getString("COLUMN_NAME");
origin: prestodb/presto

Type type = types.get(i - 1);
if (BOOLEAN.equals(type)) {
  boolean booleanValue = resultSet.getBoolean(i);
  if (resultSet.wasNull()) {
    row.add(null);
  int intValue = resultSet.getInt(i);
  if (resultSet.wasNull()) {
    row.add(null);
  long longValue = resultSet.getLong(i);
  if (resultSet.wasNull()) {
    row.add(null);
  String stringValue = resultSet.getString(i);
  if (resultSet.wasNull()) {
    row.add(null);
  String stringValue = resultSet.getString(i);
  if (resultSet.wasNull()) {
    row.add(null);
  Timestamp timestampValue = resultSet.getTimestamp(i);
  if (resultSet.wasNull()) {
    row.add(null);
origin: com.h2database/h2

boolean value = rs.getBoolean(columnIndex);
v = rs.wasNull() ? (Value) ValueNull.INSTANCE :
  ValueBoolean.get(value);
Timestamp value = rs.getTimestamp(columnIndex);
v = value == null ? (Value) ValueNull.INSTANCE :
  ValueTimestamp.get(value);
int value = rs.getInt(columnIndex);
v = rs.wasNull() ? (Value) ValueNull.INSTANCE :
  ValueInt.get(value);
long value = rs.getLong(columnIndex);
v = rs.wasNull() ? (Value) ValueNull.INSTANCE :
  ValueLong.get(value);
String s = rs.getString(columnIndex);
v = (s == null) ? (Value) ValueNull.INSTANCE :
  ValueStringIgnoreCase.get(s);
String s = rs.getString(columnIndex);
v = (s == null) ? (Value) ValueNull.INSTANCE :
  ValueStringFixed.get(s);
String s = rs.getString(columnIndex);
v = (s == null) ? (Value) ValueNull.INSTANCE :
  ValueString.get(s);
origin: com.h2database/h2

supportsMixedCaseIdentifiers = meta.supportsMixedCaseIdentifiers();
ResultSet rs = meta.getTables(null, originalSchema, originalTable, null);
if (rs.next() && rs.next()) {
  throw DbException.get(ErrorCode.SCHEMA_NAME_MUST_MATCH, originalTable);
HashMap<String, Column> columnMap = new HashMap<>();
String catalog = null, schema = null;
while (rs.next()) {
  String thisCatalog = rs.getString("TABLE_CAT");
  if (catalog == null) {
    catalog = thisCatalog;
  String thisSchema = rs.getString("TABLE_SCHEM");
  if (schema == null) {
    schema = thisSchema;
    break;
      list.clear();
    boolean unique = !rs.getBoolean("NON_UNIQUE");
    indexType = unique ? IndexType.createUnique(false, false) :
        IndexType.createNonUnique(false);
origin: shardingjdbc/sharding-jdbc

  result = getCurrentResultSet().getObject(columnIndex);
} else if (boolean.class == type) {
  result = getCurrentResultSet().getBoolean(columnIndex);
} else if (byte.class == type) {
  result = getCurrentResultSet().getByte(columnIndex);
  result = getCurrentResultSet().getShort(columnIndex);
} else if (int.class == type) {
  result = getCurrentResultSet().getInt(columnIndex);
} else if (long.class == type) {
  result = getCurrentResultSet().getLong(columnIndex);
} else if (float.class == type) {
  result = getCurrentResultSet().getFloat(columnIndex);
  result = getCurrentResultSet().getDouble(columnIndex);
} else if (String.class == type) {
  result = getCurrentResultSet().getString(columnIndex);
} else if (BigDecimal.class == type) {
  result = getCurrentResultSet().getBigDecimal(columnIndex);
  result = getCurrentResultSet().getTime(columnIndex);
} else if (Timestamp.class == type) {
  result = getCurrentResultSet().getTimestamp(columnIndex);
} else if (URL.class == type) {
  result = getCurrentResultSet().getURL(columnIndex);
origin: SonarSource/sonarqube

 @Override
 public ColumnIndex convert(ResultSet rs) throws SQLException {
  return new ColumnIndex(rs.getString(1), rs.getBoolean(2), rs.getString(3));
 }
}
origin: nutzam/nutz

public Object invoke(Connection conn, ResultSet rs, Sql sql) throws SQLException {
  List<Boolean> list = new LinkedList<Boolean>();
  if (null != rs && rs.next())
    list.add(rs.getBoolean(1));
  boolean[] array = new boolean[list.size()];
  for (int i = 0; i < array.length; i++) {
    array[i] = list.get(i);
  }
  return array;
}
origin: SonarSource/sonarqube

private void assertIndexImpl(String tableName, String indexName, boolean expectedUnique, String expectedColumn, String... expectedSecondaryColumns) {
 try (Connection connection = getConnection();
  ResultSet rs = connection.getMetaData().getIndexInfo(null, null, tableName.toUpperCase(Locale.ENGLISH), false, false)) {
  List<String> onColumns = new ArrayList<>();
  while (rs.next()) {
   if (indexName.equalsIgnoreCase(rs.getString("INDEX_NAME"))) {
    assertThat(rs.getBoolean("NON_UNIQUE")).isEqualTo(!expectedUnique);
    int position = rs.getInt("ORDINAL_POSITION");
    onColumns.add(position - 1, rs.getString("COLUMN_NAME").toLowerCase(Locale.ENGLISH));
   }
  }
  assertThat(asList(expectedColumn, expectedSecondaryColumns)).isEqualTo(onColumns);
 } catch (SQLException e) {
  throw new IllegalStateException("Fail to check index", e);
 }
}
java.sqlResultSetgetBoolean

Javadoc

Retrieves the value of the designated column in the current row of this ResultSet object as a boolean in the Java programming language.

If the designated column has a datatype of CHAR or VARCHAR and contains a "0" or has a datatype of BIT, TINYINT, SMALLINT, INTEGER or BIGINT and contains a 0, a value of false is returned. If the designated column has a datatype of CHAR or VARCHAR and contains a "1" or has a datatype of BIT, TINYINT, SMALLINT, INTEGER or BIGINT and contains a 1, a value of true is returned.

Popular methods of ResultSet

  • next
    Shifts the cursor position down one row in this ResultSet object. Any input streams associated with
  • getString
    Gets the value of a column specified by column name, as a String.
  • close
    Releases this ResultSet's database and JDBC resources. You are strongly advised to use this method r
  • getInt
    Gets the value of a column specified by column name, as an intvalue.
  • getLong
    Gets the value of a column specified by column name, as a longvalue.
  • getMetaData
    Gets the metadata for this ResultSet. This defines the number, types and properties of the columns i
  • getObject
    Gets the value of a column specified by column name as a Java Object. The type of the Java object wi
  • getTimestamp
    Gets the value of a column specified by column name, as a java.sql.Timestamp value. The supplied Cal
  • getBytes
    Gets the value of a column specified by column name as a byte array.
  • getDouble
    Gets the value of a column specified by column name as a doublevalue.
  • wasNull
    Determines whether the last column read from this ResultSetcontained SQL NULL.
  • getDate
    Gets the value of a column specified by column name, as a java.sql.Date object.
  • wasNull,
  • getDate,
  • getFloat,
  • getShort,
  • getBlob,
  • getTime,
  • getBigDecimal,
  • getBinaryStream,
  • getByte

Popular classes and methods

  • scheduleAtFixedRate (Timer)
    Schedules the specified task for repeated fixed-rate execution, beginning after the specified delay.
  • setRequestProperty (URLConnection)
    Sets the value of the specified request header field. The value will only be used by the current URL
  • setScale (BigDecimal)
    Returns a new BigDecimal instance with the specified scale. If the new scale is greater than the old
  • InputStreamReader (java.io)
    A class for turning a byte stream into a character stream. Data read from the source input stream is
  • MalformedURLException (java.net)
    Thrown to indicate that a malformed URL has occurred. Either no legal protocol could be found in a s
  • Arrays (java.util)
    This class contains various methods for manipulating arrays (such as sorting and searching). This cl
  • TreeSet (java.util)
    TreeSet is an implementation of SortedSet. All optional operations (adding and removing) are support
  • SSLHandshakeException (javax.net.ssl)
    The exception that is thrown when a handshake could not be completed successfully.
  • JComboBox (javax.swing)
  • Option (scala)

For IntelliJ IDEA and
Android Studio

  • Codota IntelliJ IDEA pluginCodota Android Studio pluginCode IndexSign in
  • EnterpriseFAQAboutContact Us
  • Terms of usePrivacy policyCodeboxFind Usages
Add Codota to your IDE (free)