This repository has been archived on 2023-08-20. You can view files and clone it, but cannot push or open issues or pull requests.
yap-6.3/packages/myddas/sqlite3/test.yap

82 lines
1.3 KiB
Plaintext
Raw Normal View History

2017-11-18 00:04:42 +00:00
:- [library(myddas)].
:- initialization(main).
main :-
setup_call_cleanup(
init,
main_ ,
(trace,
close)).
main_ :-
go,
fail.
main_ .
init :-
db_open(sqlite3, '~/Yap/Chinook/Chinook_Sqlite.sqlite', _, _),
db_import('Artist', artist),
db_import('Album', album),
db_import('Track', track).
go :-
db_get_attributes_types(album,Als),
db_get_attributes_types(track,Ts),
db_get_attributes_types(artist,As),
writeln(As:Als:Ts).
go :-
db_number_of_fields(album,Als),
db_number_of_fields(track,Ts),
db_number_of_fields(artist,As),
writeln(As:Als:Ts).
go :-
db_describe(album, Desc), writeln(Desc) ;
db_describe(track, Desc), writeln(Desc) ;
db_describe(artist, Desc), writeln(Desc).
go :-
db_show_tables(Desc), writeln(Desc).
go :-
db_show_tables(table(T)),
db_describe(T,tableinfo(FieldID,Type,Null,Primary,Default,'')),
writeln(T:tableinfo(FieldID,Type,Null,Primary,Default,'')).
go :-
go_cut0.
go :-
%stop_low_level_trace,
findall(X:Y,artist(X,Y),Ls),
length(Ls,Total),
sort(Ls, LLs),
length(LLs, T),
writeln(T:Total).
go :-
go_cut1.
go :-
X=1,
artist(X,Y),
writeln(X:Y).
go_cut0 :-
% start_low_level_trace,
artist(X,Y),
writeln(X:Y),
!.
go_cut1 :-
X=1,
artist(X,Y),
writeln(X:Y),
!.
close :-
db_close.