------------------------------------------------------------------------------------------- [BUG/PRB.] VFP 9.0 FIX - THE QUESTION MARK SUBSTITUTION IN THE SQLEXEC() FUNCTION January 2024 ------------------------------------------------------------------------------------------- CCB 1. BUG: In vfp9 (and vfp6, vfp7, vfp8), it always enables the question mark substitution in the SQLEXEC() (and SQLPREPARE()) function. In VFP Advanced, we can disable the question mark substitution in the SQLEXEC() (and SQLPREPARE()) function, for example, =SYS(9050,0) =SQLEXEC(m.q_connecthandle,"UPDATE mytable SET fld1=$Delim$?x1$Delim$ WHERE fldk1=123") ?x1 is a string, it will not be replaced. The bug only occurs on some ODBC drivers. The bug was reported by Simon White. 2. CAUSE: There are some BUGs in the following code. 3. RESOLUTION: We can write some code to fix the BUG. Fun45efd8 :: ; proc near mov cl , byte ptr [eax] ;0x0045efd8 : 8a08 test cl , cl ;0x0045efda : 84c9 je Label45f01b ;0x0045efdc : 743d jmp Label45eff9 ;0x0045efde : eb19 Label45efe0 :: cmp byte ptr [ eax + 1 ] , dl ;0x0045efe0 : 385001 je Label5e9a97 ;0x0045efe3 : 0f84aeaa1800 Label45efe9 :: cmp cl , dl ;0x0045efe9 : 3aca jne Label453ecd ;0x0045efeb : 0f85dc4effff Label45eff1 :: mov cl , byte ptr [ eax + 1 ] ;0x0045eff1 : 8a4801 inc eax ;0x0045eff4 : 40 test cl , cl ;0x0045eff5 : 84c9 je Label45f01b ;0x0045eff7 : 7422 Label45eff9 :: ; ; --------------------------------------------------------------------------------- ; VFP 9.0 FIX - THE QUESTION MARK SUBSTITUTION IN THE SQLEXEC() FUNCTION ; January 2021 ; --------------------------------------------------------------------------------- ; CCB ; ; The question mark substitution in the SQLEXEC() function. ; ; 2021/1/28, by ccb ; cmp dword ptr vfpa_sys9050_data,00h jne Label45effa cmp dword ptr [ esp + 00h ] , offset Label8879cd ;; Fun887985 .. ; proc near jne Label45effa cmp dword ptr [ esp + 00h + (4+00h+0A8h) ] , offset Label888668 ;; Fun88835d .. ; proc near je Label45effe cmp dword ptr [ esp + 00h + (4+00h+0A8h) ] , offset Label8882de ;; Fun888261 .. ; proc near je Label45effe Label45effa :: cmp cl , 03Fh ;0x0045eff9 : 80f93f je Label45f01b ;0x0045effc : 741d Label45effe :: cmp cl , 027h ;0x0045effe : 80f927 je Label453ea5 ;0x0045f001 : 0f849e4effff cmp cl , 022h ;0x0045f007 : 80f922 je Label453ea5 ;0x0045f00a : 0f84954effff cmp cl , 05Bh ;0x0045f010 : 80f95b je Label5e9a90 ;0x0045f013 : 0f8477aa1800 jmp Label45eff1 ;0x0045f019 : ebd6 Label45f01b :: ret ;0x0045f01b : 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. 5. REFERENCE WEBSITES: 1, baiyujia.com: http://www.baiyujia.com http://www.baiyujia.com/vfpdocuments/f_vfp9fix151.asp 2, microsoft.com: https://social.msdn.microsoft.com/forums/en-US/451f97f4-73c9-4239-b58e-986f735cc3a9/disable-question-mark-substitution-by-sqlexec-function 6. OTHER: For reference only, there is no guarantees. Any questions or suggestions, please send me an email at ccb2000@163.com. |