jehugaleahsa/SQLGeneration — pull request #15 by dazinator (2014-07-06 21:38:44+00:00)
Title:  Added support (and unit tests) for Batch Commands.

I have added support for batch SQL statements - by which i mean where you have more than 1 statement in the SQL string and they are seperated by semi colon terminators.

A breakdown:

1. Created 3 new unit tests (passing): 'TestBatch_TerminatorPersists', 'TestBatch_MultipleInserts' and 'TestBatch_MixtureOfStatementsWithSemiColons'.
2. Added the Terminator to the TokenRegistry.
3. Extended the grammar to allow optional terminators to be used with commands.
4. New BatchBuilder class (ICommand implementation that wraps a list of ICommands representing the batch)
5. Extended BuilderVisitor class with visit method to visit BatchBuilder and implented this method in the FormattingVisitor class.
6. Added a HasTerminator property to the ICommand interface, and implemented this in the Derived ICommand classes.
7. CommandBuilder.GetCommand behaves as before if there is a single SQL statement, however if there are multiple statements, it returns a BatchBuilder instance which contains the various ICommands in the batch.
8. Minor amendment to Parser class. It previously assumed that once it matched a single expression it was done and if there were any remaining tokens then it was setting IsMatched to false. I have tweeked this to allow for parsing multiple expressions in the same token stream.

Think thats about it..