just-bi / odxl

Open Data Export Layer
Apache License 2.0
13 stars 7 forks source link

OrderBy is enclosed in double-quotes twice #45

Open ivanmir opened 4 years ago

ivanmir commented 4 years ago

If you have columns A, B, C & D in a table, then the function quoteIdentifierIfNecessary from common.js will only work if you don't use the orderby clause. In that case, the code will execute twice and thus it will enclose the same string in double-quotes twice. I've fixed this by changing the function to:

exports.quoteIdentifierIfNecessary = function quoteIdentifierIfNecessary(identifier){ if (!/^[A-Z_][A-Z_\d]+$/g.test(identifier)){ identifier = identifier.replace(/['"]+/g, ''); identifier = "\"" + identifier + "\""; } return identifier; };

I'm pretty sure this is not the best way to fix this, but it works. BTW: OData works with $select and $orderby parameters without double-quoted column names.

Maybe you could fix it - for those people that are still working on Hana 1.0 SP12 or even on SCP-Neo.

Best regards, Ivan