Feature/vfp cursortoxml - #2016
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implemented
CURSORTOXML():it receives an alias, an area number, or nothing at all for the current area. Output goes to a file or to a memvar and returns the bytes written.
nRecordsworks, the three schema modes work (none, inline, external file), and so docnameSpaceand the continuous-string flag. Index order and filters are respected, and the record pointer ends up where VFP leaves it: at EOF if you wrote everything, on the last record ifnRecordscut in short.I didn't want to guess the output formar, so I ran the same cursor through a real VFP 9 and diffed the two. Once you ignore the XML declaration, tabs vs spaces, and vs , it comes out indentical to VFP for evething I tried except Double fields. The 20 tests in
CursorToXmlTests.prgare basically that comparison turned into asserts.One thing to flag: I had to touch
DbDataTable. It was shoving DBF values straight into a typed DataTable, so any cursor with a data field died with "cannot convert DbData to IConvertible". Old bug, and it hits CursorAdapter and DbDataSource too.CURSORTOXMLdoesn't even end up using DbDataTable (I needed control over decimal scale and date formatting to match VFP), but leaving that crash sitting there made no sense.It's marked as
Partialon purpose. Only ELEMENTS is produced,nOutputFormat2 and 3 get swallowed and ignored. Double (B) fields lose their decimals because the RDD doesn't report them (DBS_DEC gives 0, IFloat:Decimals gives -1), so I write the whole value instead of truncating it. The code page and encoding flags, CDATA and whitespaces one aren't done either, output is always UTF-8.cSchemaLocationisn't emmited, andSET SAFETYisn't checked when overwriting a file.