tauri-plugin-sql icon indicating copy to clipboard operation
tauri-plugin-sql copied to clipboard

Question: Driver support for mssql?

Open falkmarinov opened this issue 3 years ago • 5 comments

The readme says that sqlite, mysql and postgres drivers are supported. But sqlx also supports the mssql (microsoft database) drivers.

falkmarinov avatar Oct 19 '22 21:10 falkmarinov

I noticed that a few weeks back. I think this may have been added to sqlx later but getting it added to this plugin would be pretty straight forward. I can add it to an upcoming PR.

yankeeinlondon avatar Oct 28 '22 01:10 yankeeinlondon

I have added mssql support in a feature branch along with splitting out the deserialization/type mapping on a per DB basis. The mssql types are not listed (unlike the other databases) so @falkmarinov if you have a MsSQL db handy that you do some testing with maybe give this a test?

feature branch

yankeeinlondon avatar Oct 28 '22 01:10 yankeeinlondon

@falkmarinov I'm not that familiar with Mssql but I have noticed that unlike the other databases Sqlx doesn't seem to have a create_database() method and it would appear that the migration strategy may be different too. :(

Check out the branch and have a look around. I've added all the conditional compilation for the new mssql feature but atm it would not work as we do require migrations and I'm assuming connecting to the database is important too :)

Note, if you're using vs-code you can just add a .vscode/settings.json file and then add:

{
    "rust-analyzer.cargo.features": [
        "mssql"
    ]
}

This will shift rust analyizer to focusing on the mssql code.

yankeeinlondon avatar Oct 28 '22 01:10 yankeeinlondon

@yankeeinlondon Thanks for your effort. Unfortunately I don't have a mssql database with which I can run tests. This question came up mainly for the fact that I am starting a research project in a short time and there must be a connection to a mssql database. And if Tauri can be used for this depends on if a simple connection to a mssql database can be established.

falkmarinov avatar Oct 28 '22 15:10 falkmarinov

@FabianLars I'm going to push this branch as a PR which I'm hoping can be quickly merged as I believe its just providing better isolation of the various DB's data types (where there are notable differences). I'll keep the feature of "mssql" included (as it does no harm to users of the other existing databases) and I'll include a request for an active user of MSSql to add a PR when then can add in a PR to address the unusual variations in the API surface that SqlX is providing along with refact the type mappings for this DB (I have put in a fairly comprehensive mapping for now but as Sqlx doesn't state this on their site as it does the others I'd say it needs validation and testing).

@falkmarinov if your project does move forward maybe you can help us with this future PR?

yankeeinlondon avatar Oct 28 '22 15:10 yankeeinlondon

@yankeeinlondon If it turns out that I convince my team about Tauri despite this immature feature, I will share more information that will help to validate it and try to help in the future PR.

falkmarinov avatar Oct 28 '22 19:10 falkmarinov

@yankeeinlondon I have a MSSQL database idea project. Perhaps I can pitch in with this PR if you have any guidance. I have installed the branch and started playing with already.

Any tips would be appreciated.

uixdimi avatar Nov 04 '22 12:11 uixdimi

@dmitov I think the branch should now be fully supporting Tauri but because Sqlx doesn't support the migrations functionality that has been removed. This isn't a showstopper in most cases but my hands are tied until the upstream fixes this. I have added a DB type to Serde type mapping which should be decent but because Sqlx says very little about this in their docs I suspect there will be some issues to sort through.

I'm happy to support you where I can.

yankeeinlondon avatar Nov 05 '22 23:11 yankeeinlondon