Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for creating a query to be executed later #337

Open
jvskriubakken opened this issue Jul 15, 2018 · 5 comments
Open

Support for creating a query to be executed later #337

jvskriubakken opened this issue Jul 15, 2018 · 5 comments

Comments

@jvskriubakken
Copy link

jvskriubakken commented Jul 15, 2018

I'm quite thrilled over a typed SQL api as Exposed and see it's great potential to leverage typed queries on the client side of an application and then serialized as JSON and transferred to server, deserialized and finally executed. This would give both super powers and development speed to SPA applications.

I'm trying to understand if this is possible, but cant't really see any strong evidence of it. Any one amped to clarify?

Cheers,
Jørund

@Tapac
Copy link
Contributor

Tapac commented Jul 17, 2018

Hi @jvskriubakken , I'm not sure that it's quite easy to use Exposed on client-side because it's tightly bound to Java backend (jdbc-driver) and doesn't provide any common DSL part to be shared in MPP code.

Also, I'm not sure that executing something prepared on client-side is a good idea due to the possibility to SQL-Injections + you expose your data model to everyone.
Maybe it's better to look at something like GraphQL (#316) ?

@NekoiNemo
Copy link

Security concerns aside, how's that different from just using Exposed to generate request and passing it as string to server?

@Tapac
Copy link
Contributor

Tapac commented Aug 10, 2018

I'm not quite understand how it can be used on client side? What do you mean by client here: browser or mobile app?

@NekoiNemo
Copy link

Not sure either. But from the looks of it, it might be possible with some modifications: Statement.prepareSQL() returns prepared request as String, so it could be serialised (along with parameters) and sent to server. Granted method requires Transaction as parameter, but it seems that it only uses it to extract the dialect for the db used by this transaction.

So with some light alterations it would be possible to make a light (possibly even not JVM-dependent) client version of exposed that would just generate prepared requests, that server could then execute with Transaction.exec()... I'm just not sure what the point of it would be.

@Tapac
Copy link
Contributor

Tapac commented Aug 16, 2018

It might be possible if DSL part of Exposed will be available as a common kotlin module with a possibility to prepare sql on different backends.
I'll discuss it with my colleagues and maybe we'll plan it on future releases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants