Package org.adbcj.support

Examples of org.adbcj.support.DefaultField


          int columnCount = metaData.getColumnCount();
          List<Field> fields = new ArrayList<Field>(columnCount);
          eventHandler.startFields(accumulator);
         
          for (int i = 1; i <= columnCount; i++) {
            Field field = new DefaultField(
                i - 1,
                metaData.getCatalogName(i),
                metaData.getSchemaName(i),
                metaData.getTableName(i),
                metaData.getTableName(i),
                Type.fromJdbcType(metaData.getColumnType(i)),
                metaData.getColumnLabel(i),
                metaData.getCatalogName(i),
                metaData.getPrecision(i),
                metaData.getScale(i),
                metaData.isAutoIncrement(i),
                metaData.isCaseSensitive(i),
                metaData.isCurrency(i),
                metaData.isDefinitelyWritable(i),
                metaData.isNullable(i) == 1,
                metaData.isReadOnly(i),
                metaData.isSearchable(i),
                metaData.isSigned(i),
                metaData.isWritable(i),
                metaData.getColumnClassName(i)
                );
            fields.add(field);
            eventHandler.field(field, accumulator);
          }
         
          eventHandler.endFields(accumulator);
         
          eventHandler.startResults(accumulator);
          while (jdbcResultSet.next()) {
            eventHandler.startRow(accumulator);
            for (int i = 1; i <= columnCount; i++) {
              Field field = fields.get(i - 1);
              Object value = null;
              switch (field.getColumnType()) {
              case BIGINT:
                value = jdbcResultSet.getLong(i);
                break;
              case INTEGER:
                value = jdbcResultSet.getInt(i);
                break;
              case VARCHAR:
                value = jdbcResultSet.getString(i);
                break;
              default:
                throw new IllegalStateException("Don't know how to handle field to type " + field.getColumnType());
              }
              if (jdbcResultSet.wasNull()) {
                value = null;
              }
              eventHandler.value(new DefaultValue(field, value), accumulator);
View Full Code Here

TOP

Related Classes of org.adbcj.support.DefaultField

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.