mxhdev / SQLChecker

GNU General Public License v3.0
1 stars 1 forks source link

SolutionGenerator: ExpectsError support #22

Closed mxhdev closed 8 years ago

mxhdev commented 8 years ago

The SolutionGenerator class should also be able to generate dbfit html for queries which are expected to throw an error/exception This involves detecting the expectserror label in the "raw" solution file and applying the correct dbfit command (IUtil class)

mxhdev commented 8 years ago

This only works for Procedure calls

See http://dbfit.github.io/dbfit/docs/reference.html

mxhdev commented 8 years ago

Support seems to be only rudimentary

The following (unresolved) issues are relevant Add support for expressing expectations of Exceptions https://github.com/dbfit/dbfit/issues/35 "Execute Expect Exception" support https://github.com/dbfit/dbfit/pull/306

The following (mysql) test did not work as expected


!|Execute|CREATE PROCEDURE CalcLength(IN name varchar(100), OUT strlength int) set strlength =length(name);|

!|Execute Procedure Expect Exception|CalcLength|
|name |strlength?|
|yy|four|

!|Execute|drop procedure CalcLength|
mxhdev commented 8 years ago

Workaround

rawsolution:

/static.error/ QUERY

!GENERATOR! SolutionGenerator/QueryPipeline

  1. Dont execute this query
  2. Generate comment right above the table
  3. Generate table base on query type, but w/o results (because it was not executed, there are no results)

solution.txt

!ResultStorage!

Execute QUERY
  1. Split ""
  2. For each TOKEN: a. check if it contains "" if no: a.1 Everything as usual a.2 IF "error" -> convert to "p" -> errors-- -> passed++ IF "passed" -> convert to "e" -> errors++ -> passed--
mxhdev commented 8 years ago

Workaround was implemented in commit 1a140ef1452a676057bc3e5aaacb6cef44562edc