private static void setParam(PreparedStatement stmt, BValue value, BType bType, int index, boolean isKey) throws SQLException { int type = bType.getTag(); switch (type) { case TypeTags.INT_TAG: stmt.setLong(index, ((BInteger) value).intValue()); break; case TypeTags.STRING_TAG: stmt.setString(index, value.stringValue()); break; case TypeTags.FLOAT_TAG: stmt.setDouble(index, ((BFloat) value).floatValue()); break; case TypeTags.BOOLEAN_TAG: stmt.setBoolean(index, ((BBoolean) value).booleanValue()); break; case TypeTags.BYTE_TAG: stmt.setByte(index, ((BByte) value).byteValue()); break; default: if (isKey && value instanceof BMap) { stmt.setString(index, sortBMap(((BMap) value).getMap())); } else { stmt.setString(index, value.toString()); } } }
public static void copyArgValueForWorkerReceive(StackFrame currentSF, int regIndex, BType paramType, BRefType passedInValue) { switch (paramType.getTag()) { case TypeTags.INT_TAG: currentSF.longRegs[regIndex] = ((BInteger) passedInValue).intValue(); break; case TypeTags.BYTE_TAG: currentSF.intRegs[regIndex] = ((BByte) passedInValue).byteValue(); break; case TypeTags.FLOAT_TAG: currentSF.doubleRegs[regIndex] = ((BFloat) passedInValue).floatValue(); break; case TypeTags.STRING_TAG: currentSF.stringRegs[regIndex] = (passedInValue).stringValue(); break; case TypeTags.BOOLEAN_TAG: currentSF.intRegs[regIndex] = (((BBoolean) passedInValue).booleanValue()) ? 1 : 0; break; default: currentSF.refRegs[regIndex] = passedInValue; } }
break; data.intRegs[regIndex] = ((BByte) val).byteValue(); break; case TypeTags.FLOAT_TAG:
break; result.intRegs[intRegCount++] = ((BByte) vals[i]).byteValue(); break; case TypeTags.FLOAT_TAG:
sf.intRegs[intIndex] = ((BByte) closure.value()).byteValue(); newArgRegs[argRegIndex++] = intIndex++; break;