private int findColumnIndex(String columnName) { for (int i = 0; i < columnCount; i++) { String col = result.getColumnName(i); if (col.equals(columnName)) { return i; } } return -1; }
/** * Returns the column name. * * @param column the column index (1,2,...) * @return the column name * @throws SQLException if the result set is closed or invalid */ @Override public String getColumnName(int column) throws SQLException { try { debugCodeCall("getColumnName", column); checkColumnIndex(column); return result.getColumnName(--column); } catch (Exception e) { throw logAndConvert(e); } }
private void appendColumnList(StatementBuilder buff, boolean set) { buff.resetCount(); for (int i = 0; i < columnCount; i++) { buff.appendExceptFirst(","); String col = result.getColumnName(i); buff.append(StringUtils.quoteIdentifier(col)); if (set) { buff.append("=? "); } } }
String colName = result.getColumnName(i); if (colName != null) { colName = StringUtils.toUpperEnglish(colName); for (int i = 0; i < columnCount; i++) { if (table.equalsIgnoreCase(result.getTableName(i)) && col.equalsIgnoreCase(result.getColumnName(i))) { return i + 1; if (columnLabel.equalsIgnoreCase(result.getColumnName(i))) { return i + 1;
/** * Write a result column to the given output. * * @param out the object to where to write the data * @param result the result * @param i the column index */ public static void writeColumn(Transfer out, ResultInterface result, int i) throws IOException { out.writeString(result.getAlias(i)); out.writeString(result.getSchemaName(i)); out.writeString(result.getTableName(i)); out.writeString(result.getColumnName(i)); out.writeInt(result.getColumnType(i)); out.writeLong(result.getColumnPrecision(i)); out.writeInt(result.getColumnScale(i)); out.writeInt(result.getDisplaySize(i)); out.writeBoolean(result.isAutoIncrement(i)); out.writeInt(result.getNullable(i)); }
private int findColumnIndex(String columnName) { for (int i = 0; i < columnCount; i++) { String col = result.getColumnName(i); if (col.equals(columnName)) { return i; } } return -1; }
private int findColumnIndex(String columnName) { for (int i = 0; i < columnCount; i++) { String col = result.getColumnName(i); if (col.equals(columnName)) { return i; } } return -1; }
private int getColumnIndex(String columnName) throws SQLException { for (int i = 0; i < columnCount; i++) { String col = result.getColumnName(i); if (col.equals(columnName)) { return i; } } throw Message.getSQLException(ErrorCode.COLUMN_NOT_FOUND_1, columnName); }
private void appendColumnList(StringBuffer buff, boolean set) { for (int i = 0; i < columnCount; i++) { if (i > 0) { buff.append(','); } String col = result.getColumnName(i); buff.append(StringUtils.quoteIdentifier(col)); if (set) { buff.append("=? "); } } }
private DataField[] getFields(Select select, DataField[] fields) { ArrayList<DataField> toReturn = new ArrayList<DataField>(); try { for (int i=0;i<select.getColumnCount();i++) { String name = select.queryMeta().getColumnName(i); if (name.equalsIgnoreCase("timed") || name.equalsIgnoreCase("pk") ) continue; String gsnType = null; for (int j=0;j<fields.length;j++) { if (fields[j].getName().equalsIgnoreCase(name)) { gsnType=fields[j].getType(); toReturn.add( new DataField(name,gsnType)); break; } } } return toReturn.toArray(new DataField[] {}); }catch (Exception e) { logger.debug(e.getMessage(),e); return new DataField[0]; } } private Select queryToSelect(String query) {
/** * Returns the column name. * * @param column the column index (1,2,...) * @return the column name * @throws SQLException if the result set is closed or invalid */ public String getColumnName(int column) throws SQLException { try { debugCodeCall("getColumnName", column); checkColumnIndex(column); return result.getColumnName(--column); } catch (Throwable e) { throw logAndConvert(e); } }
/** * Returns the column name. * * @param column the column index (1,2,...) * @return the column name * @throws SQLException if the result set is closed or invalid */ @Override public String getColumnName(int column) throws SQLException { try { debugCodeCall("getColumnName", column); checkColumnIndex(column); return result.getColumnName(--column); } catch (Exception e) { throw logAndConvert(e); } }
/** * Returns the column name. * * @param column the column index (1,2,...) * @return the column name * @throws SQLException if the result set is closed or invalid */ @Override public String getColumnName(int column) throws SQLException { try { debugCodeCall("getColumnName", column); checkColumnIndex(column); return result.getColumnName(--column); } catch (Exception e) { throw logAndConvert(e); } }
private void appendColumnList(StatementBuilder buff, boolean set) { buff.resetCount(); for (int i = 0; i < columnCount; i++) { buff.appendExceptFirst(","); String col = result.getColumnName(i); buff.append(StringUtils.quoteIdentifier(col)); if (set) { buff.append("=? "); } } }
private void appendColumnList(StatementBuilder buff, boolean set) { buff.resetCount(); for (int i = 0; i < columnCount; i++) { buff.appendExceptFirst(","); String col = result.getColumnName(i); buff.append(StringUtils.quoteIdentifier(col)); if (set) { buff.append("=? "); } } }
private static SimpleResultSet getSimpleResultSet(ResultInterface rs, int maxrows) { int columnCount = rs.getVisibleColumnCount(); SimpleResultSet simple = new SimpleResultSet(); simple.setAutoClose(false); for (int i = 0; i < columnCount; i++) { String name = rs.getColumnName(i); int sqlType = DataType.convertTypeToSQLType(rs.getColumnType(i)); int precision = MathUtils.convertLongToInt(rs.getColumnPrecision(i)); int scale = rs.getColumnScale(i); simple.addColumn(name, sqlType, precision, scale); } rs.reset(); for (int i = 0; i < maxrows && rs.next(); i++) { Object[] list = new Object[columnCount]; for (int j = 0; j < columnCount; j++) { list[j] = rs.currentRow()[j].getObject(); } simple.addRow(list); } return simple; }
private static SimpleResultSet getSimpleResultSet(ResultInterface rs, int maxrows) { int columnCount = rs.getVisibleColumnCount(); SimpleResultSet simple = new SimpleResultSet(); simple.setAutoClose(false); for (int i = 0; i < columnCount; i++) { String name = rs.getColumnName(i); int sqlType = DataType.convertTypeToSQLType(rs.getColumnType(i)); int precision = MathUtils.convertLongToInt(rs.getColumnPrecision(i)); int scale = rs.getColumnScale(i); simple.addColumn(name, sqlType, precision, scale); } rs.reset(); for (int i = 0; i < maxrows && rs.next(); i++) { Object[] list = new Object[columnCount]; for (int j = 0; j < columnCount; j++) { list[j] = rs.currentRow()[j].getObject(); } simple.addRow(list); } return simple; }
public static void writeColumn(Transfer out, ResultInterface result, int i) throws IOException { out.writeString(result.getAlias(i)); out.writeString(result.getSchemaName(i)); out.writeString(result.getTableName(i)); out.writeString(result.getColumnName(i)); out.writeInt(result.getColumnType(i)); out.writeLong(result.getColumnPrecision(i)); out.writeInt(result.getColumnScale(i)); out.writeInt(result.getDisplaySize(i)); out.writeBoolean(result.isAutoIncrement(i)); out.writeInt(result.getNullable(i)); } }
/** * Write a result column to the given output. * * @param out the object to where to write the data * @param result the result * @param i the column index */ public static void writeColumn(Transfer out, ResultInterface result, int i) throws IOException { out.writeString(result.getAlias(i)); out.writeString(result.getSchemaName(i)); out.writeString(result.getTableName(i)); out.writeString(result.getColumnName(i)); out.writeInt(result.getColumnType(i)); out.writeLong(result.getColumnPrecision(i)); out.writeInt(result.getColumnScale(i)); out.writeInt(result.getDisplaySize(i)); out.writeBoolean(result.isAutoIncrement(i)); out.writeInt(result.getNullable(i)); }
/** * Write a result column to the given output. * * @param out the object to where to write the data * @param result the result * @param i the column index */ public static void writeColumn(Transfer out, ResultInterface result, int i) throws IOException { out.writeString(result.getAlias(i)); out.writeString(result.getSchemaName(i)); out.writeString(result.getTableName(i)); out.writeString(result.getColumnName(i)); out.writeInt(result.getColumnType(i)); out.writeLong(result.getColumnPrecision(i)); out.writeInt(result.getColumnScale(i)); out.writeInt(result.getDisplaySize(i)); out.writeBoolean(result.isAutoIncrement(i)); out.writeInt(result.getNullable(i)); }