@@ -193,7 +193,15 @@ public static Object[] valueToValueTypeSet(Object value) {
193193 return valueTypeSet (Core_DataType .STRING .getValue (), null , shortenStringValue (value ),
194194 value .toString (), EmptyArray .BYTE );
195195 }
196-
196+
197+ // Boolean type support
198+ // - stores nVl as 1 or 0
199+ // - store sVl and tVl as the string value : "true" or "false"
200+ if (value instanceof Boolean ){
201+ return valueTypeSet (Core_DataType .BOOLEAN .getValue (), ((Boolean ) value ) ? 1 : 0 , value .toString (), value .toString (),
202+ EmptyArray .BYTE );
203+ }
204+
197205 // Binary type support
198206 if (value instanceof byte []) {
199207 return valueTypeSet (Core_DataType .BINARY .getValue (), null , null , null , (byte []) value );
@@ -251,14 +259,36 @@ protected static Object extractNonArrayValueFromPos(JSqlResult r, int pos) {
251259 } else if (baseType == Core_DataType .TEXT .getValue ()) { // Text
252260 return r .get ("tVl" ).getString (pos );
253261 }
254-
262+
263+ //
264+ // Boolean value support
265+ //
266+ if (baseType == Core_DataType .BOOLEAN .getValue ()){
267+ String tVl = r .getString ("tVl" );
268+ if (tVl .equalsIgnoreCase ("true" )){
269+ return true ;
270+ }
271+ if (tVl .equalsIgnoreCase ("false" )){
272+ return false ;
273+ }
274+ // get the value from nVl
275+ int nVl = r .getInt ("nVl" );
276+ if (nVl == 1 ){
277+ return true ;
278+ }
279+ if (nVl == 0 ){
280+ return false ;
281+ }
282+ throw new JSqlException ("Invalid boolean value: tVl=" + tVl + ", nVl=" + nVl );
283+ }
284+
255285 //
256286 // Binary value
257287 //
258288 if (baseType == Core_DataType .BINARY .getValue ()) {
259289 // Older base64 stroage format
260290 // return (Base64.getDecoder().decode((String) (r.get("tVl").get(pos))));
261-
291+
262292 Object rawValue = r .get ("rVl" ).get (pos );
263293 if (rawValue instanceof java .sql .Blob ) {
264294 java .sql .Blob blobData = (java .sql .Blob ) rawValue ;
0 commit comments