Uh oh!
There was an error while loading. Please reload this page.
Added types implementation - #77
Conversation
Suggested fix for IBM#75 Signed-off-by: HRASTNIK Patrick Ing <patrick.hrastnik@holter.at>
kadler
left a comment
There was a problem hiding this comment.
Please resolve the merge conflicts and re-submit.
| packed(digits, delimiter) { | ||
| return digits.toString() + "P" + delimiter.toString(); | ||
| }, | ||
| zoned(digits, delimiter) { | ||
| return digits.toString() + "S" + delimiter.toString(); | ||
| }, |
There was a problem hiding this comment.
I'd suggest changing digits and delimiter to something more descriptive. SQL uses the terms precision and scale, though some may find that confusing. Perhaps total_digits and decimal_digits would be more appropriate?
| float(digits, delimiter) { | ||
| return digits.toString() + "F" + delimiter.toString(); |
There was a problem hiding this comment.
I would rather see separate float and double functions which take no parameters and return "4F2" and "8F4", respectively.
Aside: I'm not sure why XMLSERVICE wants 4F2 and 8F4, when RPG says the decimal digits field must be blank (and would be 4F and 8F, respectively).
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
| signed(digits, delimiter) { | ||
| return digits.toString() + "I" + delimiter.toString(); | ||
| }, | ||
| unsigned(digits, delimiter) { | ||
| return digits.toString() + "U" + delimiter.toString(); | ||
| }, |
There was a problem hiding this comment.
AFAIK, XMLSERVICE doesn't support integer types with scale, so the delimiter must always be 0 and is thus unnecessary.
Also, I'd also like to have separate functions for each type/length that would need no parameters, eg. signed_byte, signed_short, signed_int, signed_bigint, etc..
Applied suggestion from @kadler Co-Authored-By: Kevin Adler <kadler@us.ibm.com>
Applied suggestion from @kadler Co-Authored-By: Kevin Adler <kadler@us.ibm.com>
Applied suggestion from @kadler Co-Authored-By: Kevin Adler <kadler@us.ibm.com>
Applied suggestion from @kadler Co-Authored-By: Kevin Adler <kadler@us.ibm.com>
👋 Hi! This pull request has been marked stale due to inactivity. If no further activity occurs, it will automatically be closed. |
kadler
commented
Jan 14, 2021
Would be good to get this merged. @patrickhrastnik, not sure if you have time to resolve the conflicts otherwise @abmusse if you want to pull the changes in to a new PR and get it merged that would be great. |
One thing that I was thinking about that would impact this, is it would be really nice to have a varchar type, but that would require having the function/object return both the XMLSERVICE type as well as the varying="XX" attribute. I think this could be done by having the function return an object with the attributes and using the javascript spread operator: # oldwayprogram.addParam({type: '10A',varying: '4',value: 'Gill'});functionvarchar(len){return{type: len.toString()+'a',varying: '2'}}functionlongvarchar(len){return{type: len.toString()+'a',varying: '4'}}program.addParam({ ...longvarchar(10),value: 'Gill'});If we did that, it might also make sense to use camel case on the names:
|
Nice! The spread operator works out cleanly in this situation. I just tested it out in sample script: functionLongVarChar(len){return{type: len.toString()+'A',varying: '4'}}functionaddParam(param){console.log(param)}addParam({type: '10A',varying: '2',value: 'Gill'});addParam({ ...LongVarChar(10),value: 'Gill'})OutputThe use of camel case be to minimize confusion for the reader? |
👋 Hi! This pull request has been marked stale due to inactivity. If no further activity occurs, it will automatically be closed. |
Suggested fix for #75
Signed-off-by: HRASTNIK Patrick Ing patrick.hrastnik@holter.at