So it is faster for 4-5 rows??? What about 10 or 15? My results with 11 rows:
Using COPY TO ARRAY 10000 passes took 0.330.Records in result = 11
Using SQL SELECT 10000 passes took 0.327.Records in result = 11
Using SQL SELECT to cursor 10000 passes took 0.440.Records in result = 11
In a real world application, who would ever choose one over another with these scores. IMHO They are close enough to be negligible.
>VFPA 32-bit performance using your code, eliminating the local array declaration and changing last loop to into cursor:
>
>
Using COPY TO ARRAY, 10000 passes took 0.079; records in result = 5
>Using SQL SELECT, 10000 passes took 0.508; records in result = 5
>Using SQL SELECT to cursor, 10000 passes took 0.466; records in result = 5
>
>VFPA x64:
>
>
Using COPY TO ARRAY, 10000 passes took 0.086; records in result = 5
>Using SQL SELECT, 10000 passes took 0.691; records in result = 5
>Using SQL SELECT to cursor, 10000 passes took 0.634; records in result = 5
>
>
That's with SET TALK OFF. SET TALK ON and it's heaps slower, with COPY TO ARRAY now slowest- e.g VFPA 32bit:
>
>
Using COPY TO ARRAY, 10000 passes took 1.865; records in result = 5
>Using SQL SELECT, 10000 passes took 1.364; records in result = 5
>Using SQL SELECT to cursor, 10000 passes took 1.403; records in result = 5
>
>SET EXCL also seems to make a slight difference, though that's hardly a surprise.