haxetink / tink_sql

SQL embedded into Haxe
MIT License
53 stars 16 forks source link

Custom Queries #21

Open kevinresol opened 7 years ago

kevinresol commented 7 years ago

What is the plan for arbitrary queries?

back2dos commented 7 years ago

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

kevinresol commented 7 years ago

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

back2dos commented 7 years ago

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

benmerckx commented 7 years ago

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

back2dos commented 7 years ago

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

gene-pavlovsky commented 5 years ago

I'd like to have support for transactions :)