← Back to team overview

randgen team mailing list archive

Validating only a single query of a multi-query statement

 

Hi,

I'm writing as I've hit a problem and figured asking about it might lead to
some help.

Basically, I am writing a grammar that executes multi-query statements, as
listed here:
http://forge.mysql.com/wiki/RandomQueryGeneratorGrammar#Multi-query_statements_and_stored_procedures

Such as:
query:
  create_table ; populate_table ; alter_table ;

I'm also writing a validator that will work in conjunction with this
grammar.

The issue is that the validator is receiving / working on every query of the
compound statement, when things will only be in a testable state once *all*
of the queries composing a statement have been processed.

I was thinking of issuing a signal query such as SELECT 1 at the end of a
statement / having a test for such a result in the Validator and only
processing if the query received matched the signal (VERY hackish seeming to
me, but I think it will work).

Can you recommend any other approaches for this / code to use / etc?

If anyone is interested, I'm testing drizzledump + restore.  I'm loading a
test database with randomly created / populated tables, then wanting do dump
them, reload them to a different database, and compare table contents /
structures.

The validator is handling the dump / restore / compare portion of things,
but I only want it to kick in after I have created / populated all of the
test tables (multi-query statement = CREATE TABLE t1...INSERT INTO
t1...CREATE TABLE t2...etc).

Thanks,
Patrick

Follow ups