• Welcome to SQLitening Support Forum. Please login.
 
January 17, 2022, 09:27:38 PM

News:

Welcome to the SQLitening support forums!


Is slF more efficient than slFN ?

Started by Jean-Pierre LEROY, June 19, 2009, 07:30:11 AM

Previous topic - Next topic

Jean-Pierre LEROY

June 19, 2009, 07:30:11 AM Last Edit: June 19, 2009, 12:25:16 PM by Jean-Pierre LEROY
Hi,

I have a question regarding these functions; is-it faster to get the value of a field with slF than with slFN ?

Thanks
Jean-Pierre

Paul Squires

slF would be faster because slFN needs to translate the given column name into a column number first. slF already uses a column number so it saves having to do that translation step.


Bern Ertl

Unless you are seeing a performance issue, I'd suggest using slFN even though it's less efficient.  It is better for code readability and maintainability.  If you ever have need to adjust your SELECT statements to add or remove a field, it could be quite a headache if you used slF.

Fred Meier

I agree with Paul and Bern.  The column names are saved when the slSel is done so that the only overhead to find the column number is the following two instructions:

   llA = instr(gsaNames(rlSetNumber), $NUL & ucase$(rsColumnName) & $NUL)
   if llA then function = tally(left$(gsaNames(rlSetNumber), llA), $NUL)


I always use the FN routines except for testing and one time programs.