Gets the value in the given array whose associated column name matches
the given uniqueColumn name.

@throws SQLException
if the uniqueColumn doesn't exist in the given column array.
436151
private String getSelector(String[] columns,
                               String[] values,
                               String uniqueColumn) throws SQLException {
        String selector = null;
        for (int i = 0; i < columns.length; i++) {
            if (columns[i].equals(uniqueColumn)) {
                selector = values[i];
            }
        }
        if (selector != null) {
            return selector;
        } else {
            throw new SQLException("Unique column does not exist in given "
                    + "column array");
        }
    }
515478
public Object getValue(final JavaType type, final ResultSet rs, final int columnIndex) throws SQLException {
		Class<?> rawType = type.getRawType();
		for (PropertyMapper<?> propertyMapper : this.mappers) {
			if (propertyMapper.canAccept(rawType) && propertyMapper.canAcceptTest(type, rs, columnIndex, this)) {
				return propertyMapper.getValue(type, rs, columnIndex, this);
			}
		}

		if (String.class.equals(rawType)) {
			return rs.getString(columnIndex);
		}
		if (Boolean.class.equals(rawType)) {
			boolean result = rs.getBoolean(columnIndex);
			if (rs.wasNull()) {
				return null;
			}
			return result;
		}
		if (boolean.class.equals(rawType)) {
			return rs.getBoolean(columnIndex);
		}
		if (Byte.class.equals(rawType)) {
			byte result = rs.getByte(columnIndex);
			if (rs.wasNull()) {
				return null;
			}
			return result;
		}
		if (byte.class.equals(rawType)) {
			return rs.getByte(columnIndex);
		}
		if (Short.class.equals(rawType)) {
			short result = rs.getShort(columnIndex);
			if (rs.wasNull()) {
				return null;
			}
			return result;
		}
		if (short.class.equals(rawType)) {
			return rs.getShort(columnIndex);
		}
		if (Integer.class.equals(rawType)) {
			int result = rs.getInt(columnIndex);
			if (rs.wasNull()) {
				return null;
			}
			return result;
		}
		if (int.class.equals(rawType)) {
			return rs.getInt(columnIndex);
		}
		if (Long.class.equals(rawType)) {
			long result = rs.getLong(columnIndex);
			if (rs.wasNull()) {
				return null;
			}
			return result;
		}
		if (long.class.equals(rawType)) {
			return rs.getLong(columnIndex);
		}
		if (Float.class.equals(rawType)) {
			float result = rs.getFloat(columnIndex);
			if (rs.wasNull()) {
				return null;
			}
			return result;
		}
		if (float.class.equals(rawType)) {
			return rs.getFloat(columnIndex);
		}
		if (Double.class.equals(rawType)) {
			double result = rs.getDouble(columnIndex);
			if (rs.wasNull()) {
				return null;
			}
			return result;
		}
		if (double.class.equals(rawType)) {
			return rs.getDouble(columnIndex);
		}
		if (BigDecimal.class.equals(rawType)) {
			return rs.getBigDecimal(columnIndex);
		}
		if (byte[].class.equals(rawType)) {
			return rs.getBytes(columnIndex);
		}
		if (java.sql.Timestamp.class.equals(rawType)) {
			return rs.getTimestamp(columnIndex);
		}
		if (java.sql.Time.class.equals(rawType)) {
			return rs.getTime(columnIndex);
		}
		if (java.sql.Date.class.equals(rawType)) {
			return rs.getDate(columnIndex);
		}
		if (Date.class.equals(rawType)) {
			return rs.getTimestamp(columnIndex);
		}
		if (java.sql.Array.class.equals(rawType)) {
			return rs.getArray(columnIndex);
		}
		if (java.sql.Blob.class.equals(rawType)) {
			return rs.getBlob(columnIndex);
		}
		if (java.sql.Clob.class.equals(rawType)) {
			return rs.getClob(columnIndex);
		}
		if (java.sql.NClob.class.equals(rawType)) {
			return rs.getNClob(columnIndex);
		}
		if (java.sql.Ref.class.equals(rawType)) {
			return rs.getRef(columnIndex);
		}
		if (java.sql.SQLXML.class.equals(rawType)) {
			return rs.getSQLXML(columnIndex);
		}
		for (PropertyMapper<?> propertyMapper : DEFAULT_MAPPERS) {
			if (propertyMapper.canAccept(rawType) && propertyMapper.canAcceptTest(type, rs, columnIndex, this)) {
				return propertyMapper.getValue(type, rs, columnIndex, this);
			}
		}
		return rs.getObject(columnIndex);
	}
