MyDDAS: Changed the syntax of db_prolog_select/4 to db_prolog_select/3, following a sugestion by Nuno Fonseca
git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@1512 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
parent
b0f11a69db
commit
f03fd0c1da
library/MYDDAS
@ -26,7 +26,7 @@
|
|||||||
db_stats/2,
|
db_stats/2,
|
||||||
|
|
||||||
db_sql_select/3,
|
db_sql_select/3,
|
||||||
db_prolog_select/4,
|
db_prolog_select/3,
|
||||||
db_command/2,
|
db_command/2,
|
||||||
db_insert/2,
|
db_insert/2,
|
||||||
db_create_table/3,
|
db_create_table/3,
|
||||||
@ -93,7 +93,8 @@
|
|||||||
'$make_list_of_args'/4,
|
'$make_list_of_args'/4,
|
||||||
'$get_table_name'/2,
|
'$get_table_name'/2,
|
||||||
'$get_values_for_update'/4,
|
'$get_values_for_update'/4,
|
||||||
'$extract_args'/4
|
'$extract_args'/4,
|
||||||
|
'$lenght'/2
|
||||||
]).
|
]).
|
||||||
|
|
||||||
:- use_module(myddas_errors,[
|
:- use_module(myddas_errors,[
|
||||||
@ -101,12 +102,13 @@
|
|||||||
]).
|
]).
|
||||||
|
|
||||||
:- use_module(myddas_prolog2sql,[
|
:- use_module(myddas_prolog2sql,[
|
||||||
translate/3
|
translate/3,
|
||||||
|
queries_atom/2
|
||||||
]).
|
]).
|
||||||
|
|
||||||
:- use_module(lists,[
|
:- use_module(lists,[
|
||||||
append/3
|
append/3
|
||||||
]).
|
]).
|
||||||
|
|
||||||
|
|
||||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
@ -252,19 +254,20 @@ db_sql_select(Connection,SQL,LA):-
|
|||||||
|
|
||||||
|
|
||||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
% db_prolog_select(+,-,+,+)
|
% db_prolog_select(+,+,+)
|
||||||
%
|
%
|
||||||
%
|
%
|
||||||
db_prolog_select(Connection,LA,ViewName,DbGoal):-
|
db_prolog_select(Connection,LA,DbGoal):-
|
||||||
|
|
||||||
functor(ViewName,PredName,Arity),
|
'$lenght'(LA,Arity),
|
||||||
%functor(NewName,PredName,Arity),
|
functor(ViewName,viewname,Arity),
|
||||||
translate(ViewName,DbGoal,Code),
|
% build arg list for viewname/Arity
|
||||||
|
'$make_list_of_args'(1,Arity,ViewName,LA),
|
||||||
|
|
||||||
|
copy_term((ViewName,DbGoal),(CopyView,CopyGoal)),
|
||||||
|
translate(CopyView,CopyGoal,Code),
|
||||||
queries_atom(Code,SQL),
|
queries_atom(Code,SQL),
|
||||||
|
|
||||||
% build arg list for db_my_row/2
|
|
||||||
'$make_list_of_args'(1,Arity,ViewName,LA),
|
|
||||||
|
|
||||||
get_value(Connection,Con),
|
get_value(Connection,Con),
|
||||||
c_db_connection_type(Con,ConType),
|
c_db_connection_type(Con,ConType),
|
||||||
'$write_or_not'(SQL),
|
'$write_or_not'(SQL),
|
||||||
|
@ -33,7 +33,8 @@
|
|||||||
'$make_list_of_args'/4,
|
'$make_list_of_args'/4,
|
||||||
'$where_exists'/2,
|
'$where_exists'/2,
|
||||||
'$build_query'/5,
|
'$build_query'/5,
|
||||||
'$assert_facts'/2
|
'$assert_facts'/2,
|
||||||
|
'$lenght'/2
|
||||||
]).
|
]).
|
||||||
|
|
||||||
:- use_module(myddas,[
|
:- use_module(myddas,[
|
||||||
@ -364,4 +365,9 @@
|
|||||||
'$assert_facts'(Module,Fact):-
|
'$assert_facts'(Module,Fact):-
|
||||||
Module:Fact,!.
|
Module:Fact,!.
|
||||||
'$assert_facts'(Module,Fact):-
|
'$assert_facts'(Module,Fact):-
|
||||||
assert(Module:Fact).
|
assert(Module:Fact).
|
||||||
|
|
||||||
|
'$lenght'([],0).
|
||||||
|
'$lenght'([_|T],Sum):-
|
||||||
|
'$lenght'(T,Num),
|
||||||
|
Sum is Num + 1.
|
||||||
|
Reference in New Issue
Block a user