# HG changeset patch # User František Kučera # Date 1387811961 -3600 # Node ID 514df5061f590e03c47590178046804492fd8355 # Parent a9db7fb3ce65c3310c0705c54eaec6ec1247a6d9 No special formatting for generated keys. Use 'INSERT … RETURNING id' or 'INSERT … RETURNING *' to get generated keys. diff -r a9db7fb3ce65 -r 514df5061f59 java/sql-dk/src/info/globalcode/sql/dk/DatabaseConnection.java --- a/java/sql-dk/src/info/globalcode/sql/dk/DatabaseConnection.java Mon Dec 23 16:14:03 2013 +0100 +++ b/java/sql-dk/src/info/globalcode/sql/dk/DatabaseConnection.java Mon Dec 23 16:19:21 2013 +0100 @@ -85,16 +85,7 @@ formatter.writeStartUpdatesResult(); formatter.writeQuery(sqlCommand.getQuery()); formatter.writeParameters(sqlCommand.getParameters()); - - int updatedRowsCount = ps.getUpdateCount(); - formatter.writeUpdatedRowsCount(updatedRowsCount); - - formatter.writeStartGeneratedKeys(); - try (ResultSet rs = ps.getGeneratedKeys()) { - processResultSetRows(rs, formatter); - } - formatter.writeEndGeneratedKeys(); - + formatter.writeUpdatedRowsCount(ps.getUpdateCount()); formatter.writeEndUpdatesResult(); } diff -r a9db7fb3ce65 -r 514df5061f59 java/sql-dk/src/info/globalcode/sql/dk/formatting/AbstractFormatter.java --- a/java/sql-dk/src/info/globalcode/sql/dk/formatting/AbstractFormatter.java Mon Dec 23 16:14:03 2013 +0100 +++ b/java/sql-dk/src/info/globalcode/sql/dk/formatting/AbstractFormatter.java Mon Dec 23 16:19:21 2013 +0100 @@ -55,8 +55,6 @@ * ...@query * ...@parameters * ...@updatedRowsCount - * ...generatedKeys - * ....resultSet (see above) */ protected enum State { @@ -64,8 +62,7 @@ DATABASE, RESULT_SET, ROW, - UPDATES_RESULT, - GENERATED_KEYS + UPDATES_RESULT } /** @@ -134,13 +131,13 @@ @Override public void writeStartResultSet() { - pushState(State.RESULT_SET, EnumSet.of(State.DATABASE, State.GENERATED_KEYS)); + pushState(State.RESULT_SET, EnumSet.of(State.DATABASE)); currentRowCount = 0; } @Override public void writeEndResultSet() { - popState(EnumSet.of(State.DATABASE, State.GENERATED_KEYS)); + popState(EnumSet.of(State.DATABASE)); currentColumnsHeader = null; } @@ -170,7 +167,7 @@ @Override public void writeColumnsHeader(ColumnsHeader header) { - peekState(EnumSet.of(State.RESULT_SET, State.GENERATED_KEYS)); + peekState(EnumSet.of(State.RESULT_SET)); if (currentColumnsHeader == null) { currentColumnsHeader = header; @@ -229,16 +226,6 @@ peekState(EnumSet.of(State.UPDATES_RESULT)); } - @Override - public void writeStartGeneratedKeys() { - pushState(State.GENERATED_KEYS, EnumSet.of(State.UPDATES_RESULT)); - } - - @Override - public void writeEndGeneratedKeys() { - popState(EnumSet.of(State.UPDATES_RESULT)); - } - public FormatterContext getFormatterContext() { return formatterContext; } diff -r a9db7fb3ce65 -r 514df5061f59 java/sql-dk/src/info/globalcode/sql/dk/formatting/Formatter.java --- a/java/sql-dk/src/info/globalcode/sql/dk/formatting/Formatter.java Mon Dec 23 16:14:03 2013 +0100 +++ b/java/sql-dk/src/info/globalcode/sql/dk/formatting/Formatter.java Mon Dec 23 16:19:21 2013 +0100 @@ -51,9 +51,5 @@ void writeUpdatedRowsCount(int updatedRowsCount); - void writeStartGeneratedKeys(); - - void writeEndGeneratedKeys(); - void writeEndUpdatesResult(); }