[MDEV-5317] Compound statement / anonymous blocks Created: 2013-11-20  Updated: 2014-10-11  Resolved: 2014-10-11

Status: Closed
Project: MariaDB Server
Component/s: OTHER
Fix Version/s: 10.1.1

Type: Task Priority: Major
Reporter: Antony T Curtis (Inactive) Assignee: Sergei Golubchik
Resolution: Fixed Votes: 3
Labels: contribution

Attachments: Zip Archive compound-statements.zip    
Issue Links:
Relates
relates to MDEV-6603 SBR failure upon executing a prepared... Closed
relates to MDEV-6606 Server crashes in String::append on s... Closed
relates to MDEV-6609 SQL inside an anonymous block is exec... Closed

 Description   

Code contribution, New BSD license.

Missing functionality: implement ATOMIC support which should create an anonymous savepoint at start of block and rollback on failure. commit if AUTOCOMMIT or remove anonymous savepoint if already in transaction.



 Comments   
Comment by Colin Charles [ 2014-04-09 ]

Was contributed upstream also http://bugs.mysql.com/bug.php?id=70948

Comment by Sergei Golubchik [ 2014-06-16 ]

Okay. This is more than simply BEGIN...END, as it also includes output placeholders for prepared statements (e.g. in PREPARE "SELECT...INTO ?"). Which looks like a cool, but different feature.

And it's unfortunately less than I expected, as it only covers (and tests) BEGIN...END (and DECLARE), but not IF and loops.

atcurtis, what did you need this feature for, I mean, in that exactly scope?
Do you want to work more on it, or you'd prefer if I take it as is and finalize it myself ?

Comment by Sergei Golubchik [ 2014-08-13 ]

Ah, and there's also SET ? = expr syntax.
atcurtis — why did you do that? Any use cases?

Comment by Sergei Golubchik [ 2014-08-18 ]

I've now pushed a — significantly reworked — patch to github. Without SET ? = expr syntax, but with SELECT ... INTO ?. Without BEGIN ATOMIC (it wasn't atomic in the contributed patch either, in mine it is not accepted at all). And with support for IF, CASE, LOOP, REPEAT, WHILE.

Comment by Sergei Golubchik [ 2014-08-18 ]

elenst, could you please do some testing of this feature?

Comment by Elena Stepanova [ 2014-08-19 ]

Assorted notes

New status variable: Com_compound_sql

From http://dev.mysql.com/doc/refman/5.6/en/sql-syntax-compound-statements.html

  • RETURN does not work (expectedly)
  • (for outermost blocks) labels, ITERATE, LEAVE do not work
Comment by Elena Stepanova [ 2014-08-25 ]

Ran some manual and automated tests, haven't got anything except for the issues listed in "Issue Links" section. Please push, and I will include new functionality in my general auto tests.

Comment by Oleksandr Byelkin [ 2014-09-08 ]

OK to push

Generated at Thu Feb 08 07:03:21 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.