mxhdev / SQLChecker

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

Solution Generator for SELECT statements #19

Closed timoei closed 8 years ago

timoei commented 8 years ago

At the moment the solution generator transform a SQL SELECT Query of the raw.sql file into a dbfit EXECUTE command in the solution.txt file. This has to be changed to a dbfit QUERY command, otherwise the evaluation of the submissions doesn't work properly.

mxhdev commented 8 years ago

This was supposed to be fixed with commit 9af95f781670c05ab8a03593de3dbe4df40036d1 (Ticket #14) Unfortunately, the changes done in this commit did not have the desired effect. The code which was implemented can be found in the QueryPipeline class (line 460-475) It might be a good idea to look at this place first (Implement Debug output?)

                String queryLower = query.toLowerCase().trim();
                // determine which command should be used
                String command = "Execute";
                if (queryLower.startsWith("select ")) {
                    // check for ordered query
                    if (queryLower.contains(" order by ") 
                            || queryLower.contains(" group by ")) {
                        command = "Ordered Query";
                    } else {
                        command = "Query";
                    }
                } else {
                    // some other kind of query, probably a DDL / DBL
                    // statement which does not produce a result set
                    command = "Execute";
                }
mxhdev commented 8 years ago

Fixed with commit 19d8edadba6a6aa4ab9fc526852d0d06e0d7e43c