You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pivot.apache.org by gb...@apache.org on 2010/09/23 16:52:32 UTC

svn commit: r1000487 - /pivot/branches/1.5.x/core/src/org/apache/pivot/sql/ResultList.java

Author: gbrown
Date: Thu Sep 23 14:52:31 2010
New Revision: 1000487

URL: http://svn.apache.org/viewvc?rev=1000487&view=rev
Log:
Re-introduce includeNullValues property to ResultList.

Modified:
    pivot/branches/1.5.x/core/src/org/apache/pivot/sql/ResultList.java

Modified: pivot/branches/1.5.x/core/src/org/apache/pivot/sql/ResultList.java
URL: http://svn.apache.org/viewvc/pivot/branches/1.5.x/core/src/org/apache/pivot/sql/ResultList.java?rev=1000487&r1=1000486&r2=1000487&view=diff
==============================================================================
--- pivot/branches/1.5.x/core/src/org/apache/pivot/sql/ResultList.java (original)
+++ pivot/branches/1.5.x/core/src/org/apache/pivot/sql/ResultList.java Thu Sep 23 14:52:31 2010
@@ -162,6 +162,11 @@ public class ResultList implements List<
                        value = null;
                    }
 
+                   if (value != null || includeNullValues) {
+                       String key = (field.key == null) ? field.columnName : field.key;
+                       item.put(key, value);
+                   }
+
                    item.put((field.key == null) ? field.columnName : field.key, value);
                }
            } catch (SQLException exception) {
@@ -180,15 +185,16 @@ public class ResultList implements List<
    }
 
    private ResultSet resultSet;
+   private boolean includeNullValues;
    private ArrayList<Field> fields;
 
    private ListListenerList<Map<String, Object>> listListeners = new ListListenerList<Map<String,Object>>();
 
    public ResultList(ResultSet resultSet, Field... fields) {
-       this(resultSet, new ArrayAdapter<Field>(fields));
+       this(resultSet, false, new ArrayAdapter<Field>(fields));
    }
 
-   public ResultList(ResultSet resultSet, Sequence<Field> fields) {
+   public ResultList(ResultSet resultSet, boolean includeNullValues, Sequence<Field> fields) {
        if (resultSet == null) {
            throw new IllegalArgumentException();
        }
@@ -198,9 +204,13 @@ public class ResultList implements List<
        }
 
        this.resultSet = resultSet;
+       this.includeNullValues = includeNullValues;
        this.fields = new ArrayList<Field>(fields);
    }
 
+   public boolean getIncludeNullValues() {
+       return includeNullValues;
+   }
 
    public Field getField(int index) {
        return fields.get(index);