formatter: currentRowCount v_0
authorFrantišek Kučera <franta-hg@frantovo.cz>
Fri, 20 Dec 2013 23:50:21 +0100
branchv_0
changeset 254c118af3e855
parent 24 65e3fffae091
child 26 4ec8e5534eb9
formatter: currentRowCount
java/sql-dk/src/info/globalcode/sql/dk/formatting/AbstractFormatter.java
     1.1 --- a/java/sql-dk/src/info/globalcode/sql/dk/formatting/AbstractFormatter.java	Fri Dec 20 22:58:02 2013 +0100
     1.2 +++ b/java/sql-dk/src/info/globalcode/sql/dk/formatting/AbstractFormatter.java	Fri Dec 20 23:50:21 2013 +0100
     1.3 @@ -34,6 +34,7 @@
     1.4  	private ColumnsHeader currentColumnsHeader;
     1.5  	private String currentQuery;
     1.6  	private int currentColumnsCount;
     1.7 +	private int currentRowCount;
     1.8  
     1.9  	public AbstractFormatter(FormatterContext formatterContext) {
    1.10  		this.formatterContext = formatterContext;
    1.11 @@ -132,6 +133,7 @@
    1.12  	@Override
    1.13  	public void writeStartResultSet() {
    1.14  		pushState(State.RESULT_SET, EnumSet.of(State.DATABASE, State.GENERATED_KEYS));
    1.15 +		currentRowCount = 0;
    1.16  	}
    1.17  
    1.18  	@Override
    1.19 @@ -179,6 +181,7 @@
    1.20  	public void writeStartRow() {
    1.21  		pushState(State.ROW, EnumSet.of(State.RESULT_SET));
    1.22  		currentColumnsCount = 0;
    1.23 +		currentRowCount++;
    1.24  	}
    1.25  
    1.26  	@Override
    1.27 @@ -231,9 +234,19 @@
    1.28  		return currentColumnsHeader;
    1.29  	}
    1.30  
    1.31 +	/**
    1.32 +	 * @return column number, 1 = first
    1.33 +	 */
    1.34  	protected int getCurrentColumnsCount() {
    1.35  		return currentColumnsCount;
    1.36  	}
    1.37 +
    1.38 +	/**
    1.39 +	 * @return row number, 1 = first
    1.40 +	 */
    1.41 +	protected int getCurrentRowCount() {
    1.42 +		return currentRowCount;
    1.43 +	}
    1.44  	/**
    1.45  	 * TODO: write SQLWarning
    1.46  	 */