Our applications use Dynamic SQL Type 4 to execute SQL server select statements and stored procedures which return a single row.
We use Dynamic SQL Type 4 as we have a user object that executes the SQL and does all the necessary checking. It returns the result-set columns as an array of any values.
This works fine in our existing Powerbuilder 2017 application. When I run the converted code in PowerServer 2022, I got errors assigning the returned values to typed powerbuilder variables.
I've attached a picture showing the debugger screen. All the SQLDA.OutParmType values are returned as NUL. The CASE statement executes the command assigningTypeString, so all the returned array any types are all strings. This causes an error when the returned value is assigned to a numeric variable.
It can be resolved by explicitly converting the any variable
ll_curr_connections = aa_data [1] to ll_curr_connections = INTEGER ( aa_data [1] )
but this function is called numerous times.
Thanks for the quick response. - I believe the problem is because the SQLDA.OutParmType values are returned as NULL - as per screenshot. Somehow the first case statement is executed for a NULL, so the returned array of datatypes contains all strings and assigning the numeric string to an integer variable fails,
Numeric values should have added to the array using the ELSE Case which uses GetDynamicNumber so that the value of OutParmType is TypeByte!, TypeInteger!, TypeDouble!, TypeLong!, TypeReal!, or TypeBoolean! and assigning this to a numeric data type would work.
Thanks
Jim