Feature #9440
get-codepage() function should work with CLOB fields
100%
History
#1 Updated by Greg Shah over 1 year ago
The current implementation of GET-CODEPAGE() (implemented in #3753) works with LONGCHAR but not with CLOB fields. It is supposed to work with both. As implemented, it is hard coded to call longchar.getCodePage() which is not OK. In this task, the work is to:
- make a generic method in I18NOps and accept both
LONGCHAR(get-codepage(lc-var)) andCLOB(get-codepage(buffer-handle:buffer-value)) - redirect to the existing
longchar.getCodePage()if the parameter isLONGCHAR - add support for
CLOBand call it if the parameter is aCLOBfield
#2 Updated by Constantin Asofiei about 1 year ago
- Assignee set to Teodor Gorghe
#3 Updated by Teodor Gorghe about 1 year ago
- Status changed from New to WIP
- % Done changed from 0 to 80
- reviewer Constantin Asofiei added
Commited revision 15909 on branch 9440a.
- Implemented a new method on I18nOps getCodePage(BaseDataType).
- Changed the conversion on builtin_functions.rules to use I18nOps.getCodePage(BaseDataType), instead of longchar.getCodePage(BaseDataType).
I'm currently writing some test cases, to test the implementation.
#4 Updated by Teodor Gorghe about 1 year ago
I did managed to get the testcases project setup done. Right now, TestGetCodepage.cls fails because the code page is hard-coded and it does not match with the default SESSION:CPINTERNAL (1252) code page. I will add some new checks on that test, on the next working day.
#5 Updated by Teodor Gorghe about 1 year ago
- Status changed from WIP to Review
#6 Updated by Constantin Asofiei about 1 year ago
- Status changed from Review to WIP
builtin_functions.rules- this code:<rule>ftype == prog.kw_get_codp <action>methodText = "I18nOps.getCodePage"</action> <action>methodType = java.static_method_call</action> </rule>
should emitlongchar.getcodePage,clob.getCodePageandI18nOps.getCodePagedepending on the type of the argument. SeeExpressionConversionWorker.expressionType(Aast)(and its usage likeecw.expressionType(...)throughout TRPL) and use this to emit different calls for different argumentsI18nOps.java- please double-check your editor - there are lots of unintended white-space changes. Revert the file (
bzr revert -r <trunk-rev> <file>) and usebzr diff -r <trunk-rev> --using meld <file>to see the actual differences in the file before committing - should
getCodePageraise an ERROR condition if the argument is not a clob or longchar?
- please double-check your editor - there are lots of unintended white-space changes. Revert the file (
- you need to change
longchar.getCodePageto treat onlylongcharcases - remove
longchar.getCodePage(BDT), as this will only be inI18Ops - add
clob.getCodePage(clob) - when adding history entry to a file, make sure the copyright year (right-side) is updated, like
2005-2025forbuiltin_functions.rules
#7 Updated by Teodor Gorghe about 1 year ago
Commited revision 15910 on branch 9440a, with the changes according to the latest code review.
#8 Updated by Teodor Gorghe about 1 year ago
- Status changed from WIP to Review
#9 Updated by Constantin Asofiei about 1 year ago
- this must nest the @rule@s (like if/then/(if/then/else)/else); currently is is (if/then)(if/then/else).
<rule>cls == "longchar" <action>methodText = "longchar.getCodePage"</action> </rule> <rule>cls == "clob" <action>methodText = "clob.getCodePage"</action> <action on="false">methodText = "I18nOps.getCodePage"</action> </rule>
correct:<rule>cls == "longchar" <action>methodText = "longchar.getCodePage"</action> <rule on="false">cls == "clob" <action>methodText = "clob.getCodePage"</action> <action on="false">methodText = "I18nOps.getCodePage"</action> </rule> </rule> - otherwise, the code looks good; but, please use
character.UNKNOWNinstead ofnew character(); also, look into the 9060b branch, and iflongcharandclobare not changed to usecharacter.UNKNOWNorcharacter.oforcharacter.EMPTY_STRINGinstead ofnew character, please make these improvements in this branch.
#10 Updated by Teodor Gorghe about 1 year ago
Commited revision 15911 on branch 9440a.
I changed the builtin_functions.rules, with the changes you provided. In longchar and clob classes, there are no usages of new character(). I changed new character() call from I18nOps.getCodepage(BDT) to use character.UNKNOWN.
#11 Updated by Teodor Gorghe about 1 year ago
Commited revision 15912 on branch 9440a.
Replaced new character() with character.UNKNOWN on longchar.getCodePage().
#12 Updated by Constantin Asofiei about 1 year ago
I'm OK with the changes in rev 15912.
What standalone tests did you use for this?
#13 Updated by Teodor Gorghe about 1 year ago
I modified the /tests/base_language/builtin_functions/functionality/TestGetCodepage.cls to use SESSION:CPINTERNAL, instead of "ISO8859-1". Do I need to commit that test?
#14 Updated by Constantin Asofiei about 1 year ago
Please expand the test to also use get-codepage(buffer ttTable::fClob) (i.e. the POLY case which should convert to I18NOps.getCodePage). And a case with get-codepage(buffer ttTable::fInt) which would throw the error. Please run the test in both FWD and OE.
#15 Updated by Teodor Gorghe about 1 year ago
When using get-codepage(buffer ttTable::fInt), on OpenEdge, it does not throw any error. The returned value is ?.
Do I need to change the I18nOps.getCodePage(BDT) to not throw error when using other types of instances?
#16 Updated by Constantin Asofiei about 1 year ago
Teodor Gorghe wrote:
When using
get-codepage(buffer ttTable::fInt), on OpenEdge, it does not throw any error. The returned value is?.
Do I need to change theI18nOps.getCodePage(BDT)to not throw error when using other types of instances?
Yes, if 4GL shows that it returns something only for clob or longchar args, and unknown for any other type, then FWD must do the same.
#17 Updated by Teodor Gorghe about 1 year ago
- % Done changed from 80 to 100
Commited revision 1758 on testcases.
Commited revision 15913 on P2J branch 9440a.
#18 Updated by Constantin Asofiei about 1 year ago
- Status changed from Review to Internal Test
I'm OK with the changes.
#19 Updated by Teodor Gorghe about 1 year ago
Ok, thanks.
Related to this task, I noticed that the task status become "Internal Test".
What tests do I need to run?
#20 Updated by Constantin Asofiei about 1 year ago
Teodor Gorghe wrote:
Ok, thanks.
Related to this task, I noticed that the task status become "Internal Test".
What tests do I need to run?
Run conversion for a simple app which has get-codepage.
#21 Updated by Constantin Asofiei about 1 year ago
- Status changed from Internal Test to Merge Pending
Please rebase and merge 9440a now.
#22 Updated by Teodor Gorghe about 1 year ago
- Status changed from Merge Pending to Test
Branch 9440a was merged to trunk rev 15975 and archived.
#23 Updated by Constantin Asofiei 10 months ago
- Status changed from Test to Closed