myddas cleanups
This commit is contained in:
parent
db0deea576
commit
a82a72fc14
@ -35,7 +35,10 @@ include(Sources NO_POLICY_SCOPE)
|
|||||||
|
|
||||||
include(Model NO_POLICY_SCOPE)
|
include(Model NO_POLICY_SCOPE)
|
||||||
|
|
||||||
include_directories ( utf8proc packages/myddas packages/myddas/sqlite3 packages/myddas/sqlite3/Android/jni/sqlite/nativehelper packages/myddas/sqlite3/Android/jni/sqlite/ )
|
include_directories ( utf8proc packages/myddas packages/myddas/sqlite3 )
|
||||||
|
if (ANDROID)
|
||||||
|
include_directories ( packages/myddas/sqlite3/Android/jni/sqlite/nativehelper packages/myddas/sqlite3/Android/jni/sqlite )
|
||||||
|
endif (ANDROID)
|
||||||
add_definitions(-DUSE_MYDDAS=1 -DMYDDAS_SQLITE3=1)
|
add_definitions(-DUSE_MYDDAS=1 -DMYDDAS_SQLITE3=1)
|
||||||
|
|
||||||
if (MYSQL_FOUND)
|
if (MYSQL_FOUND)
|
||||||
|
@ -10,6 +10,7 @@ extern MYDDAS_UTIL_CONNECTION
|
|||||||
extern MYDDAS_UTIL_PREDICATE myddas_init_initialize_predicate(const char *, int,
|
extern MYDDAS_UTIL_PREDICATE myddas_init_initialize_predicate(const char *, int,
|
||||||
const char *,
|
const char *,
|
||||||
MYDDAS_UTIL_PREDICATE);
|
MYDDAS_UTIL_PREDICATE);
|
||||||
|
extern int myddas_util_connection_type(void *con);
|
||||||
|
|
||||||
#ifdef MYDDAS_STATS
|
#ifdef MYDDAS_STATS
|
||||||
/* myddas_statistics.c */
|
/* myddas_statistics.c */
|
||||||
|
@ -5,6 +5,7 @@ set( YAPSQLITE3_SOURCES
|
|||||||
sqlite3.h
|
sqlite3.h
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if (ANDROID)
|
||||||
set( YAPSQLITE3_ANDROID_SOURCES
|
set( YAPSQLITE3_ANDROID_SOURCES
|
||||||
Android/jni/sqlite/JNIHelp.cpp
|
Android/jni/sqlite/JNIHelp.cpp
|
||||||
Android/jni/sqlite/JniConstants.cpp
|
Android/jni/sqlite/JniConstants.cpp
|
||||||
@ -13,7 +14,12 @@ Android/jni/sqlite/android_database_SQLiteCommon.h
|
|||||||
Android/jni/sqlite/android_database_SQLiteConnection.cpp
|
Android/jni/sqlite/android_database_SQLiteConnection.cpp
|
||||||
Android/jni/sqlite/android_database_SQLiteDebug.cpp
|
Android/jni/sqlite/android_database_SQLiteDebug.cpp
|
||||||
Android/jni/sqlite/android_database_SQLiteGlobal.cpp
|
Android/jni/sqlite/android_database_SQLiteGlobal.cpp
|
||||||
)
|
)
|
||||||
|
set( YAPSQLITE3_ANDROID_DIRS
|
||||||
|
Android/jni/sqlite
|
||||||
|
Android/jni/sqlite/nativehelper
|
||||||
|
)
|
||||||
|
endif (ANDROID)
|
||||||
|
|
||||||
#sqlite3 is now in the system
|
#sqlite3 is now in the system
|
||||||
|
|
||||||
@ -27,15 +33,12 @@ set (MYDDAS_FLAGS ${MYDDAS_FLAGS} ON PARENT_SCOPE)
|
|||||||
set_property(GLOBAL APPEND PROPERTY COMPILE_DEFINITIONS
|
set_property(GLOBAL APPEND PROPERTY COMPILE_DEFINITIONS
|
||||||
-DMYDDAS_SQLITE3=1)
|
-DMYDDAS_SQLITE3=1)
|
||||||
|
|
||||||
include_directories ( ${CMAKE_CURRENT_SOURCE_DIR}/.. ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/Android/jni/sqlite ${CMAKE_CURRENT_SOURCE_DIR}/Android/jni/sqlite/nativehelper)
|
include_directories ( ${CMAKE_CURRENT_SOURCE_DIR}/.. ${CMAKE_CURRENT_SOURCE_DIR} ${YAPSQLITE3_ANDROID_DIRS})
|
||||||
|
|
||||||
|
|
||||||
if (ANDROID)
|
add_component (Yapsqlite3 ${YAPSQLITE3_SOURCES} ${YAPSQLITE3_ANDROID_SOURCES})
|
||||||
add_external (Yapsqlite3 ${YAPSQLITE3_SOURCES} ${YAPSQLITE3_ANDROID_SOURCES})
|
if (NOT ANDROID)
|
||||||
else()
|
#target_link_libraries(Yapsqlite3 libYap)
|
||||||
add_component (Yapsqlite3 ${YAPSQLITE3_SOURCES} )
|
|
||||||
|
|
||||||
#xtarget_link_libraries(Yapsqlite3 libYap)
|
|
||||||
set_target_properties (Yapsqlite3 PROPERTIES
|
set_target_properties (Yapsqlite3 PROPERTIES
|
||||||
PREFIX ""
|
PREFIX ""
|
||||||
)
|
)
|
||||||
|
@ -275,11 +275,10 @@ static Int c_sqlite3_query(USES_REGS1) {
|
|||||||
Term arg_sql_query = Deref(ARG1);
|
Term arg_sql_query = Deref(ARG1);
|
||||||
Term arg_result_set = Deref(ARG2);
|
Term arg_result_set = Deref(ARG2);
|
||||||
Term arg_db = Deref(ARG3);
|
Term arg_db = Deref(ARG3);
|
||||||
Term arg_mode = Deref(ARG4);
|
// Term arg_mode = Deref(ARG4); // ignored by SQLite3
|
||||||
Term arg_arity = Deref(ARG5);
|
Term arg_arity = Deref(ARG5);
|
||||||
|
|
||||||
const char *sql = AtomName(AtomOfTerm(arg_sql_query));
|
const char *sql = AtomName(AtomOfTerm(arg_sql_query));
|
||||||
const char *mode = AtomName(AtomOfTerm(arg_mode));
|
|
||||||
sqlite3 *db = AddressOfTerm(arg_db);
|
sqlite3 *db = AddressOfTerm(arg_db);
|
||||||
sqlite3_stmt *stmt;
|
sqlite3_stmt *stmt;
|
||||||
|
|
||||||
@ -287,7 +286,6 @@ static Int c_sqlite3_query(USES_REGS1) {
|
|||||||
MYDDAS_STATS_TIME start, end;
|
MYDDAS_STATS_TIME start, end;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int length = strlen(sql);
|
|
||||||
struct result_set *rs = malloc(sizeof(struct result_set));
|
struct result_set *rs = malloc(sizeof(struct result_set));
|
||||||
if (!rs)
|
if (!rs)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@ -529,12 +527,6 @@ static Int c_sqlite3_row_cut(USES_REGS1) {
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define cvt(s) cvt__(s PASS_REGS)
|
|
||||||
|
|
||||||
static Term cvt__(const char *s USES_REGS) {
|
|
||||||
return Yap_CharsToTDQ(s, CurrentModule, LOCAL_encoding PASS_REGS);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* db_row: ResultSet x Arity_ListOfArgs x ListOfArgs -> */
|
/* db_row: ResultSet x Arity_ListOfArgs x ListOfArgs -> */
|
||||||
static Int c_sqlite3_row(USES_REGS1) {
|
static Int c_sqlite3_row(USES_REGS1) {
|
||||||
#ifdef MYDDAS_STATS
|
#ifdef MYDDAS_STATS
|
||||||
|
@ -26349,7 +26349,6 @@ SQLITE_PRIVATE DWORD sqlite3Win32Wait(HANDLE hObject); /* os_win.c */
|
|||||||
/* Get the results of the thread */
|
/* Get the results of the thread */
|
||||||
SQLITE_PRIVATE int sqlite3ThreadJoin(SQLiteThread *p, void **ppOut){
|
SQLITE_PRIVATE int sqlite3ThreadJoin(SQLiteThread *p, void **ppOut){
|
||||||
DWORD rc;
|
DWORD rc;
|
||||||
BOOL bRc;
|
|
||||||
|
|
||||||
assert( ppOut!=0 );
|
assert( ppOut!=0 );
|
||||||
if( NEVER(p==0) ) return SQLITE_NOMEM_BKPT;
|
if( NEVER(p==0) ) return SQLITE_NOMEM_BKPT;
|
||||||
@ -26361,8 +26360,7 @@ SQLITE_PRIVATE int sqlite3ThreadJoin(SQLiteThread *p, void **ppOut){
|
|||||||
assert( p->id!=0 && p->id!=GetCurrentThreadId() );
|
assert( p->id!=0 && p->id!=GetCurrentThreadId() );
|
||||||
rc = sqlite3Win32Wait((HANDLE)p->tid);
|
rc = sqlite3Win32Wait((HANDLE)p->tid);
|
||||||
assert( rc!=WAIT_IO_COMPLETION );
|
assert( rc!=WAIT_IO_COMPLETION );
|
||||||
bRc = CloseHandle((HANDLE)p->tid);
|
assert( CloseHandle((HANDLE)p->tid) );
|
||||||
assert( bRc );
|
|
||||||
}
|
}
|
||||||
if( rc==WAIT_OBJECT_0 ) *ppOut = p->pResult;
|
if( rc==WAIT_OBJECT_0 ) *ppOut = p->pResult;
|
||||||
sqlite3_free(p);
|
sqlite3_free(p);
|
||||||
|
Reference in New Issue
Block a user