added case for selector = * in selec function
This commit is contained in:
parent
f968fda270
commit
ec869c752a
11
solution.pl
11
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:
|
||||
|
|
Loading…
Reference in New Issue