コード例 #1
0
 public final InputStream getUnicodeStream(int columnIndex) throws SQLException {
   try {
     return new ByteArrayInputStream(getString(columnIndex).getBytes("UTF16"));
   } catch (Throwable th) {
     throw JdbcOdbcUtils.createSQLException(th);
   }
 }
コード例 #2
0
 public final boolean getBoolean(int columnIndex) throws SQLException {
   try {
     Object obj = getObjectSetWasNull(columnIndex);
     if (wasNull) {
       return false;
     }
     if (obj instanceof IConvertible) {
       return Convert.ToBoolean(obj);
     }
     String str = obj.toString();
     if (str.length() > 0) {
       // special handling for boolean representation in old databases
       char ch = str.charAt(0);
       if (ch == 'T' || ch == 't') {
         return true;
       }
       if (ch == 'F' || ch == 'f') {
         return true;
       }
     }
     return cli.System.Boolean.Parse(str);
   } catch (Throwable th) {
     throw JdbcOdbcUtils.createSQLException(th);
   }
 }
コード例 #3
0
 public final Timestamp getTimestamp(int columnIndex) throws SQLException {
   try {
     Object obj = getObjectSetWasNull(columnIndex);
     if (wasNull) {
       return null;
     }
     if (obj instanceof cli.System.DateTime) {
       cli.System.DateTime dt = (cli.System.DateTime) obj;
       return new Timestamp(JdbcOdbcUtils.getJavaMillis(dt));
     }
     String str = obj.toString();
     return Timestamp.valueOf(str);
   } catch (Throwable th) {
     throw JdbcOdbcUtils.createSQLException(th);
   }
 }
コード例 #4
0
 public final URL getURL(int columnIndex) throws SQLException {
   try {
     String url = getString(columnIndex);
     if (wasNull) {
       return null;
     }
     return new URL(url);
   } catch (Throwable th) {
     throw JdbcOdbcUtils.createSQLException(th);
   }
 }
コード例 #5
0
 public final String getString(int columnIndex) throws SQLException {
   try {
     Object obj = getObjectSetWasNull(columnIndex);
     if (wasNull) {
       return null;
     }
     return obj.toString();
   } catch (Throwable th) {
     throw JdbcOdbcUtils.createSQLException(th);
   }
 }
コード例 #6
0
 public final InputStream getAsciiStream(int columnIndex) throws SQLException {
   try {
     String str = getString(columnIndex);
     if (str == null) {
       return null;
     }
     return new ByteArrayInputStream(str.getBytes("Ascii"));
   } catch (Throwable th) {
     throw JdbcOdbcUtils.createSQLException(th);
   }
 }
コード例 #7
0
 public final BigDecimal getBigDecimal(int columnIndex) throws SQLException {
   try {
     Object obj = getObjectSetWasNull(columnIndex);
     if (wasNull) {
       return null;
     }
     String str = obj.toString();
     return new BigDecimal(str);
   } catch (Throwable th) {
     throw JdbcOdbcUtils.createSQLException(th);
   }
 }
コード例 #8
0
 public final short getShort(int columnIndex) throws SQLException {
   try {
     Object obj = getObjectSetWasNull(columnIndex);
     if (wasNull) {
       return 0;
     }
     if (obj instanceof IConvertible) {
       return Convert.ToInt16(obj);
     }
     String str = obj.toString();
     return Int16.Parse(str);
   } catch (Throwable th) {
     throw JdbcOdbcUtils.createSQLException(th);
   }
 }
コード例 #9
0
 public final double getDouble(int columnIndex) throws SQLException {
   try {
     Object obj = getObjectSetWasNull(columnIndex);
     if (wasNull) {
       return 0;
     }
     if (obj instanceof IConvertible) {
       return Convert.ToDouble(obj);
     }
     String str = obj.toString();
     return cli.System.Double.Parse(str);
   } catch (Throwable th) {
     throw JdbcOdbcUtils.createSQLException(th);
   }
 }
コード例 #10
0
 public final byte[] getBytes(int columnIndex) throws SQLException {
   try {
     Object obj = getObjectSetWasNull(columnIndex);
     if (wasNull) {
       return null;
     }
     if (obj instanceof byte[]) {
       return (byte[]) obj;
     }
     String str = obj.toString();
     return str.getBytes(); // which encoding?
   } catch (Throwable th) {
     throw JdbcOdbcUtils.createSQLException(th);
   }
 }
コード例 #11
0
 public final Date getDate(int columnIndex) throws SQLException {
   try {
     Object obj = getObjectSetWasNull(columnIndex);
     if (wasNull) {
       return null;
     }
     if (obj instanceof cli.System.DateTime) {
       cli.System.DateTime dt = (cli.System.DateTime) obj;
       return new Date(dt.get_Year() - 1900, dt.get_Month() - 1, dt.get_Day());
     }
     String str = obj.toString();
     return Date.valueOf(str);
   } catch (Throwable th) {
     throw JdbcOdbcUtils.createSQLException(th);
   }
 }
コード例 #12
0
 public final Time getTime(int columnIndex) throws SQLException {
   try {
     Object obj = getObjectSetWasNull(columnIndex);
     if (wasNull) {
       return null;
     }
     if (obj instanceof cli.System.DateTime) {
       cli.System.DateTime dt = (cli.System.DateTime) obj;
       return new Time(dt.get_Hour(), dt.get_Minute() - 1, dt.get_Second());
     }
     if (obj instanceof cli.System.TimeSpan) {
       cli.System.TimeSpan ts = (cli.System.TimeSpan) obj;
       return new Time(ts.get_Hours(), ts.get_Minutes() - 1, ts.get_Seconds());
     }
     String str = obj.toString();
     return Time.valueOf(str);
   } catch (Throwable th) {
     throw JdbcOdbcUtils.createSQLException(th);
   }
 }
コード例 #13
0
 public final Timestamp getTimestamp(int columnIndex, Calendar cal) throws SQLException {
   Timestamp ts = getTimestamp(columnIndex);
   JdbcOdbcUtils.convertLocalToCalendarDate(ts, cal);
   return ts;
 }
コード例 #14
0
 public final Time getTime(int columnIndex, Calendar cal) throws SQLException {
   Time time = getTime(columnIndex);
   JdbcOdbcUtils.convertLocalToCalendarDate(time, cal);
   return time;
 }
コード例 #15
0
 public final Object getObject(int columnIndex) throws SQLException {
   return JdbcOdbcUtils.convertNet2Java(getObjectSetWasNull(columnIndex));
 }
コード例 #16
0
 public final Date getDate(int columnIndex, Calendar cal) throws SQLException {
   Date date = getDate(columnIndex);
   JdbcOdbcUtils.convertLocalToCalendarDate(date, cal);
   return date;
 }