From ec869c752a14e7ba138c1f9ff357ea9c1bf8cb12 Mon Sep 17 00:00:00 2001 From: duboissim Date: Thu, 14 Mar 2024 19:00:59 +0100 Subject: [PATCH] added case for selector = * in selec function --- solution.pl | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/solution.pl b/solution.pl index ba06ea9..5d2ccce 100644 --- a/solution.pl +++ b/solution.pl @@ -219,6 +219,12 @@ selec(Table, Selector, Cond, Projection) :- selector(R,Cols, Selector, [],[],ColumnNames,ColumnValue), Projection = ColumnNames/ColumnValue. +selec(Table, *, Cond, Projection) :- + tabl(Table, Cols), + row(Table, R), + does_match(Cond, Table, R), + Projection = Cols/R. + %base case selector(_,_,[],ColumnNames, ColumnValue, ColumnNames, ColumnValue):-!. /** @@ -253,6 +259,11 @@ selec(TableOrTables, Selectors, Projection) :- selector(R,Cols, Selectors, [],[],ColumnNames,ColumnValue), Projection = ColumnNames/ColumnValue. +selec(Table, *, Projection) :- + tabl(Table, Cols), + row(Table, R), + Projection = Cols/R. + :- dynamic query/2. /* where Query is a string whose syntax is defined by the following grammar: