Work toward improving solidity. Add a few more unit tests, and some toString()
[cfb.git] / prod / net / jaekl / cfb / db / Row.java
index 35bf1215c28da38aac5b237b815e5e6c8d5136c0..2200aa1def770bde6b4a75fa3039e2ab9cdcc7b1 100644 (file)
@@ -14,6 +14,10 @@ public class Row {
        public int getNumColumns() { return m_columns.length; }
        public Column getColumn(int idx) { return m_columns[idx]; }
        
+       public Object getValue(int index) {
+               return m_values[index];
+       }
+       
        public String getString(int index) throws TypeMismatchException {
                checkType(index, Column.Type.VARCHAR);
                return (String)m_values[index];
@@ -43,6 +47,20 @@ public class Row {
                return (java.util.Date)m_values[index];
        }
        
+       @Override
+       public String toString() 
+       {
+               StringBuilder sb = new StringBuilder("[");
+               for (int idx = 0; idx < m_columns.length; ++idx) {
+                       if (idx > 0) {
+                               sb.append(", ");
+                       }
+                       sb.append("" + m_columns[idx].getName() + "=" + m_values[idx]);
+               }
+               sb.append("]");
+               return sb.toString();
+       }
+       
        protected void checkType(int index, Column.Type type) throws TypeMismatchException {
                Column column = m_columns[index];
                Column.Type columnType = column.getType();