Semicolon escape sequence ";;" in evolutions. [#585, #1543, #212] #649

Merged
merged 3 commits into from Jan 9, 2013

5 participants

@eboto

As per the discussion thread on play-framework-dev, this allows users to escape semicolons in their Evolutions by using double semicolons: ;;

Still waiting on some feedback before updating docs...

@jroper
Play Framework member

Thankyou for your contribution. Would you mind signing our CLA?

http://www.typesafe.com/contribute/cla

@eboto

Just signed it!

@eboto

Not sure it matters, but I just realized that this implementation will have unexpected behavior with odd numbers of semicolons in a row. Expected behavior is probably that an odd number of consecutive semicolons would escape the first n - 1 semicolons, then delimit on the final one.

Instead, the escaping as implemented will behave like ;; → ;, ;;; → ;;, ;;;; → ;;, ;;;;; → ;;;, etc.

Again, I'm not sure that it matters because I can't even imagine a scenario where you would want to escape a semicolon immediately before delimiting with one.

@jroper
Play Framework member
@eboto

Yeah I considered iterating through the string, but it would have been a much bigger change and I wanted to stay conservative since this is my first Play2 PR =)

I'll f'sho update the docs...probably tomorrow sometime.

@eboto

OK that's it for docs. In the interest of brevity I left out instructions for if you want to escape more than one consecutive semicolon. I think people can put together that it's just semicolons all the way down...

@nraychaudhuri
@nraychaudhuri nraychaudhuri merged commit eaa5fc3 into playframework:master Jan 9, 2013
@eboto eboto deleted the Egraphs:evolutions-semicolon-escape-sequence branch Jan 9, 2013
@sedovalx
  • Why do you need to split an evolution script on parts for execution?
  • Why semicolon was choosen to be delimiter?
  • Why not some kind of predefined comment string?

For example with plpgsql I have to use semicolons in a procedure declaration. It's annoying to escape it by entering one more. And I have to remove it to run the same script in pgAdmin or IntelliJ. Would it be better to use ordinary SQL comment as delimiter? It will work well in all SQL-dialects and tools as far as I know. Imagine -- #~# or smth like this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment