Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bigdecimal support #6

Merged
merged 1 commit into from
Jul 23, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ public double getDouble(int columnIndex) throws SQLException {
}

@Override
@Deprecated
public BigDecimal getBigDecimal(int columnIndex, int scale) throws SQLException {
throw new UnsupportedOperationException();
}
Expand Down Expand Up @@ -148,7 +147,6 @@ public double getDouble(String columnLabel) throws SQLException {
}

@Override
@Deprecated
public BigDecimal getBigDecimal(String columnLabel, int scale) throws SQLException {
throw new UnsupportedOperationException();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import java.io.IOException;
import java.io.InputStream;
import java.math.BigDecimal;
import java.sql.*;
import java.text.ParseException;
import java.text.SimpleDateFormat;
Expand Down Expand Up @@ -437,4 +438,34 @@ public <T> T getObject(String columnLabel, Class<T> type) throws SQLException {
public ByteFragment[] getValues() {
return values;
}
}

@Override
public BigDecimal getBigDecimal(String columnLabel) {
return getBigDecimal(asColNum(columnLabel));
}

@Override
public BigDecimal getBigDecimal(int columnIndex) {
String string = getString(columnIndex);
if (string == null) {
return null;
}
return new BigDecimal(string);
}


@Override
public BigDecimal getBigDecimal(String columnLabel, int scale) {
return getBigDecimal(asColNum(columnLabel), scale);
}

@Override
public BigDecimal getBigDecimal(int columnIndex, int scale) {
String string = getString(columnIndex);
if (string == null) {
return null;
}
BigDecimal result = new BigDecimal(string);
return result.setScale(scale, BigDecimal.ROUND_HALF_UP);
}
}