1.1 --- a/java/sql-dk/src/info/globalcode/sql/dk/formatting/ColumnsHeader.java Mon Dec 23 11:52:49 2013 +0100
1.2 +++ b/java/sql-dk/src/info/globalcode/sql/dk/formatting/ColumnsHeader.java Mon Dec 23 12:16:22 2013 +0100
1.3 @@ -27,13 +27,13 @@
1.4 * @author Ing. František Kučera (frantovo.cz)
1.5 */
1.6 public class ColumnsHeader {
1.7 -
1.8 +
1.9 private ResultSetMetaData metaData;
1.10 -
1.11 +
1.12 public ColumnsHeader(ResultSetMetaData metaData) {
1.13 this.metaData = metaData;
1.14 }
1.15 -
1.16 +
1.17 public int getColumnCount() {
1.18 try {
1.19 return metaData.getColumnCount();
1.20 @@ -41,16 +41,19 @@
1.21 throw new IllegalStateException("Error during getting column count.", e);
1.22 }
1.23 }
1.24 -
1.25 +
1.26 public List<ColumnDescriptor> getColumnDescriptors() {
1.27 try {
1.28 int count = metaData.getColumnCount();
1.29 List<ColumnDescriptor> list = new ArrayList<>(count);
1.30 -
1.31 +
1.32 for (int i = 1; i <= count; i++) {
1.33 ColumnDescriptor cd = new ColumnDescriptor();
1.34 +
1.35 cd.setFirstColumn(i == 1);
1.36 cd.setLastColumn(i == count);
1.37 + cd.setColumnNumber(i);
1.38 +
1.39 cd.setLabel(metaData.getColumnLabel(i));
1.40 cd.setName(metaData.getColumnName(i));
1.41 cd.setType(metaData.getColumnType(i));
1.42 @@ -58,7 +61,7 @@
1.43 /** TODO: more properties */
1.44 list.add(cd);
1.45 }
1.46 -
1.47 +
1.48 return list;
1.49 } catch (SQLException e) {
1.50 throw new IllegalStateException("Error during building column descriptors.", e);