Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Code to compare two VFP strings?
Message
From
25/01/2023 15:57:54
 
 
To
25/01/2023 14:13:40
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01685937
Message ID:
01685954
Views:
31
>>Hi,
>>
>>I think there was a discussion/question on how to compare two long strings. I simply missed it.
>>
>>I have 4 functions (in my VFP application) which seem to have a similar SQL Select. I need to compare them (two at a time) and refactor the application so that only one function would have this SQL Select. I prefer not to install any software on this PC. This is Windows 7 and I am afraid that a new software will break something (call me paranoid)
>>
>>Please let me know if this is possible with a VFP function.
>
>There's a simple tool, fc.exe, at hand in your dos prompt. You can output two strings into text files, and compare them with FC, redirect the output into third text file and then look at that file. While this is very crude and not intelligent at all, it may serve as a start, to at least eliminate the identicals and point out those where differences are minor.

A variation on that theme would be to make separate PRGs of the two strings and compile them to FXPs, then compare those with FC or similar. That would have the interesting property that code which is *functionally* identical (i.e. makes VFP do the same thing) should have identical FXPs, even if the source code is formatted differently (and maybe even has comments [? not tested]).

However, as has already been pointed out, this would fail on things like different column order in the SELECT.

If the target/back end is SQL Server, yet another riff might be to run the snippets in SSMS and compare execution plans, compiled SPs etc. where available.
Regards. Al

"Violence is the last refuge of the incompetent." -- Isaac Asimov
"Never let your sense of morals prevent you from doing what is right." -- Isaac Asimov

Neither a despot, nor a doormat, be

Every app wants to be a database app when it grows up
Previous
Reply
Map
View

Click here to load this message in the networking platform