Skip to content
This repository has been archived by the owner on Jul 11, 2021. It is now read-only.

Multiple statements first prepare and then execute #55

Open
siscia opened this issue May 5, 2019 · 0 comments
Open

Multiple statements first prepare and then execute #55

siscia opened this issue May 5, 2019 · 0 comments
Labels
enhancement Good First Issue PRO Version If Contribution We will send you a PRO version if you contribute to this issue in a meaningful way.

Comments

@siscia
Copy link
Collaborator

siscia commented May 5, 2019

RediSQL support multiple statements in the same "EXEC", hence it is possible and correct to do something like:

REDISQL.EXEC DB "INSERT INTO foo VALUES(1,2,3); INSERT INTO bar VALUES(2,3,4);" 

Which is quite convenient when mixed with BEGIN, COMMIT and ABORT instruction.

One problem is that all the statements are first prepared all together, and then executed, all together.

This works fine in the general case, but has some limitation when to prepare a statement is necessary to have execute the previous one.

This is the case for creating a table and then create an index on that table, or create a second table with references to the first one.

The fix would be to return an iterator when generating the statements, so that each statement is generate only when the previous one is already execute.

Roughly here: https://github.com/RedBeardLab/rediSQL/blob/master/redisql_lib/src/community_statement.rs#L70

However there may be concurrency issues that I have overlooked.

@siscia siscia added enhancement Good First Issue PRO Version If Contribution We will send you a PRO version if you contribute to this issue in a meaningful way. labels May 5, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement Good First Issue PRO Version If Contribution We will send you a PRO version if you contribute to this issue in a meaningful way.
Projects
None yet
Development

No branches or pull requests

1 participant