-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
feat: add begin_with to start transaction with custom SQL #3322
Conversation
Decent start. Couple of nits:
|
Hi @abonander, ok, this is not a problem, I'll do it. |
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Besides some nits, it's looking good so far. Do you plan on finishing the work in the SQLite driver?
#[doc(hidden)] | ||
pub fn begin_with<S>( | ||
conn: impl Into<MaybePoolConnection<'c, DB>>, | ||
sql: S, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can just be Cow<'static, str>
here since it's not a public API. That will save on codgen.
S: Into<Cow<'static, str>> + Send + 'a, | ||
{ | ||
Box::pin(async move { | ||
let rollback = Rollback::new(conn); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should check and return an error if conn.transaction_depth > 0
because it doesn't make sense to allow this to create and release manual savepoints when a transaction is already in progress; that's just going to break things.
S: Into<Cow<'static, str>> + Send + 'a, | ||
{ | ||
Box::pin(async move { | ||
let depth = conn.transaction_depth; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here re. checking transaction_depth
.
@glebpom were you going to finish this? |
Closing due to inactivity. Feel free to open a new PR if you come back to this. |
No description provided.