Question
· Sep 5, 2019

SQL result set stepped on when calling to another method

Hi all,

We just encountered an instance of a result set RS and while looping through the results,  RS is getting overwritten when method 1 calls out to method 2 (in the same class).  Method 2 creates it own result set also named RS.     

This code is several years old and never had this problem.    When I changed the name of the result set variable in method 1 the problem cleared up.  

I though that variables were automatically 'newed' in classmethods. ???

We also recently upgrade to the latest Cache version from a much older version.    Is it possible that variable scope has changed across methods?

 

Thanks for any info  you can provide!

Discussion (4)0
Log in or sign up to continue

for details on variable scoping see Summary on Local Variable Scoping

As the SQL Code generator dates from times where ProcedureBlock was unknown
any generated code for SQL access I've seen over decades just works with  [ ProcedureBlock = 0 ]

The 'automatic' you mention is the default if your class is set t to [ ProcedureBlock = 1 ] which is a default.

By changing the variable name you found the best solution yourself.   yes