------------------------------------------------------------------------------------
                      [ENHANCED] VFP 9.0 FIX - THE MAXIMUM NUMBER OF CHARACTERS PER COMMAND LINE
                                 January 2024
                 ------------------------------------------------------------------------------------
                                    CCB



1. BUG:

     In vfp9 (and vfp6, vfp7, vfp8), the maximum number of characters per command line is 8192,
     now the maximum number of characters per command line is 16384.


2. CAUSE:

     There are some BUGs in the following code.


3. RESOLUTION:

     We can write some code to fix the BUG.

     Fun406405 :: ; proc near
             push esi                                                        ;0x00406405 :        56
             mov esi , 0684Fh                                                ;0x00406406 :        be4f680000
             push esi                                                        ;0x0040640b :        56
             mov eax , 03000h                                                ;0x0040640c :        b800300000
             call Fun42bf2a                                                  ;0x00406411 :        e8145b0200
             mov dword ptr [ Data93a890 ] ,  eax                             ;0x00406416 :        a390a89300
             push esi                                                        ;0x0040641b :        56


     ;
     ;                 -------------------------------------------------------------------------
     ;                      VFP 9.0 FIX - THE MAXIMUM NUMBER OF CHARACTERS PER COMMAND LINE
     ;                                 October 2019
     ;                 -------------------------------------------------------------------------
     ;                                     CCB
     ;
     ; In vfp9, the maximum number of characters per command line is 8192,
     ; now the maximum number of characters per command line is 16384.
     ;
     ; 2019/10/21, by ccb
     ;

     ;         mov eax , 02001h                                                ;0x0040641c :        b801200000
             mov eax , 04001h                                                ;0x0040641c :        b801200000


             call Fun42bf2a                                                  ;0x00406421 :        e8045b0200
             mov  ecx , dword ptr [ Data93a890 ]                             ;0x00406426 :        8b0d90a89300
             test ecx , ecx                                                  ;0x0040642c :        85c9
             mov dword ptr [ Data93a894 ] ,  eax                             ;0x0040642e :        a394a89300
             pop esi                                                         ;0x00406433 :        5e
             je Label577f13                                                  ;0x00406434 :        0f84d91a1700
             test eax , eax                                                  ;0x0040643a :        85c0
             je Label577f13                                                  ;0x0040643c :        0f84d11a1700
             mov  ecx , dword ptr [ecx]                                      ;0x00406442 :        8b09
             mov  eax , dword ptr [eax]                                      ;0x00406444 :        8b00
             mov  dword ptr [ Data937f94 ] , ecx                             ;0x00406446 :        890d947f9300
             mov dword ptr [ Data93a81c ] ,  eax                             ;0x0040644c :        a31ca89300
             ret                                                             ;0x00406451 :        c3


4. APPLIES TO:

     VFP 6.0.8167.0
     VFP 6.0.8961.0 (SP5)

     VFP 7.0.0.9262
     VFP 7.0.0.9465 (SP1)

     VFP 8.0.0.2521
     VFP 8.0.0.3117 (SP1)

     VFP 9.0.0.2412
     VFP 9.0.0.3504 (SP1)
     VFP 9.0.0.4611 (SP2)
     VFP 9.0.0.5015 (SP2)
     VFP 9.0.0.5411 (SP2)
     VFP 9.0.0.5721 (SP2)
     VFP 9.0.0.5815 (SP2)
     VFP 9.0.0.6303 (SP2)
     VFP 9.0.0.6602 (SP2)
     VFP 9.0.0.7423 (SP2)

     The bug has been fixed in VFP Advanced.

     IMPORTANT NOTE:
     The following commands and functions have been fixed to support the maximum number of characters per command line is 16384:
     COMPILE command
     MACRO substitution
     STORE command
     EXECSCRIPT() function
     EVALUATE() function
     TYPE() function
     VARTYPE() function
     IIF() function
     ICASE() function
     SQLEXEC() function
     SQLPREPARE() function
     SELECT - SQL command
     UPDATE - SQL command
     DELETE - SQL command
     INSERT - SQL command
     CREATE SQL VIEW - SQL command
     MODIFY VIEW - SQL command
     LOCATE command
     BROWSE command
     EDIT command
     REPLACE command
     DELETE command
     APPEND command
     CALCULATE command


5. REFERENCE WEBSITES:

     1, baiyujia.com:
     http://www.baiyujia.com
     http://www.baiyujia.com/vfpdocuments/f_vfp9fix96.asp
     http://www.baiyujia.com/vfpdocuments/f_vfp9fix199.asp
     http://www.baiyujia.com/vfpdocuments/f_vfp9fix200.asp

     2, foxite.com:
     https://www.foxite.com/archives/line-is-too-long-0000276506.htm
     https://www.foxite.com/archives/line-is-too-long-0000084952.htm
     https://www.foxite.com/archives/select-sql-statement-is-too-long-0000091699.htm

     3, microsoft.com:
     https://social.msdn.microsoft.com/Forums/en-US/9527d9c6-59b0-48e7-bb8f-147e65802eab/the-code-is-too-long-to-fit-vfp
     https://social.msdn.microsoft.com/Forums/en-US/b467c87b-8298-42eb-a909-46d72b5c391c/regarding-error-quotsql-statement-too-long

     4, tek-tips.com:
     https://www.tek-tips.com/viewthread.cfm?qid=1355032
     https://www.tek-tips.com/viewthread.cfm?qid=1245991

     5, computer-programming-forum.com:
     http://computer-programming-forum.com/2-vfp/adce0c902cafeb70.htm
     http://computer-programming-forum.com/2-vfp/113d95d6dcaebe63.htm

     6, github.io:
     https://jeffpar.github.io/kbarchive/kb/111/Q111991/


6. OTHER:

     For reference only, there is no guarantees.

     Any questions or suggestions, please send me an email at ccb2000@163.com.