Hi Nikolay, 
you made same points as I thought about.
Maybe some registry anchored regex replace mechanism could be implemented, so there's something if needed. As I think you're likely right that this is at least partially related to the individual drivers. In my case the provided patch enables running the NonStop crosscompilers using wine for sources with embedded SQL MX. Requiring odbc for preprocessing. 

Regards,
Florian 

--
Mit freundlichen Grüßen / With kind regards
Florian Manschwetus
 
E-Mail: manschwetus@cs-software-gmbh.de
Tel.: +49-(0)611-8908534
 
CS Software Concepts and Solutions GmbH
Geschäftsführer / Managing director: Dr. Werner Alexi
Amtsgericht Wiesbaden HRB 10004 (Commercial registry)
Schiersteiner Straße 31
D-65187 Wiesbaden
Germany
Tel.: 0611/8908555

From: Nikolay Sivov <nsivov@codeweavers.com>
Sent: Saturday, April 2, 2022 12:23:39 PM
To: wine-devel@winehq.org <wine-devel@winehq.org>
Cc: manschwetus@cs-software-gmbh.de <manschwetus@cs-software-gmbh.de>
Subject: Re: [PATCH] Replace / with : in ConnectionString
 


On 3/31/22 21:05, Florian Manschwetus wrote:
> From: manschwetusCS <30724946+manschwetusCS@users.noreply.github.com>
>
> In Windows ODBC it seems to be legal to use "host/port", which is not legal with Linux ODBC.
> This patch aims to find and replace such in the ConnectionString

Hi, Florian.

Thanks for the patch. I have a few comments.

> @@ -1779,10 +1779,21 @@ SQLRETURN WINAPI SQLDriverConnect(SQLHDBC hdbc, SQLHWND hwnd, SQLCHAR *Connectio
>                                     SQLCHAR *conn_str_out, SQLSMALLINT conn_str_out_max,
>                                     SQLSMALLINT *ptr_conn_str_out, SQLUSMALLINT driver_completion)
>   {
> +    static const char *serverStr="SERVER=";
>       struct SQLDriverConnect_params params = { hdbc, hwnd, ConnectionString, Length, conn_str_out,
>                                                 conn_str_out_max, ptr_conn_str_out, driver_completion };
>       SQLRETURN ret;
>
> +    SQLCHAR *serverPos;
> +    for (serverPos = strstr(ConnectionString,serverStr);(*serverPos != ';') && (*serverPos != '\0'); ++serverPos)
> +    {
> +        if (*serverPos == '/')
> +        {
> +           *serverPos = ':';
> +           break;
> +        }
> +    }
> +

My understanding is that connection string attributes have to be passed
as is to underlying driver/unixodbc proxy. If server port syntax differs
between implementations, does that mean different drivers have different
syntax? If that's the case I don't think you can swap one for another
like that. For example I see some examples for SQL Server that are using
"host,port" syntax instead.

So this needs to be investigated across drivers on Windows and unixodbc
to see what needs to happen exactly. Depending on syntax requirements,
it's possible we need to change it only for some drivers, or maybe
drivers need to be fixed.

If it turns out we do need to modify connection string, cleaner way is
to tokenize it fully first, then tweak parts that need tweaking, and
assemble it back. In your fix you're changing original connection
string, which sounds incorrect. Another thing is that attribute names
are case insensitive afaik, so comparison you're using is too strict.

If you received this email in error, please advise the sender (by return email or otherwise) immediately.