@@ -181,4 +181,165 @@ private[scalikejdbc] class AsyncResultSetImpl(rows: IndexedSeq[RowData])
181181 case any => new java.net.URL (any.toString)
182182 }
183183
184+ override def nullableBoolean (columnIndex : Int ): java.lang.Boolean = {
185+ ensureCursor()
186+ Option (any(columnIndex))
187+ .map {
188+ case b if b == null => b.asInstanceOf [java.lang.Boolean ]
189+ case b : java.lang.Boolean => b
190+ case b : Boolean => b.asInstanceOf [java.lang.Boolean ]
191+ case s : String => {
192+ try s.toInt != 0
193+ catch { case e : NumberFormatException => ! s.isEmpty }
194+ }.asInstanceOf [java.lang.Boolean ]
195+ case v => (v != 0 ).asInstanceOf [java.lang.Boolean ]
196+ }.orNull[java.lang.Boolean ]
197+ }
198+
199+ override def nullableBoolean (columnLabel : String ): java.lang.Boolean = {
200+ ensureCursor()
201+ Option (any(columnLabel))
202+ .map {
203+ case b if b == null => b.asInstanceOf [java.lang.Boolean ]
204+ case b : java.lang.Boolean => b
205+ case b : Boolean => b.asInstanceOf [java.lang.Boolean ]
206+ case s : String => {
207+ try s.toInt != 0
208+ catch { case e : NumberFormatException => ! s.isEmpty }
209+ }.asInstanceOf [java.lang.Boolean ]
210+ case v => (v != 0 ).asInstanceOf [java.lang.Boolean ]
211+ }.orNull[java.lang.Boolean ]
212+ }
213+
214+ override def boolean (columnIndex : Int ): Boolean = nullableBoolean(columnIndex).asInstanceOf [Boolean ]
215+ override def boolean (columnLabel : String ): Boolean = nullableBoolean(columnLabel).asInstanceOf [Boolean ]
216+ override def booleanOpt (columnIndex : Int ): Option [Boolean ] = opt[Boolean ](nullableBoolean(columnIndex))
217+ override def booleanOpt (columnLabel : String ): Option [Boolean ] = opt[Boolean ](nullableBoolean(columnLabel))
218+
219+ override def nullableByte (columnIndex : Int ): java.lang.Byte = {
220+ ensureCursor()
221+ Option (any(columnIndex))
222+ .map(v => java.lang.Byte .valueOf(v.toString))
223+ .orNull[java.lang.Byte ]
224+ }
225+
226+ override def nullableByte (columnLabel : String ): java.lang.Byte = {
227+ ensureCursor()
228+ Option (any(columnLabel))
229+ .map(v => java.lang.Byte .valueOf(v.toString))
230+ .orNull[java.lang.Byte ]
231+ }
232+
233+ override def byte (columnIndex : Int ): Byte = nullableByte(columnIndex).asInstanceOf [Byte ]
234+ override def byte (columnLabel : String ): Byte = nullableByte(columnLabel).asInstanceOf [Byte ]
235+ override def byteOpt (columnIndex : Int ): Option [Byte ] = opt[Byte ](nullableByte(columnIndex))
236+ override def byteOpt (columnLabel : String ): Option [Byte ] = opt[Byte ](nullableByte(columnLabel))
237+
238+ override def nullableDouble (columnIndex : Int ): java.lang.Double = {
239+ ensureCursor()
240+ Option (any(columnIndex))
241+ .map(v => java.lang.Double .valueOf(v.toString))
242+ .orNull[java.lang.Double ]
243+ }
244+
245+ override def nullableDouble (columnLabel : String ): java.lang.Double = {
246+ ensureCursor()
247+ Option (any(columnLabel))
248+ .map(v => java.lang.Double .valueOf(v.toString))
249+ .orNull[java.lang.Double ]
250+ }
251+
252+ override def double (columnIndex : Int ): Double = nullableDouble(columnIndex).asInstanceOf [Double ]
253+ override def double (columnLabel : String ): Double = nullableDouble(columnLabel).asInstanceOf [Double ]
254+ override def doubleOpt (columnIndex : Int ): Option [Double ] = opt[Double ](nullableDouble(columnIndex))
255+ override def doubleOpt (columnLabel : String ): Option [Double ] = opt[Double ](nullableDouble(columnLabel))
256+
257+ override def nullableFloat (columnIndex : Int ): java.lang.Float = {
258+ ensureCursor()
259+ Option (any(columnIndex))
260+ .map(v => java.lang.Float .valueOf(v.toString))
261+ .orNull[java.lang.Float ]
262+ }
263+
264+ override def nullableFloat (columnLabel : String ): java.lang.Float = {
265+ ensureCursor()
266+ Option (any(columnLabel))
267+ .map(v => java.lang.Float .valueOf(v.toString))
268+ .orNull[java.lang.Float ]
269+ }
270+
271+ override def float (columnIndex : Int ): Float = nullableFloat(columnIndex).asInstanceOf [Float ]
272+ override def float (columnLabel : String ): Float = nullableFloat(columnLabel).asInstanceOf [Float ]
273+ override def floatOpt (columnIndex : Int ): Option [Float ] = opt[Float ](nullableFloat(columnIndex))
274+ override def floatOpt (columnLabel : String ): Option [Float ] = opt[Float ](nullableFloat(columnLabel))
275+
276+ override def nullableInt (columnIndex : Int ): java.lang.Integer = {
277+ ensureCursor()
278+ Option (any(columnIndex)).map {
279+ case v : Float => v.toInt.asInstanceOf [java.lang.Integer ]
280+ case v : Double => v.toInt.asInstanceOf [java.lang.Integer ]
281+ case v => java.lang.Integer .valueOf(v.toString)
282+ }.orNull[java.lang.Integer ]
283+ }
284+
285+ override def nullableInt (columnLabel : String ): java.lang.Integer = {
286+ ensureCursor()
287+ Option (any(columnLabel)).map {
288+ case v : Float => v.toInt.asInstanceOf [java.lang.Integer ]
289+ case v : Double => v.toInt.asInstanceOf [java.lang.Integer ]
290+ case v => java.lang.Integer .valueOf(v.toString)
291+ }.orNull[java.lang.Integer ]
292+ }
293+
294+ override def int (columnIndex : Int ): Int = nullableInt(columnIndex).asInstanceOf [Int ]
295+ override def int (columnLabel : String ): Int = nullableInt(columnLabel).asInstanceOf [Int ]
296+ override def intOpt (columnIndex : Int ): Option [Int ] = opt[Int ](nullableInt(columnIndex))
297+ override def intOpt (columnLabel : String ): Option [Int ] = opt[Int ](nullableInt(columnLabel))
298+
299+ override def nullableLong (columnIndex : Int ): java.lang.Long = {
300+ ensureCursor()
301+ Option (any(columnIndex)).map {
302+ case v : Float => v.toLong.asInstanceOf [java.lang.Long ]
303+ case v : Double => v.toLong.asInstanceOf [java.lang.Long ]
304+ case v => java.lang.Long .valueOf(v.toString)
305+ }.orNull[java.lang.Long ]
306+ }
307+
308+ override def nullableLong (columnLabel : String ): java.lang.Long = {
309+ ensureCursor()
310+ Option (any(columnLabel)).map {
311+ case v : Float => v.toLong.asInstanceOf [java.lang.Long ]
312+ case v : Double => v.toLong.asInstanceOf [java.lang.Long ]
313+ case v => java.lang.Long .valueOf(v.toString)
314+ }.orNull[java.lang.Long ]
315+ }
316+
317+ override def long (columnIndex : Int ): Long = nullableLong(columnIndex).asInstanceOf [Long ]
318+ override def long (columnLabel : String ): Long = nullableLong(columnLabel).asInstanceOf [Long ]
319+ override def longOpt (columnIndex : Int ): Option [Long ] = opt[Long ](nullableLong(columnIndex))
320+ override def longOpt (columnLabel : String ): Option [Long ] = opt[Long ](nullableLong(columnLabel))
321+
322+ override def nullableShort (columnIndex : Int ): java.lang.Short = {
323+ ensureCursor()
324+ Option (any(columnIndex)).map {
325+ case v : Float => v.toShort.asInstanceOf [java.lang.Short ]
326+ case v : Double => v.toShort.asInstanceOf [java.lang.Short ]
327+ case v => java.lang.Short .valueOf(v.toString)
328+ }.orNull[java.lang.Short ]
329+ }
330+
331+ override def nullableShort (columnLabel : String ): java.lang.Short = {
332+ ensureCursor()
333+ Option (any(columnLabel)).map {
334+ case v : Float => v.toShort.asInstanceOf [java.lang.Short ]
335+ case v : Double => v.toShort.asInstanceOf [java.lang.Short ]
336+ case v => java.lang.Short .valueOf(v.toString)
337+ }.orNull[java.lang.Short ]
338+ }
339+
340+ override def short (columnIndex : Int ): Short = nullableShort(columnIndex).asInstanceOf [Short ]
341+ override def short (columnLabel : String ): Short = nullableShort(columnLabel).asInstanceOf [Short ]
342+ override def shortOpt (columnIndex : Int ): Option [Short ] = opt[Short ](nullableShort(columnIndex))
343+ override def shortOpt (columnLabel : String ): Option [Short ] = opt[Short ](nullableShort(columnLabel))
344+
184345}
0 commit comments