1137488
private String[] remove(String name, String[] defaultValue) throws SQLException {
        String[] value = null;

        for (int diff; value == null && entry != null && (diff = entry.getKey().compareTo(name)) <= 0; entry = entries.pollFirstEntry()) {
            if (diff == 0) // matched
                value = entry.getValue() instanceof String[] ? (String[]) entry.getValue() : new String[] { (String) entry.getValue() };
            else {
                // TODO: when we have a stricter variant of onError, apply it to unrecognized attributes
                if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                    Tr.debug(this, tc, "unrecognized attribute: " + entry.getKey());
                //SQLException ex = AdapterUtil.ignoreWarnOrFail(tc, null, SQLException.class, "PROP_NOT_FOUND", jndiName == null ? id : jndiName, entry.getKey());
                //if (ex != null)
                //    throw ex;
            }
        }

        return value == null ? defaultValue : value;
    }
726577
@Override
	public int update(Extensions extensions) throws SQLException {

		UpdateBuilder<Extensions, Void> ub = updateBuilder();
		ub.updateColumnValue(Extensions.COLUMN_DEFINITION,
				extensions.getDefinition());
		ub.updateColumnValue(Extensions.COLUMN_SCOPE, extensions.getScope()
				.getValue());

		setUniqueWhere(ub.where(), extensions.getExtensionName(), true,
				extensions.getTableName(), true, extensions.getColumnName());

		PreparedUpdate<Extensions> update = ub.prepare();
		int updated = update(update);

		return updated;
	}
1158913
@Override
    public <E> List<E> getColumnsById(String schemaName, String joinTableName, String joinColumnName,
            String inverseJoinColumnName, Object parentId, Class columnJavaType)
    {
        StringBuffer sqlQuery = new StringBuffer();
        sqlQuery.append("SELECT ").append(inverseJoinColumnName).append(" FROM ")
                .append(getFromClause(schemaName, joinTableName)).append(" WHERE ").append(joinColumnName).append("='")
                .append(parentId).append("'");

        Session s = getSession();

        SQLQuery query = s.createSQLQuery(sqlQuery.toString());

        List<E> foreignKeys = new ArrayList<E>();

        foreignKeys = query.list();

        return foreignKeys;
    }
1286784
public static boolean columnExist(CSTable table, String name) {
        for (int i = 1; i <= table.getColumnCount(); i++) {
            if (table.getColumnName(i).startsWith(name)) {
                return true;
            }
        }
        return false;
    }
553133
public static int findRowIdColumnIndex(String[] columnNames) {
        int length = columnNames.length;
        for (int i = 0; i < length; i++) {
            if (columnNames[i].equals("_id")) {
                return i;
            }
        }
        return -1;
    }
51111
@Override
  public int[] columns(String[] names) {
    int[] idxs = new int[_strs.length];
    for (int i = 0; i < _strs.length; i++) {
      int idx = idxs[i] = water.util.ArrayUtils.find(names, _strs[i]);
      if (idx == -1) throw new IllegalArgumentException("Column " + _strs[i] + " not found");
    }
    return idxs;
  }
1077405
public Object getValueAt(int row, int col) {

        if (row >= rows.size()) {
            return null;
        }

        Object[] colArray = (Object[]) rows.elementAt(row);

        if (col >= colArray.length) {
            return null;
        }

        return colArray[col];
    }
