:more db stuff
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
message( " * Sqlite3 Data-Base (http://www.sqlite3ql.org), distributed with MYDDAS" )
|
||||
message( " * Sqlite3 Data-Base (http://www.sqlite3.org), distributed with MYDDAS" )
|
||||
|
||||
set (SQLITE_EXTRA
|
||||
chinook.db
|
||||
@@ -35,23 +35,27 @@ add_definitions(-DSQLITE_ENABLE_FTS5=1 )
|
||||
SET_PROPERTY(DIRECTORY PROPERTY COMPILE_DEFINITIONS YAP_KERNEL=1 )
|
||||
|
||||
|
||||
add_library( Yapsqlite3 OBJECT
|
||||
if (ANDROID)
|
||||
add_library( YAPsqlite3 OBJECT
|
||||
${YAPSQLITE3_SOURCES} )
|
||||
|
||||
else()
|
||||
|
||||
if (NOT ANDROID)
|
||||
add_library( sqlite4YAP SHARED
|
||||
src/sqlite3.c)
|
||||
list(APPEND YAPSQLITE3_SOURCES src/sqlite3.c)
|
||||
|
||||
set_target_properties(sqlite4YAP
|
||||
|
||||
add_library( YAPsqlite3 SHARED
|
||||
${YAPSQLITE3_SOURCES})
|
||||
|
||||
set_target_properties(YAPsqlite3
|
||||
PROPERTIES
|
||||
# RPATH ${libdir} VERSION ${LIBYAPTAI_FULL_VERSION}
|
||||
# SOVERSION ${LIBYAPTAI_MAJOR_VERSION}.${LIBYAPTAI_MINOR_VERSION}
|
||||
POSITION_INDEPENDENT_CODE TRUE
|
||||
)
|
||||
POSITION_INDEPENDENT_CODE ON
|
||||
PREFIX ""
|
||||
)
|
||||
|
||||
|
||||
install(TARGETS sqlite4YAP
|
||||
install(TARGETS YAPsqlite3
|
||||
RUNTIME DESTINATION ${YAP_INSTALL_DLLDIR}
|
||||
ARCHIVE DESTINATION ${YAP_INSTALL_DLLDIR}
|
||||
LIBRARY DESTINATION ${YAP_INSTALL_DLLDIR}
|
||||
|
@@ -36,7 +36,7 @@
|
||||
int i; \
|
||||
i = sqlite3_##f; \
|
||||
if (i != SQLITE_OK) { \
|
||||
Yap_Error(EVALUATION_ERROR_DBMS, t, "%s failed with status %d: %s\n", \
|
||||
Yap_ThrowError(EVALUATION_ERROR_DBMS, MkStringTerm(#f), "%s failed with status %d: %s\n", \
|
||||
#f, i, sqlite3_errmsg(db)); \
|
||||
} \
|
||||
}
|
||||
@@ -46,7 +46,7 @@
|
||||
int i; \
|
||||
i = sqlite3_##f; \
|
||||
if (i != SQLITE_##x) { \
|
||||
fprintf(stderr, "%s failed with status %d: %s\n", #f, i, \
|
||||
Yap_ThrowError(EVALUATION_ERROR_DBMS, MkStringTerm(#f), "%s failed with status %d: %s\n", #f, i, \
|
||||
sqlite3_errmsg(db)); \
|
||||
exit(1); \
|
||||
} \
|
||||
@@ -489,7 +489,7 @@ static Int c_sqlite3_row_terminate(USES_REGS1) {
|
||||
struct result_set *res_set = rs->res_set;
|
||||
sqlite3 *db = res_set->db;
|
||||
// no more data
|
||||
CALL_SQLITE(ARG1, finalize(res_set->stmt));
|
||||
CALL_SQLITE(Deref(ARG1), finalize(res_set->stmt));
|
||||
free(res_set);
|
||||
free(rs);
|
||||
return true;
|
||||
@@ -667,7 +667,7 @@ static void Yap_InitBackMYDDAS_SQLITE3Preds(void) {
|
||||
// Yap_InitCPredBack("c_sqlite3_row", 3, 0, c_sqlite3_row_initialise,
|
||||
// c_sqlite3_row, c_sqlite3_row_terminate);
|
||||
Yap_InitCPred("c_sqlite3_row_initialise", 2, c_sqlite3_row_initialise, 0);
|
||||
Yap_InitCPred("c_sqlite3_row_terminate", 1, c_sqlite3_row_terminate, 0);
|
||||
Yap_InitCPred("c_sqlite3_row_terminate", 2, c_sqlite3_row_terminate, 0);
|
||||
Yap_InitCPredBack("c_sqlite3_row_get", 4, 0, c_sqlite3_row, c_sqlite3_row, 0);
|
||||
}
|
||||
|
||||
|
@@ -12,7 +12,8 @@ main_ :-
|
||||
main_ .
|
||||
|
||||
init :-
|
||||
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', _, _),
|
||||
db_open(sqlite3, 'chinook.db', _, _),
|
||||
writeln('chinook has landed').
|
||||
|
||||
go :-
|
||||
@@ -75,7 +76,6 @@ go :-
|
||||
writeln(X:Y).
|
||||
|
||||
go_cut0 :-
|
||||
start_low_level_trace,
|
||||
artists(X,Y),
|
||||
writeln(X:Y),
|
||||
!.
|
||||
|
Reference in New Issue
Block a user