added case for selector = * in selec function

This commit is contained in:
duboissim 2024-03-14 19:00:59 +01:00
parent f968fda270
commit ec869c752a
1 changed files with 11 additions and 0 deletions

View File

@ -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: