Skip to content

Commit 287fba3

Browse files
cell values representing time and date will no longer be returned as strings, but as instances of their corresponding java types
1 parent 029dba7 commit 287fba3

File tree

12 files changed

+509
-55
lines changed

12 files changed

+509
-55
lines changed

src/com/inet/excel/ExcelDatabaseMetaData.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
*/
3434
public class ExcelDatabaseMetaData implements DatabaseMetaData {
3535

36-
public static final int VARCHAR_COLUMN_SIZE_IN_BYTES = 65535;
36+
public static final int COLUMN_SIZE_IN_BYTES = 65535;
3737

3838
public static final String PRODUCT_NAME = "inetexcel";
3939

@@ -1104,18 +1104,18 @@ public ResultSet getProcedureColumns( String catalog, String schemaPattern, Stri
11041104
row.add( sheetName );
11051105
row.add( colName );
11061106
row.add( Integer.valueOf( DatabaseMetaData.procedureColumnResult ) );
1107-
row.add( Integer.valueOf( Types.VARCHAR ) );
1108-
row.add( "VARCHAR" );
1107+
row.add( Integer.valueOf( Types.JAVA_OBJECT ) );
1108+
row.add( "JAVA_OBJECT" );
11091109
row.add( Integer.valueOf( 0 ) );
1110-
row.add( Integer.valueOf( VARCHAR_COLUMN_SIZE_IN_BYTES ) );
1111-
row.add( Integer.valueOf( VARCHAR_COLUMN_SIZE_IN_BYTES ) );
1110+
row.add( Integer.valueOf( COLUMN_SIZE_IN_BYTES ) );
1111+
row.add( Integer.valueOf( COLUMN_SIZE_IN_BYTES ) );
11121112
row.add( null );
11131113
row.add( Integer.valueOf( DatabaseMetaData.procedureNoNulls ) );
11141114
row.add( "" );
11151115
row.add( "" );
11161116
row.add( null );
11171117
row.add( null );
1118-
row.add( Integer.valueOf( VARCHAR_COLUMN_SIZE_IN_BYTES ) );
1118+
row.add( Integer.valueOf( COLUMN_SIZE_IN_BYTES ) );
11191119
row.add( Integer.valueOf( colIndex ) );
11201120
row.add( "NO" );
11211121
row.add( sheetName );

src/com/inet/excel/ExcelDriver.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public class ExcelDriver implements Driver {
3535
public static final String URL_PREFIX = "jdbc:inetexcel:";
3636
public static final String DRIVER_NAME = "inetexcel";
3737
public static final int MAJOR_VERSION = 1;
38-
public static final int MINOR_VERSION = 1;
38+
public static final int MINOR_VERSION = 2;
3939

4040
/** Throws exception indicating that requested operation is not supported.
4141
* @throws SQLException exception indicating that requested operation is not supported.

src/com/inet/excel/ExcelResultSet.java

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ public InputStream getBinaryStream( int columnIndex ) throws SQLException {
269269
@Override
270270
public String getString( String columnLabel ) throws SQLException {
271271
int columnIndex = findColumn( columnLabel );
272-
return getValue( columnIndex );
272+
return getString( columnIndex );
273273
}
274274

275275
/**
@@ -278,7 +278,7 @@ public String getString( String columnLabel ) throws SQLException {
278278
@Override
279279
public boolean getBoolean( String columnLabel ) throws SQLException {
280280
int columnIndex = findColumn( columnLabel );
281-
return getValue( columnIndex );
281+
return getBoolean( columnIndex );
282282
}
283283

284284
/**
@@ -287,7 +287,7 @@ public boolean getBoolean( String columnLabel ) throws SQLException {
287287
@Override
288288
public byte getByte( String columnLabel ) throws SQLException {
289289
int columnIndex = findColumn( columnLabel );
290-
return getValue( columnIndex );
290+
return getByte( columnIndex );
291291
}
292292

293293
/**
@@ -296,7 +296,7 @@ public byte getByte( String columnLabel ) throws SQLException {
296296
@Override
297297
public short getShort( String columnLabel ) throws SQLException {
298298
int columnIndex = findColumn( columnLabel );
299-
return getValue( columnIndex );
299+
return getShort( columnIndex );
300300
}
301301

302302
/**
@@ -305,7 +305,7 @@ public short getShort( String columnLabel ) throws SQLException {
305305
@Override
306306
public int getInt( String columnLabel ) throws SQLException {
307307
int columnIndex = findColumn( columnLabel );
308-
return getValue( columnIndex );
308+
return getInt( columnIndex );
309309
}
310310

311311
/**
@@ -314,7 +314,7 @@ public int getInt( String columnLabel ) throws SQLException {
314314
@Override
315315
public long getLong( String columnLabel ) throws SQLException {
316316
int columnIndex = findColumn( columnLabel );
317-
return getValue( columnIndex );
317+
return getLong( columnIndex );
318318
}
319319

320320
/**
@@ -323,7 +323,7 @@ public long getLong( String columnLabel ) throws SQLException {
323323
@Override
324324
public float getFloat( String columnLabel ) throws SQLException {
325325
int columnIndex = findColumn( columnLabel );
326-
return getValue( columnIndex );
326+
return getFloat( columnIndex );
327327
}
328328

329329
/**
@@ -332,7 +332,7 @@ public float getFloat( String columnLabel ) throws SQLException {
332332
@Override
333333
public double getDouble( String columnLabel ) throws SQLException {
334334
int columnIndex = findColumn( columnLabel );
335-
return getValue( columnIndex );
335+
return getDouble( columnIndex );
336336
}
337337

338338
/**
@@ -350,7 +350,7 @@ public BigDecimal getBigDecimal( String columnLabel, int scale ) throws SQLExcep
350350
@Override
351351
public byte[] getBytes( String columnLabel ) throws SQLException {
352352
int columnIndex = findColumn( columnLabel );
353-
return getValue( columnIndex );
353+
return getBytes( columnIndex );
354354
}
355355

356356
/**
@@ -359,7 +359,7 @@ public byte[] getBytes( String columnLabel ) throws SQLException {
359359
@Override
360360
public Date getDate( String columnLabel ) throws SQLException {
361361
int columnIndex = findColumn( columnLabel );
362-
return getValue( columnIndex );
362+
return getDate( columnIndex );
363363
}
364364

365365
/**
@@ -368,7 +368,7 @@ public Date getDate( String columnLabel ) throws SQLException {
368368
@Override
369369
public Time getTime( String columnLabel ) throws SQLException {
370370
int columnIndex = findColumn( columnLabel );
371-
return getValue( columnIndex );
371+
return getTime( columnIndex );
372372
}
373373

374374
/**
@@ -377,7 +377,7 @@ public Time getTime( String columnLabel ) throws SQLException {
377377
@Override
378378
public Timestamp getTimestamp( String columnLabel ) throws SQLException {
379379
int columnIndex = findColumn( columnLabel );
380-
return getValue( columnIndex );
380+
return getTimestamp( columnIndex );
381381
}
382382

383383
/**
@@ -443,7 +443,7 @@ public Object getObject( int columnIndex ) throws SQLException {
443443
@Override
444444
public Object getObject( String columnLabel ) throws SQLException {
445445
int columnIndex = findColumn( columnLabel );
446-
return getValue( columnIndex );
446+
return getObject( columnIndex );
447447
}
448448

449449
/**
@@ -474,7 +474,7 @@ public Reader getCharacterStream( int columnIndex ) throws SQLException {
474474
@Override
475475
public Reader getCharacterStream( String columnLabel ) throws SQLException {
476476
int columnIndex = findColumn( columnLabel );
477-
return getValue( columnIndex );
477+
return getCharacterStream( columnIndex );
478478
}
479479

480480
/**
@@ -491,7 +491,7 @@ public BigDecimal getBigDecimal( int columnIndex ) throws SQLException {
491491
@Override
492492
public BigDecimal getBigDecimal( String columnLabel ) throws SQLException {
493493
int columnIndex = findColumn( columnLabel );
494-
return getValue( columnIndex );
494+
return getBigDecimal( columnIndex );
495495
}
496496

497497
/**

src/com/inet/excel/ExcelSheetResultSet.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public class ExcelSheetResultSet extends ExcelResultSet {
3131
private final ResultSetMetaData metaData;
3232
private final int rowCount;
3333

34-
private List<List<String>> rowBatch;
34+
private List<List<Object>> rowBatch;
3535
private int currentRowIndex;
3636
private int currentBatchIndex;
3737
private boolean closed;

src/com/inet/excel/ExcelSheetResultSetMetaData.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ public String getSchemaName( int column ) throws SQLException {
160160
*/
161161
@Override
162162
public int getPrecision( int column ) throws SQLException {
163-
return ExcelDatabaseMetaData.VARCHAR_COLUMN_SIZE_IN_BYTES;
163+
return ExcelDatabaseMetaData.COLUMN_SIZE_IN_BYTES;
164164
}
165165

166166
/**
@@ -192,15 +192,15 @@ public String getCatalogName( int column ) throws SQLException {
192192
*/
193193
@Override
194194
public int getColumnType( int column ) throws SQLException {
195-
return Types.VARCHAR;
195+
return Types.JAVA_OBJECT;
196196
}
197197

198198
/**
199199
* {@inheritDoc}
200200
*/
201201
@Override
202202
public String getColumnTypeName( int column ) throws SQLException {
203-
return "VARCHAR";
203+
return "JAVA_OBJECT";
204204
}
205205

206206
/**
@@ -232,6 +232,6 @@ public boolean isDefinitelyWritable( int column ) throws SQLException {
232232
*/
233233
@Override
234234
public String getColumnClassName( int column ) throws SQLException {
235-
return String.class.getName();
235+
return String.class.getName(); //TODO
236236
}
237237
}

0 commit comments

Comments
 (0)