sc_select, sc_exec_sql, sc_lookup: 2nd parameter cannot be a variable- causes error

When specifying the 2nd parameter for this macro, ScriptCase will generate a PHP error unless the value is hard-coded.
sc_exec_sql (“SQL Command”, “Connection”)

For example, these lines of code crashes PHP:
sc_exec_sql (“SQL Command”, [global_my_connection]);
sc_exec_sql (“SQL Command”, $thisConnection);

The same is true for the other functions I listed. In particular, when they are used in Library functions.

When used in Library functions, the PHP error I get is:
Parse error: syntax error, unexpected ‘,’ in E:\Program Files\NetMake\v7\wwwroot\scriptcase\app rialshow\Login\Login_apl.php on line 1384

It will generate a different type of error in the Events. For example, this works fine:
sc_select(my_data, “SELECT DISTINCT Access FROM myusers WHERE LoginID=‘johnxm’”, “si_local_mysql”);
BUT if I change it to:
[global_ftp_db] = ‘si_local_mysql’;
sc_select(my_data, “SELECT DISTINCT Access FROM myusers WHERE LoginID=‘johnxm’”, [global_ftp_db]);

Then I get a error on compile:

Event onValidate: "SELECT DISTINCT Access FROM myusers WHERE LoginID='johnxm", [global_ftp_db]
(Table 'sc_XXXXXXXXXX_dev.myusers ' doesn't exist)

(screenshot of one time I had this error is attached)

Why this is really bad for me: We have to frequently switch the database that our code uses. We need to coordinate a central database with 5-10 other servers that each run a local mySQL. I think it’s pretty common to need to use multiple connections. So I think this is a really important bug fix.

Can I be notified when it is fixed, or if there are plans to fix it? Because if not, I’m afraid I’ll need to drastically change my code at this point.



Issue reported to our bugs team.

Bernhard Bernsmann

2.5 years later…
the issue still applies to the latest 8.1.x
will it ever be fixed?
the SC parser not being able to parse variables within some sc macros is very limiting.

hola vengo del 2018 y el mismo error se sigue presentando en sc9, alguna soluci?n?