Skip to content

Commit 2828b28

Browse files
Fix interface MetaResult not to show ResultSetMetaData
1 parent f98aab2 commit 2828b28

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

src/main/java/org/fugerit/java/query/export/facade/QueryExportFacade.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ private static void writeRecordCSV( String[] line, Iterator<MetaField> itField,
5151

5252
public static int export( QueryExportConfig config, MetaResult meta ) throws Exception {
5353
int res = 0;
54-
ResultSetMetaData rsmd = meta.getMetaData();
54+
int columnCount = meta.getColumnCount();
5555
if ( FORMAT_CSV.equalsIgnoreCase( config.getFormat() ) ) {
5656
char separator = config.getSeparator();
5757
BufferedWriter writer = new BufferedWriter( new OutputStreamWriter( config.getOutput() , Charset.forName( "UTF-8" ) ) );
@@ -60,7 +60,7 @@ public static int export( QueryExportConfig config, MetaResult meta ) throws Exc
6060
'"',
6161
CSVWriter.NO_ESCAPE_CHARACTER,
6262
CSVWriter.DEFAULT_LINE_END);
63-
String[] line = new String[ rsmd.getColumnCount() ];
63+
String[] line = new String[ columnCount ];
6464
if ( meta.hasHeader() ) {
6565
writeRecordCSV(line, meta.headerIterator(), csvwriter);
6666
}

src/main/java/org/fugerit/java/query/export/meta/BasicMetaResult.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ public Iterator<MetaField> headerIterator() throws Exception {
3737
}
3838

3939
@Override
40-
public ResultSetMetaData getMetaData() throws SQLException {
41-
return this.rs.getMetaData();
40+
public int getColumnCount() throws SQLException {
41+
return this.rs.getMetaData().getColumnCount();
4242
}
4343

4444
@Override
@@ -65,6 +65,9 @@ record = rse.extractNext( rs );
6565
}
6666
return record;
6767
}
68+
@Override
69+
public void remove() {
70+
}
6871
};
6972
}
7073

src/main/java/org/fugerit/java/query/export/meta/MetaResult.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
package org.fugerit.java.query.export.meta;
22

3-
import java.sql.ResultSetMetaData;
4-
import java.sql.SQLException;
53
import java.util.Iterator;
64

75
public interface MetaResult {
86

97
public Iterator<MetaRecord> recordIterator() throws Exception;
108

11-
public ResultSetMetaData getMetaData() throws SQLException;
9+
public int getColumnCount() throws Exception;
1210

1311
public boolean hasHeader() throws Exception;
1412

0 commit comments

Comments
 (0)