Category: RandomQueryGenerator

RandomQueryGeneratorQueryProperties


[edit] Rationale

It is difficult to do purely functional testing on a random query workload, and validate the result set of every individual query, especially when the queries are executed concurrently.

Nevertheless, there are cases where the queries being generated have some generic properties that should be validated after each query is run.

[edit] Tagging

In order to make use of this facility, put the desired propery inside /* */ comments and place it in the grammar file. This way, it will get added to each query that is generated from the particular rule. The property will also be visible in the server query log. For example:

query:
   SELECT select_item FROM _table ;

select_item:
   _field |
   COUNT ( _field ) /* RESULTSET_HAS_ZERO_OR_ONE_ROWS */;

In this example, if the generated queries happens to have COUNT, it is also going to be tagged with /* RESULTSET_HAS_ZERO_OR_ONE_ROWS */. If the RQG detects that you have tagged queries in your grammar, it will enable the QueryProperties Validator in order to validate them.

In this particular case, COUNT() should cause query to never return more than one row, which will be checked because the query is tagged accordingly.

[edit] Available Properties

Ensures there are no duplicates in the result set. For example, a query containing DISTINCT would have the RESULTSET_HAS_SAME_DATA_IN_EVERY_ROW property.

Ensures that the query result set is just a single row, single column containing the value of 1. This is useful for queries that perform various checks and then return 1 on success.

Ensures that the query returned one or zero rows. This is useful to validate aggregates and DISTINCT queries.

Ensures that the query has failed with this particular error code. The NNN must be numeric at this time and each query is only allowed a single such tag. Use ERROR_0 to indicate that the query should have succeeded.

Ensures that the query did not produce the "1592 Statement may not be safe to log in statement format" note in SHOW WARNINGS.

Retrieved from "http://forge.mysql.com/wiki/RandomQueryGeneratorQueryProperties"

This page has been accessed 1,571 times. This page was last modified 11:46, 10 November 2009.

Find

Browse
MySQLForge
Main Page
Current events
Recent changes
Random page
Help
Edit
Edit this page
Editing help
This page
Discuss this page
Post a comment
Printable version
Context
Page history
What links here
Related changes
My pages
Special pages
New pages
File list
Statistics
Bug reports
More...