purescript-selda icon indicating copy to clipboard operation
purescript-selda copied to clipboard

Mysql Support

Open mohaalak opened this issue 2 years ago • 5 comments

is there any plan for supporting MySQL? I read your thesis paper and read most of the source code, I think it should not be hard to add MySQL too. I'm up for the task if you have any concern let me know.

mohaalak avatar Nov 30 '21 19:11 mohaalak

I think adding MySQL should be possible, hopefully without changing the general backend-agnostic part of the code. Ideally MySQL and other backends should be separate purescript packages e.g. purescript-selda-mysql, would you mind implementing it that way?

@paluh do you have some comments on that?

Kamirus avatar Nov 30 '21 22:11 Kamirus

the main problem for a separate purescript package is how should I add litMysql for example, in instance chaining.

mohaalak avatar Dec 01 '21 08:12 mohaalak

Lit typeclass is pure optional convenience - just provide litMySQL similar to litPG and ignore adding it to Lit.

The problem with this extensibility just proves that current solution is not ideal, because lit handles both backend-agnostic literals like String, Int, but also backend-specific ones which requires the instance chain.

Anyway, there are solutions to this problem, like splitting Lit into two separate type classes, but we would need more time to discuss these design changes.

Kamirus avatar Dec 01 '21 11:12 Kamirus

I'm in the middle of supporting MySql for selda right now the issue that when creating query the column names are surrounded with " and MySql cannot parse this columns if I remove the " from this function https://github.com/Kamirus/purescript-selda/blob/e2c56b046d88d4c9462a1a7eb177c05de502ce47/src/Selda/Table.purs#L106 everything works

mohaalak avatar Dec 26 '21 19:12 mohaalak

Would setting ANSI_QUOTES resolve this problem without changing showColumnName?

Kamirus avatar Dec 30 '21 09:12 Kamirus