| | 226 | |
|---|
| | 227 | /** |
|---|
| | 228 | * Ugly hack replacement for ResultSet.getString() because |
|---|
| | 229 | * getString() doesn't work for 0000-00-00 values, and |
|---|
| | 230 | * noDatetimeStringSync=true returns empty string instead of |
|---|
| | 231 | * 0000-00-00 contrary to the docs. |
|---|
| | 232 | * @param columnName |
|---|
| | 233 | * @return |
|---|
| | 234 | * @throws SQLException |
|---|
| | 235 | */ |
|---|
| | 236 | public String getString(String columnName) throws SQLException |
|---|
| | 237 | { |
|---|
| | 238 | // FIXME date 0000-00-00 in a MySQL database causes |
|---|
| | 239 | // an exception when we call getString() on it |
|---|
| | 240 | |
|---|
| | 241 | try |
|---|
| | 242 | { |
|---|
| | 243 | return rs.getString(columnName); |
|---|
| | 244 | } |
|---|
| | 245 | catch (SQLException e) |
|---|
| | 246 | { |
|---|
| | 247 | if (e.getMessage().equals("Value '0000-00-00' " + |
|---|
| | 248 | "can not be represented as java.sql.Date")) |
|---|
| | 249 | { |
|---|
| | 250 | return "0000-00-00"; |
|---|
| | 251 | } |
|---|
| | 252 | |
|---|
| | 253 | throw e; |
|---|
| | 254 | } |
|---|
| | 255 | } |
|---|
| | 256 | |
|---|
| | 257 | public String getString(int columnNum) throws SQLException |
|---|
| | 258 | { |
|---|
| | 259 | // FIXME date 0000-00-00 in a MySQL database causes |
|---|
| | 260 | // an exception when we call getString() on it |
|---|
| | 261 | |
|---|
| | 262 | try |
|---|
| | 263 | { |
|---|
| | 264 | return rs.getString(columnNum); |
|---|
| | 265 | } |
|---|
| | 266 | catch (SQLException e) |
|---|
| | 267 | { |
|---|
| | 268 | if (e.getMessage().equals("Value '0000-00-00' " + |
|---|
| | 269 | "can not be represented as java.sql.Date")) |
|---|
| | 270 | { |
|---|
| | 271 | return "0000-00-00"; |
|---|
| | 272 | } |
|---|
| | 273 | |
|---|
| | 274 | throw e; |
|---|
| | 275 | } |
|---|
| | 276 | } |
|---|