How to get XPages and JSON to not put variable nam

2019-07-25 17:23发布

问题:

I'm trying to do the following update using XPages Extension Library.

#{javascript:var mydata = {
      product: getComponent("inputProduct").getValue()
};

var params = [1, 2];,
@JdbcUpdate("mssql","table_name",mydata,"order_no=? AND order_line_no=?",params)};

I get the error:

Error while executing JavaScript action expression
Script interpreter error, line=6, col=1: Error while executing function '@JdbcUpdate'
Invalid column name 'PRODUCT'.

The problem is that XPages when it converts the JSON it puts product to PRODUCT.

Can you set the extension library to respect the case of the JSON and not convert to Uppercase? Or can anyone point to where this setting could be set if not the extension library?

Thanks

回答1:

The problem is com.ibm.xsp.extlib.util.JdbcUtil.appendColumnName()

public static void appendColumnName(StringBuilder b, String colName) { colName = colName.toUpperCase(); b.append(colName); }

This just needs changing to not upper case the variable.

There may be other methods that need changing if other variables are getting upper cased.