formatter: currentRowCount v_0
authorFrantišek Kučera <franta-hg@frantovo.cz>
Fri, 20 Dec 2013 23:50:21 +0100
branchv_0
changeset 25 4c118af3e855
parent 24 65e3fffae091
child 26 4ec8e5534eb9
formatter: currentRowCount
java/sql-dk/src/info/globalcode/sql/dk/formatting/AbstractFormatter.java
--- a/java/sql-dk/src/info/globalcode/sql/dk/formatting/AbstractFormatter.java	Fri Dec 20 22:58:02 2013 +0100
+++ b/java/sql-dk/src/info/globalcode/sql/dk/formatting/AbstractFormatter.java	Fri Dec 20 23:50:21 2013 +0100
@@ -34,6 +34,7 @@
 	private ColumnsHeader currentColumnsHeader;
 	private String currentQuery;
 	private int currentColumnsCount;
+	private int currentRowCount;
 
 	public AbstractFormatter(FormatterContext formatterContext) {
 		this.formatterContext = formatterContext;
@@ -132,6 +133,7 @@
 	@Override
 	public void writeStartResultSet() {
 		pushState(State.RESULT_SET, EnumSet.of(State.DATABASE, State.GENERATED_KEYS));
+		currentRowCount = 0;
 	}
 
 	@Override
@@ -179,6 +181,7 @@
 	public void writeStartRow() {
 		pushState(State.ROW, EnumSet.of(State.RESULT_SET));
 		currentColumnsCount = 0;
+		currentRowCount++;
 	}
 
 	@Override
@@ -231,9 +234,19 @@
 		return currentColumnsHeader;
 	}
 
+	/**
+	 * @return column number, 1 = first
+	 */
 	protected int getCurrentColumnsCount() {
 		return currentColumnsCount;
 	}
+
+	/**
+	 * @return row number, 1 = first
+	 */
+	protected int getCurrentRowCount() {
+		return currentRowCount;
+	}
 	/**
 	 * TODO: write SQLWarning
 	 */