32
This commit is contained in:
parent
e97ea388f8
commit
8911fea5ae
@ -656,7 +656,7 @@ static Int code_in_pred(PredEntry *pp, Atom *pat, UInt *parity,
|
|||||||
|
|
||||||
PELOCK(40, pp);
|
PELOCK(40, pp);
|
||||||
/* check if the codeptr comes from the indexing code */
|
/* check if the codeptr comes from the indexing code */
|
||||||
if (pp->PredFlags & IndexedPredFlag) {
|
if (pp->PredFlags & IndexedPredFlag && pp->OpcodeOfPred != INDEX_OPCODE) {
|
||||||
if (pp->PredFlags & LogUpdatePredFlag) {
|
if (pp->PredFlags & LogUpdatePredFlag) {
|
||||||
if (code_in_pred_lu_index(
|
if (code_in_pred_lu_index(
|
||||||
ClauseCodeToLogUpdIndex(pp->cs.p_code.TrueCodeOfPred), codeptr,
|
ClauseCodeToLogUpdIndex(pp->cs.p_code.TrueCodeOfPred), codeptr,
|
||||||
|
@ -1038,6 +1038,7 @@ X_API void YAP_Init(YAP_init_args *yap_init) {
|
|||||||
init_globals(yap_init);
|
init_globals(yap_init);
|
||||||
|
|
||||||
start_modules();
|
start_modules();
|
||||||
|
CurrentModule = PROLOG_MODULE;
|
||||||
TermEof = MkAtomTerm( Yap_LookupAtom("end_of_file"));
|
TermEof = MkAtomTerm( Yap_LookupAtom("end_of_file"));
|
||||||
consult(Yap_BOOTSTRAP PASS_REGS);
|
consult(Yap_BOOTSTRAP PASS_REGS);
|
||||||
setAtomicGlobalPrologFlag(RESOURCE_DATABASE_FLAG,
|
setAtomicGlobalPrologFlag(RESOURCE_DATABASE_FLAG,
|
||||||
|
@ -72,7 +72,7 @@ foreach (driver ${MYDDAS_DBMS})
|
|||||||
cpp_driver(MYDDAS_YAP ${driver} myddas_driver.ypp)
|
cpp_driver(MYDDAS_YAP ${driver} myddas_driver.ypp)
|
||||||
endforeach ()
|
endforeach ()
|
||||||
|
|
||||||
list (APPEND MYDDAS_YAP ${CMAKE_CURRENT_SOURCE_DIR}/../sqlite3/test.yap ${CMAKE_CURRENT_SOURCE_DIR}/../sqlite3/chinook.db)
|
list (APPEND MYDDAS_YAP ${CMAKE_CURRENT_SOURCE_DIR}/../sqlite3/sqlitest.yap ${CMAKE_CURRENT_SOURCE_DIR}/../sqlite3/chinook.db)
|
||||||
add_to_group(MYDDAS_YAP pl_library )
|
add_to_group(MYDDAS_YAP pl_library )
|
||||||
|
|
||||||
add_custom_target(plmyddas ALL DEPENDS ${MYDDAS_YAP} )
|
add_custom_target(plmyddas ALL DEPENDS ${MYDDAS_YAP} )
|
||||||
|
@ -188,7 +188,6 @@
|
|||||||
%
|
%
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
%% @pred db_open(+Interface,-Handle,+HostDb,+User,+Password)
|
%% @pred db_open(+Interface,-Handle,+HostDb,+User,+Password)
|
||||||
%% @pred db_open(+Interface,+HostDb,+User,+Password)
|
%% @pred db_open(+Interface,+HostDb,+User,+Password)
|
||||||
%
|
%
|
||||||
@ -243,7 +242,7 @@ db_open(odbc,Connection,ODBCEntry,User,Password) :-
|
|||||||
%% sqlite3
|
%% sqlite3
|
||||||
db_open(sqlite3,Connection,File,User,Password) :-
|
db_open(sqlite3,Connection,File,User,Password) :-
|
||||||
'$error_checks'(db_open(sqlite3,Connection,File,User,Password)),
|
'$error_checks'(db_open(sqlite3,Connection,File,User,Password)),
|
||||||
c_sqlite3_connect(File,User,Password,Con),
|
myddas_sqlite3:c_sqlite3_connect(File,User,Password,Con),
|
||||||
set_value(Connection,Con).
|
set_value(Connection,Con).
|
||||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
||||||
@ -369,7 +368,7 @@ db_sql_(ConType, Con, SQL,LA):-
|
|||||||
c_postgres_query(SQL,ResultSet,Con,Mode,Arity)
|
c_postgres_query(SQL,ResultSet,Con,Mode,Arity)
|
||||||
;ConType == sqlite3 ->
|
;ConType == sqlite3 ->
|
||||||
sqlite3_result_set(Mode),
|
sqlite3_result_set(Mode),
|
||||||
c_sqlite3_query(SQL,ResultSet,Con,Mode,Arity)
|
myddas_myddas_sqlite3:c_sqlite3_query(SQL,ResultSet,Con,Mode,Arity)
|
||||||
;
|
;
|
||||||
c_odbc_query(SQL,ResultSet,Arity,LA,Con),
|
c_odbc_query(SQL,ResultSet,Arity,LA,Con),
|
||||||
c_odbc_number_of_fields_in_query(SQL,Con,Arity)
|
c_odbc_number_of_fields_in_query(SQL,Con,Arity)
|
||||||
@ -459,7 +458,7 @@ db_assert(Connection,PredName):-
|
|||||||
c_postgres_query(SQL,_,Con,Mode,_)
|
c_postgres_query(SQL,_,Con,Mode,_)
|
||||||
;ConType == sqlite3 ->
|
;ConType == sqlite3 ->
|
||||||
sqlite3_result_set(Mode),
|
sqlite3_result_set(Mode),
|
||||||
c_sqlite3_query(SQL,_,Con,Mode,_)
|
myddas_myddas_sqlite3:c_sqlite3_query(SQL,_,Con,Mode,_)
|
||||||
;
|
;
|
||||||
c_odbc_query(SQL,_,_,_,Con)
|
c_odbc_query(SQL,_,_,_,Con)
|
||||||
).
|
).
|
||||||
@ -488,7 +487,7 @@ db_create_table(Connection,TableName,FieldsInf):-
|
|||||||
c_postsgres_query(FinalSQL,_,Con,Mode,_)
|
c_postsgres_query(FinalSQL,_,Con,Mode,_)
|
||||||
;ConType == sqlite3 ->
|
;ConType == sqlite3 ->
|
||||||
sqlite3_result_set(Mode),
|
sqlite3_result_set(Mode),
|
||||||
c_sqlite3_query(FinalSQL,_,Con,Mode,_)
|
myddas_myddas_sqlite3:c_sqlite3_query(FinalSQL,_,Con,Mode,_)
|
||||||
;
|
;
|
||||||
c_odbc_query(FinalSQL,_,_,_,Con)
|
c_odbc_query(FinalSQL,_,_,_,Con)
|
||||||
).
|
).
|
||||||
@ -565,7 +564,7 @@ db_update(Connection,WherePred-SetPred):-
|
|||||||
;
|
;
|
||||||
ConType == sqlite3 ->
|
ConType == sqlite3 ->
|
||||||
sqlite3_result_set(Mode),
|
sqlite3_result_set(Mode),
|
||||||
c_sqlite3_query(SQL,_,Conn,Mode,_)
|
myddas_sqlite3:c_sqlite3_query(SQL,_,Conn,Mode,_)
|
||||||
;
|
;
|
||||||
ConType == odbc ->
|
ConType == odbc ->
|
||||||
odbc_result_set(Mode),
|
odbc_result_set(Mode),
|
||||||
|
@ -69,7 +69,7 @@
|
|||||||
'$make_a_list'/2,
|
'$make_a_list'/2,
|
||||||
'$write_or_not'/1
|
'$write_or_not'/1
|
||||||
]).
|
]).
|
||||||
:- load_foreign_files( [NAME()], [], INIT()).
|
% :- load_foreign_files( [NAME()], [], INIT()).
|
||||||
|
|
||||||
%--------------------------------------------------------
|
%--------------------------------------------------------
|
||||||
% Public Predicates
|
% Public Predicates
|
||||||
|
@ -2,7 +2,7 @@ message( " * Sqlite3 Data-Base (http://www.sqlite3ql.org), distributed with MY
|
|||||||
|
|
||||||
set (SQLITE_EXTRA
|
set (SQLITE_EXTRA
|
||||||
chinook.db
|
chinook.db
|
||||||
test.yap)
|
sqlitest.yap)
|
||||||
|
|
||||||
set( YAPSQLITE3_SOURCES
|
set( YAPSQLITE3_SOURCES
|
||||||
myddas_sqlite3.c
|
myddas_sqlite3.c
|
||||||
@ -61,5 +61,3 @@ endif()
|
|||||||
install(FILES ${SQLITE_EXTRA}
|
install(FILES ${SQLITE_EXTRA}
|
||||||
DESTINATION ${libpl}
|
DESTINATION ${libpl}
|
||||||
)
|
)
|
||||||
|
|
||||||
# file (INSTALL chinook.db test.yap DESTINATION ${libpl})
|
|
||||||
|
@ -672,14 +672,13 @@ static void Yap_InitBackMYDDAS_SQLITE3Preds(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
X_API void init_sqlite3(void) {
|
X_API void init_sqlite3(void) {
|
||||||
//Term cm = CurrentModule;
|
Term cm = CurrentModule;
|
||||||
//CurrentModule = MkAtomTerm(Yap_LookupAtom("myddas_sqlite3"));
|
CurrentModule = MkAtomTerm(Yap_LookupAtom("myddas_sqlite3"));
|
||||||
|
|
||||||
Yap_InitMYDDAS_SQLITE3Preds();
|
Yap_InitMYDDAS_SQLITE3Preds();
|
||||||
|
|
||||||
Yap_InitBackMYDDAS_SQLITE3Preds();
|
Yap_InitBackMYDDAS_SQLITE3Preds();
|
||||||
|
CurrentModule = cm;
|
||||||
//CurrentModule = cm;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
|
:- stop_low_level_trace.
|
||||||
:- compile(library(maplist)).
|
:- use_module(library(maplist)).
|
||||||
:- use_module(library(myddas)).
|
:- use_module(library(myddas)).
|
||||||
|
|
||||||
main :-
|
main :-
|
||||||
@ -13,24 +13,23 @@ main_ .
|
|||||||
|
|
||||||
init :-
|
init :-
|
||||||
|
|
||||||
%start_low_level_trace,
|
start_low_level_trace,
|
||||||
db_open(sqlite3, '/data/user/0/pt.up.yap.yapdroid/files/Yap/chinook.db', _, _),
|
db_open(sqlite3, '/data/user/0/pt.up.yap.yapdroid/files/Yap/chinook.db', _, _),
|
||||||
writeln('chinook has landed').
|
writeln('chinook has landed').
|
||||||
|
|
||||||
go :-
|
go :-
|
||||||
stop_low_level_trace,
|
db_import('artists', artist),
|
||||||
db_import('Artist', artist),
|
writeln(('artist -> artist')),
|
||||||
writeln(('Artist -> artist')),
|
db_import('albums', album),
|
||||||
db_import('Album', album),
|
writeln(('albums -> album')),
|
||||||
writeln(('Album -> album')),
|
db_import('track', track),
|
||||||
db_import('Track', track),
|
writeln(('track -> track')).
|
||||||
writeln(('Track -> track')).
|
|
||||||
|
|
||||||
go :-
|
go :-
|
||||||
db_get_attributes_types(album,Als),
|
db_get_attributes_types(album,Als),
|
||||||
format('~w -> ~w~n',[album,Als]),
|
format('~w -> ~w~n',[album,Als]),
|
||||||
db_get_attributes_types(track,Ts),
|
db_get_attributes_types(track,Ts),
|
||||||
format('~w -> ~w~n',[track,Ts]),
|
format('~w -> ~w~n',[track,Ts]),
|
||||||
db_get_attributes_types(artist,As),
|
db_get_attributes_types(artist,As),
|
||||||
format('~w -> ~w~n',[artist,As]).
|
format('~w -> ~w~n',[artist,As]).
|
||||||
go :-
|
go :-
|
||||||
|
@ -740,6 +740,7 @@ db_files(Fs) :-
|
|||||||
true
|
true
|
||||||
),
|
),
|
||||||
'$loop'(Stream,Reconsult),
|
'$loop'(Stream,Reconsult),
|
||||||
|
|
||||||
'$lf_opt'(imports, TOpts, Imports),
|
'$lf_opt'(imports, TOpts, Imports),
|
||||||
'$import_to_current_module'(File, ContextModule, Imports, _, TOpts),
|
'$import_to_current_module'(File, ContextModule, Imports, _, TOpts),
|
||||||
'$current_module'(Mod, SourceModule),
|
'$current_module'(Mod, SourceModule),
|
||||||
|
@ -26,8 +26,7 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
:- module(system('$messages',[]),
|
||||||
:- module(system('$messages'),
|
|
||||||
[system_message/4,
|
[system_message/4,
|
||||||
prefix/2,
|
prefix/2,
|
||||||
prefix/5,
|
prefix/5,
|
||||||
@ -221,7 +220,7 @@ compose_message( loaded(included,AbsFileName,Mod,Time,Space), _Level) --> !,
|
|||||||
[ '~a included in module ~a, ~d msec ~d bytes' -
|
[ '~a included in module ~a, ~d msec ~d bytes' -
|
||||||
[AbsFileName,Mod,Time,Space] ].
|
[AbsFileName,Mod,Time,Space] ].
|
||||||
compose_message( loaded(What,AbsoluteFileName,Mod,Time,Space), _Level) --> !,
|
compose_message( loaded(What,AbsoluteFileName,Mod,Time,Space), _Level) --> !,
|
||||||
[ '~a ~a in module ~a, ~d msec ~d bytes' -
|
[ '~a ~a in module ~a, ~d msec ~g bytes' -
|
||||||
[What, AbsoluteFileName,Mod,Time,Space] ].
|
[What, AbsoluteFileName,Mod,Time,Space] ].
|
||||||
compose_message(signal(SIG,_), _) -->
|
compose_message(signal(SIG,_), _) -->
|
||||||
!,
|
!,
|
||||||
@ -829,8 +828,11 @@ prefix(debug, '~N'-[]).
|
|||||||
prefix(warning, '~N'-[]).
|
prefix(warning, '~N'-[]).
|
||||||
prefix(error, '~N'-[]).
|
prefix(error, '~N'-[]).
|
||||||
prefix(banner, '~N'-[]).
|
prefix(banner, '~N'-[]).
|
||||||
prefix(informational, '~N~*| '-[]) :-
|
prefix(informational, '~N~*|% '-[LC]) :-
|
||||||
('$show_consult_level'(LC) -> true ; LC = 0).
|
'$show_consult_level'(LC),
|
||||||
|
LC > 0,
|
||||||
|
!.
|
||||||
|
prefix(informational, '~N'-[]).
|
||||||
prefix(debug(_), '~N'-[]).
|
prefix(debug(_), '~N'-[]).
|
||||||
|
|
||||||
/* { thread_self(Id) },
|
/* { thread_self(Id) },
|
||||||
@ -1017,15 +1019,15 @@ prolog:print_message(force(_Severity), Msg) :- !,
|
|||||||
print(user_error,Msg).
|
print(user_error,Msg).
|
||||||
% This predicate has more hooks than a pirate ship!
|
% This predicate has more hooks than a pirate ship!
|
||||||
prolog:print_message(Severity, Term) :-
|
prolog:print_message(Severity, Term) :-
|
||||||
prolog:message( Term,Lines0, [ end(Id)]),
|
message( Term,Lines0, [ end(Id)]),
|
||||||
Lines = [begin(Severity, Id)| Lines0],
|
Lines = [begin(Severity, Id)| Lines0],
|
||||||
(
|
(
|
||||||
user:message_hook(Term, Severity, Lines)
|
user:message_hook(Term, Severity, Lines)
|
||||||
->
|
->
|
||||||
true
|
true
|
||||||
;
|
;
|
||||||
prefix( Severity, Prefix ),
|
ignore((prefix( Severity, Prefix ),
|
||||||
prolog:print_message_lines(user_error, Prefix, Lines)
|
prolog:print_message_lines(user_error, Prefix, Lines)))
|
||||||
),
|
),
|
||||||
!.
|
!.
|
||||||
prolog:print_message(Severity, Term) :-
|
prolog:print_message(Severity, Term) :-
|
||||||
@ -1036,10 +1038,12 @@ prolog:print_message(Severity, Term) :-
|
|||||||
->
|
->
|
||||||
true
|
true
|
||||||
;
|
;
|
||||||
prefix( Severity, Prefix ),
|
ignore(( prefix( Severity, Prefix ),
|
||||||
prolog:print_message_lines(user_error, Prefix, Lines)
|
prolog:print_message_lines(user_error, Prefix, Lines)))
|
||||||
),
|
),
|
||||||
!.
|
!.
|
||||||
|
prolog:print_message(_Severity, _Term) :-
|
||||||
|
format(user_error,'failed to print ~w: ~w~n` ,[ _Severity, _Term]).
|
||||||
|
|
||||||
'$error_descriptor'( Info, Info ).
|
'$error_descriptor'( Info, Info ).
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user