public Reader getReader() { return new StringReader(getString()); }
private static long length(Value v) { switch (v.getType()) { case Value.BLOB: case Value.CLOB: case Value.BYTES: case Value.JAVA_OBJECT: return v.getPrecision(); default: return v.getString().length(); } }
private Character getEscapeChar(Value e) { if (e == null) { return getEscapeChar(defaultEscape); } String es = e.getString(); Character esc; if (es == null) { esc = getEscapeChar(defaultEscape); } else if (es.length() == 0) { esc = null; } else if (es.length() > 1) { throw DbException.get(ErrorCode.LIKE_ESCAPE_ERROR_1, es); } else { esc = es.charAt(0); } return esc; }
@Override protected int compareSecure(Value v, CompareMode mode) { if (type == Value.CLOB) { return Integer.signum(getString().compareTo(v.getString())); } byte[] v2 = v.getBytesNoCopy(); return Utils.compareNotNullSigned(getBytes(), v2); }
@Override protected int compareSecure(Value v, CompareMode mode) { if (v instanceof ValueLobDb) { ValueLobDb v2 = (ValueLobDb) v; if (v == this) { return 0; } if (lobId == v2.lobId && small == null && v2.small == null) { return 0; } } if (type == Value.CLOB) { return Integer.signum(getString().compareTo(v.getString())); } byte[] v2 = v.getBytesNoCopy(); return Utils.compareNotNullSigned(getBytes(), v2); }
/** * Returns the value of the specified column as a String. * * @param columnLabel the column label * @return the value * @throws SQLException if the column is not found or if the result set is * closed */ @Override public String getString(String columnLabel) throws SQLException { try { debugCodeCall("getString", columnLabel); return get(columnLabel).getString(); } catch (Exception e) { throw logAndConvert(e); } }
/** * Returns the value of the specified column as a String. * * @param columnIndex (1,2,...) * @return the value * @throws SQLException if the column is not found or if the result set is * closed */ @Override public String getString(int columnIndex) throws SQLException { try { debugCodeCall("getString", columnIndex); return get(columnIndex).getString(); } catch (Exception e) { throw logAndConvert(e); } }
/** * Returns the value of the specified column as a String. * * @param columnIndex (1,2,...) * @return the value * @throws SQLException if the column is not found or if the result set is * closed */ @Override public String getNString(int columnIndex) throws SQLException { try { debugCodeCall("getNString", columnIndex); return get(columnIndex).getString(); } catch (Exception e) { throw logAndConvert(e); } }
/** * Returns the value of the specified column as a String. * * @param columnLabel the column label * @return the value * @throws SQLException if the column is not found or if the result set is * closed */ @Override public String getNString(String columnLabel) throws SQLException { try { debugCodeCall("getNString", columnLabel); return get(columnLabel).getString(); } catch (Exception e) { throw logAndConvert(e); } }
private String readString() { Expression expr = readExpression().optimize(session); if (!(expr instanceof ValueExpression)) { throw DbException.getSyntaxError(sqlCommand, parseIndex, "string"); } String s = expr.getValue(session).getString(); return s; }
/** * Returns the input stream. * * @return the input stream */ @Override public InputStream getAsciiStream() throws SQLException { try { debugCodeCall("getAsciiStream"); checkClosed(); String s = value.getString(); return IOUtils.getInputStreamFromString(s); } catch (Exception e) { throw logAndConvert(e); } }
@Override public String getString() { StatementBuilder buff = new StatementBuilder("("); for (Value v : values) { buff.appendExceptFirst(", "); buff.append(v.getString()); } return buff.append(')').toString(); }
/** * Returns the value of the specified column as an input stream. * * @param columnIndex (1,2,...) * @return the value * @throws SQLException if the column is not found or if the result set is * closed */ @Override public InputStream getAsciiStream(int columnIndex) throws SQLException { try { debugCodeCall("getAsciiStream", columnIndex); String s = get(columnIndex).getString(); return s == null ? null : IOUtils.getInputStreamFromString(s); } catch (Exception e) { throw logAndConvert(e); } }
/** * Returns the value of the specified column as an input stream. * * @param columnLabel the column label * @return the value * @throws SQLException if the column is not found or if the result set is * closed */ @Override public InputStream getAsciiStream(String columnLabel) throws SQLException { try { debugCodeCall("getAsciiStream", columnLabel); String s = get(columnLabel).getString(); return IOUtils.getInputStreamFromString(s); } catch (Exception e) { throw logAndConvert(e); } }
@Override public String getString() { try { StatementBuilder buff = new StatementBuilder("("); result.beforeFirst(); ResultSetMetaData meta = result.getMetaData(); int columnCount = meta.getColumnCount(); for (int i = 0; result.next(); i++) { if (i > 0) { buff.append(", "); } buff.append('('); buff.resetCount(); for (int j = 0; j < columnCount; j++) { buff.appendExceptFirst(", "); int t = DataType.getValueTypeFromResultSet(meta, j + 1); Value v = DataType.readValue(result, j + 1, t); buff.append(v.getString()); } buff.append(')'); } result.beforeFirst(); return buff.append(')').toString(); } catch (SQLException e) { throw DbException.convert(e); } }
for (int i = 0; i < columnCount; i++) { Value value = v[i]; rowPacket.data.add(value.getString());
case Value.STRING_FIXED: case Value.STRING_IGNORECASE: String string = value.getString(); long hash = hash(string, 0, string.length()); return partitionUtil.partition(hash);
case Value.STRING_FIXED: case Value.STRING_IGNORECASE: String string = value.getString(); bytes = string.getBytes(); default: