Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
BUG: SQL SELECT Statement UDF Executes Triple On First Recor
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
BUG: SQL SELECT Statement UDF Executes Triple On First Recor
Environment versions
Visual FoxPro:
VFP 9
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01022053
Message ID:
01022053
Views:
73
SYMPTOMS
A user-defined function (UDF) called within a Expression as a select item in an SQL SELECT statement
executes Triple for the first record of the source table.

CAUSE
The first iteration of the SQL SELECT statement creates and sizes the columns in the output.
On the internal C++ code exists a call nesting bug.

STATUS
Not fixed.

Steps to Reproduce Behavior
 * start of SQLUDF.PRG
   *
   * This program selects records from the input table and calculates a
   * running total + 0 in the output table by using a UDF.
CLEAR	
CREATE CURSOR SQLUDF ( nField1 N(10,0) )
INSERT INTO SQLUDF VALUES ( 10 )

   nRunningTot = 0        && initialize running total to 0
   nIterations = 0        && initialize iteration counter to 0

   SELECT *, Add_Em(nField1)+ 0 as nRunTotal FROM SQLUDF INTO CURSOR temp
   BROWSE NOWAIT

   PROCEDURE Add_Em
        PARAMETERS tnFld1
           nIterations = nIterations + 1  && Increment iteration counter

           ? "Record Number:        "+ALLTRIM(STR(RECNO())) + ;
              CHR(13)+ "Number of Iterations: "+ALLTRIM(STR(nIterations))
           
           nRunningTot=nRunningTot + tnFld1     && Calculate running total
       RETURN nRunningTot
    END PROCEDURE

   *End of SQLUDF.PRG
						
Next
Reply
Map
View

Click here to load this message in the networking platform