Specify a default 'connstr' for Virtual Tables
SET CONNSTR TO [<connection-string>]
ALTER VIRTUALTABLE, CREATE VIRTUALTABLE, CursorAdapter, SET(), Virtual Tables, Virtual Tables - Further Configuration and Troubleshooting, Virtual Tables - Local Development, Remote Deployment, Virtual Table Properties, Virtual Tables - Local Stored Procedures
The SET CONNSTR TO <connection-string> command is used to specify a default 'connstr' for Virtual Tables. If a virtual table is created without a 'connstr', in the Data Workspace or using the CREATE VIRTUALTABLE command, it will use the value set by SET CONNSTR.
The virtual table 'connstr' is the ODBC connection string or ODBC DSN. The special strings 'local' or 'localhost' can also be used and refer to the current local Lianja database. At runtime, 'local' will be replaced by the connection string in the 'Runtime connection' App Setting; 'localhost' will not be replaced and will continue to use the local Lianja database. Note: if you are specifying a DSN that does not or cannot store the username and password details, the account information should be included here, e.g. 'mydsn;uid=myusername;pwd=mypassword'.
The SET() function can be used to return the current SET CONNSTR value.
The SET CONNSTR TO command without a <connection-string> removes the previously set value.
From v5.0, if the connection string for a Virtual Table is prefixed with a ? it is treated as using the "default" connection string. If SET CONNSTR is in effect and a Virtual Table has a default connection string, that default connection string is replaced with the one specified by SET CONNSTR.
set connstr to 'local' ? set('connstr') local