Skip to content

Commit

Permalink
Fixing oleodbc and adodb DSN generation to properly ignore odbc ignor…
Browse files Browse the repository at this point in the history
…ed query prefixes
  • Loading branch information
kenshaw committed Jan 17, 2024
1 parent 65f8664 commit e04e0ba
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
12 changes: 12 additions & 0 deletions dburl_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -325,12 +325,24 @@ func TestParse(t *testing.T) {
`Data Source=Oracle8i;Database=dbname;Password=pass;Port=1542;Provider=Provider.Name;User ID=user`,
``,
},
{
`adodb://user:[email protected]:1542/Oracle8i/dbname?not_ignored=1&usql_ignore=1`,
`adodb`,
`Data Source=Oracle8i;Database=dbname;Password=pass;Port=1542;Provider=Provider.Name;User ID=user;not_ignored=1`,
``,
},
{
`oo+Postgres+Unicode://user:pass@host:5432/dbname`,
`adodb`,
`Provider=MSDASQL.1;Extended Properties="Database=dbname;Driver={Postgres Unicode};PWD=pass;Port=5432;Server=host;UID=user"`,
``,
},
{
`oo+Postgres+Unicode://user:pass@host:5432/dbname?not_ignored=1&usql_ignore=1`,
`adodb`,
`Provider=MSDASQL.1;Extended Properties="Database=dbname;Driver={Postgres Unicode};PWD=pass;Port=5432;Server=host;UID=user;not_ignored=1"`,
``,
},
{
`odbc+Postgres+Unicode://user:pass@host:5432/dbname?not_ignored=1`,
`odbc`,
Expand Down
2 changes: 1 addition & 1 deletion dsn.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ func GenAdodb(u *URL) (string, string, error) {
}
u.hostPortDB = []string{host, port, n}
}
return genOptionsOdbc(q, true, nil, nil), "", nil
return genOptionsOdbc(q, true, nil, OdbcIgnoreQueryPrefixes), "", nil
}

// GenCassandra generates a cassandra DSN from the passed URL.
Expand Down

0 comments on commit e04e0ba

Please sign in to comment.