tink_sql icon indicating copy to clipboard operation
tink_sql copied to clipboard

Custom Queries

Open kevinresol opened this issue 8 years ago • 6 comments

What is the plan for arbitrary queries?

kevinresol avatar May 26 '17 10:05 kevinresol

Depends on what you mean by "arbitrary". What's the use case here?

back2dos avatar May 26 '17 14:05 back2dos

I am mainly looking for transaction right now. And maybe ALTER table later. I just dunno if we can support all SQL syntax, if not we might want to let user input raw SQL string

kevinresol avatar May 26 '17 14:05 kevinresol

Well, the basics should ideally be in in the driver. I'd say ALTER table is one of them - in particular since CREATE table is. And transactions should look something like this:

function transaction<T>(f:Void->Promise<TransactionEnd<T>>):Promise<TransactionEnd<T>>;

enum TransactionEnd<T> {
  Commit(result:T);
  Rollback;
}

As for arbitrary queries, I suppose they could exist on the particular driver implementation. I wouldn't want to make the ability to process arbitrary SQL dialects part of the general contract :D

back2dos avatar May 26 '17 15:05 back2dos

Where would the transaction method live? On Connection or Database?

benmerckx avatar Oct 06 '17 14:10 benmerckx

I'd say the Connection should have it and the Database should expose one that just forwards the call.

back2dos avatar Oct 07 '17 10:10 back2dos

I'd like to have support for transactions :)

gene-pavlovsky avatar Mar 03 '19 21:03 gene-pavlovsky