363797
public <T> T resultToJava(DatabaseResults results, Map<String, Integer> columnPositions) throws SQLException {
		Integer dbColumnPos = columnPositions.get(columnName);
		if (dbColumnPos == null) {
			dbColumnPos = results.findColumn(columnName);
			columnPositions.put(columnName, dbColumnPos);
		}

		/*
		 * Subtle problem here. If the field is a foreign-field and/or a primitive and the value was null then we get 0
		 * from results.getInt() which mirrors the ResultSet. We have to specifically test to see if we have a null
		 * result with results.wasNull(...) afterwards so we return a null value to not create the sub-object or turn a
		 * Integer field into 0 instead of null.
		 * 
		 * But this presents a limitation. Sometimes people want to convert a result field value that is stored in the
		 * database as null into a non-null value when it comes out of the database. There is no way to do that because
		 * of the results.wasNull(...) checks after the fact then override the non-null value from the converter.
		 */
		@SuppressWarnings("unchecked")
		T converted = (T) fieldConverter.resultToJava(this, results, dbColumnPos);
		if (fieldConfig.isForeign()) {
			/*
			 * If your foreign field is a primitive and the value was null then this would return 0 from
			 * results.getInt(). We have to specifically test to see if we have a foreign field so if it is null we
			 * return a null value to not create the sub-object.
			 */
			if (results.wasNull(dbColumnPos)) {
				return null;
			}
		} else if (dataPersister.isPrimitive()) {
			if (fieldConfig.isThrowIfNull() && results.wasNull(dbColumnPos)) {
				throw new SQLException(
						"Results value for primitive field '" + field.getName() + "' was an invalid null value");
			}
		} else if (!fieldConverter.isStreamType() && results.wasNull(dbColumnPos)) {
			// we can't check if we have a null if this is a stream type
			return null;
		}
		return converted;
	}
563874
protected static ResultSet getColumnMetaData (Connection conn, String table, String column)
        throws SQLException
    {
        ResultSet rs = conn.getMetaData().getColumns("", "", table, column);
        while (rs.next()) {
            String tname = rs.getString("TABLE_NAME");
            String cname = rs.getString("COLUMN_NAME");
            if (tname.equals(table) && cname.equals(column)) {
                return rs;
            }
        }
        throw new SQLException("Table or Column not defined. [table=" + table +
                               ", col=" + column + "].");
    }
186353
public Where<T, ID> ge(String columnName, Object value) throws SQLException {
		addClause(new SimpleComparison(columnName, findColumnFieldType(columnName), value,
				SimpleComparison.GREATER_THAN_EQUAL_TO_OPERATION));
		return this;
	}
880338
private Object[] findIdsByColumn(String tableName, String columnName, Object columnValue)
    {
        Object connection = null;

        try
        {
            connection = getConnection();
            String valueAsStr = PropertyAccessorHelper.getString(columnValue);

            Set<String> results = null;

            if (resource != null && resource.isActive())
            {
                Response response = ((Transaction) connection).zrangeByScore(getHashKey(tableName, columnName),
                        getDouble(valueAsStr), getDouble(valueAsStr));
                // ((Transaction) connection).exec();
                ((RedisTransaction) resource).onExecute(((Transaction) connection));

                results = (Set<String>) response.get();
            }
            else
            {
                results = ((Jedis) connection).zrangeByScore(getHashKey(tableName, columnName), getDouble(valueAsStr),
                        getDouble(valueAsStr));

            }
            if (results != null)
            {
                return results.toArray(new Object[0]);
            }

        }
        finally
        {
            onCleanup(connection);
        }

        return null;
    }
771564
@Override
    public Object[] findIdsByColumn(String schemaName, String tableName, String pKeyName, String columnName,
            Object columnValue, Class entityClazz)
    {
        return getColumnsById(schemaName, tableName, columnName, pKeyName, columnValue, entityClazz).toArray();
    }
54006
public Where<T, ID> in(String columnName, Iterable<?> objects) throws SQLException {
		addClause(new In(columnName, findColumnFieldType(columnName), objects, true));
		return this;
	}
1190725
protected function fetchColumnValue($data, $columns)
    {
        if (is_string($columns)) {
            return Arr::get($data, $columns);
        }

        if (is_array($columns)) {
            $value = [];
            foreach ($columns as $name => $column) {
                if (!Arr::has($data, $column)) {
                    continue;
                }
                $value[$name] = Arr::get($data, $column);
            }

            return $value;
        }
    }
1250182
public int columnIndex(String columnName) {
        int columnIndex = -1;
        for (int i = 0; i < columnList.size(); i++) {
            if (columnList.get(i).name().equalsIgnoreCase(columnName)) {
                columnIndex = i;
                break;
            }
        }
        if (columnIndex == -1) {
            throw new IllegalArgumentException(String.format("Column %s is not present in table %s", columnName, name));
        }
        return columnIndex;
    }