Android Question [SOLVED] JRDC2 : Error handle null value in date type field

incendio

Well-Known Member
Licensed User
Longtime User
Hi guys,

I have codes to retrieve data with jRDC
B4X:
Private Dt,Frm as String
Private Qty as Int
For Each records() As Object In result.Rows
   If records(0) <> Null then 
      Dt   = records(0)
   Else
      Dt = ""
   End if
   Frm = records(1)
   
   Qty = 0
   If records(2) <> Null then Qty = records(2)
Next

On firebird database server, records(0) field type is date.
Codes works well if records(0) not Null, but if it was null, it raised an error :

<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<title>Error 500 java.lang.RuntimeException: Object should first be initialized (JavaObject).</title>
</head>
<body><h2>HTTP ERROR 500</h2>
<p>Problem accessing /rdc. Reason:
<pre> java.lang.RuntimeException: Object should first be initialized (JavaObject).</pre></p><hr><a href="http://eclipse.org/jetty">Powered by Jetty:// 9.4.z-SNAPSHOT</a><hr/>
</body>
</html>


Is JRDC2 able to handle null value on date type field or there are something missing here?
 

incendio

Well-Known Member
Licensed User
Longtime User
I have modified codes so it will not return null value for date type field when retrieve by jRDC2.

When error found, it was tested on an emulation - GenyMotion 2.4, but then found a bug in this emulation, see this
https://b4x.com/android/forum/threa...turn-correct-value-for-date-type-field.93410/

So in a real device, it could run OK even return a null value for date type, but who knows, I have already modified the source code.
 
Upvote 0
Top