warning, postgres
This commit is contained in:
parent
8f90705e26
commit
63c2fa3c6b
@ -22,7 +22,7 @@ YAPLIBDIR=@libdir@/Yap
|
||||
CC=@CC@
|
||||
YAP_EXTRAS=@YAP_EXTRAS@
|
||||
CFLAGS= $(YAP_EXTRAS) @SHLIB_CFLAGS@ $(YAP_EXTRAS) $(DEFS) -I$(srcdir) -I../.. -I$(srcdir)/../../include -I$(srcdir)/../../H -I$(srcdir)/../../OPTYap -I$(srcdir)/../../os @MYDDAS_CPPFLAGS@
|
||||
LDFLAGS=@LDFLAGS@
|
||||
LDFLAGS=@LDFLAGS@ @MYDDAS_LDFLAGS@
|
||||
ECPP=@ECPP@
|
||||
#
|
||||
#
|
||||
|
@ -5,7 +5,7 @@
|
||||
/* myddas_initialization.c */
|
||||
MYDDAS_GLOBAL myddas_init_initialize_myddas(void);
|
||||
MYDDAS_UTIL_CONNECTION myddas_init_initialize_connection(void *,void *,MYDDAS_API,MYDDAS_UTIL_CONNECTION);
|
||||
MYDDAS_UTIL_PREDICATE myddas_init_initialize_predicate(char *, int, char *,MYDDAS_UTIL_PREDICATE);
|
||||
MYDDAS_UTIL_PREDICATE myddas_init_initialize_predicate(const char *, int, const char *,MYDDAS_UTIL_PREDICATE);
|
||||
|
||||
#ifdef MYDDAS_STATS
|
||||
/* myddas_statistics.c */
|
||||
@ -22,8 +22,8 @@ Short myddas_util_connection_type(void *);
|
||||
MYDDAS_UTIL_CONNECTION myddas_util_add_connection(void *,void *,MYDDAS_API);
|
||||
MYDDAS_UTIL_CONNECTION myddas_util_search_connection(void *);
|
||||
void myddas_util_delete_connection(void *);
|
||||
MYDDAS_UTIL_CONNECTION myddas_util_add_predicate(char * ,Int , char *,void *);
|
||||
MYDDAS_UTIL_PREDICATE myddas_util_search_predicate(char * ,Int , char *);
|
||||
MYDDAS_UTIL_CONNECTION myddas_util_add_predicate(const char * ,Int , const char *,void *);
|
||||
MYDDAS_UTIL_PREDICATE myddas_util_search_predicate(const char * ,Int , const char *);
|
||||
void myddas_util_delete_predicate(MYDDAS_UTIL_PREDICATE);
|
||||
|
||||
/* Get's the number of queries to save */
|
||||
@ -36,8 +36,8 @@ SQLHENV myddas_util_get_odbc_enviromment(SQLHDBC);
|
||||
|
||||
void * myddas_util_get_list_pred(MYDDAS_UTIL_CONNECTION);
|
||||
void * myddas_util_get_pred_next(void *);
|
||||
char * myddas_util_get_pred_module(void *);
|
||||
char * myddas_util_get_pred_name(void *);
|
||||
const char * myddas_util_get_pred_module(void *);
|
||||
const char * myddas_util_get_pred_name(void *);
|
||||
MyddasInt myddas_util_get_pred_arity(void *);
|
||||
//DELETE THIS WHEN DB_STATS IS COMPLETED
|
||||
MyddasInt get_myddas_top(void);
|
||||
|
@ -4,6 +4,7 @@ AC_DEFINE_UNQUOTED(MYDDAS_VERSION, $MYDDAS_VERSION, [myddas release])
|
||||
OLD_LIBS="$LIBS"
|
||||
OLD_CPPFLAGS="$CPPFLAGS"
|
||||
MYDDAS_CPPFLAGS=""
|
||||
MYDDAS_LDFLAGS=""
|
||||
|
||||
AC_ARG_ENABLE(myddas,
|
||||
[ --enable-myddas[[=DIR]] with the MYDDAS library],
|
||||
@ -14,6 +15,7 @@ AC_ARG_ENABLE(myddas,
|
||||
else
|
||||
yap_cv_myddas=$withval
|
||||
LDFLAGS="$LDFLAGS -L${yap_cv_myddas}/lib "
|
||||
MYDDAS_LDFLAGS+=" -L${yap_cv_myddas}/lib "
|
||||
CPPFLAGS="$CPPFLAGS -I${yap_cv_myddas}/include "
|
||||
MYDDAS_CPPFLAGS="$MYDDAS_CPPFLAGS -I${yap_cv_myddas}/include "
|
||||
fi,
|
||||
@ -28,6 +30,7 @@ AC_ARG_WITH(mysql,
|
||||
else
|
||||
yap_cv_mysql=$withval
|
||||
LDFLAGS="$LDFLAGS -L${yap_cv_mysql}/lib "
|
||||
MYDDAS_LDFLAGS+=" -L${yap_cv_mysql}/lib "
|
||||
CPPFLAGS="$CPPFLAGS -I${yap_cv_mysql}/include "
|
||||
MYDDAS_CPPFLAGS="$MYDDAS_CPPFLAGS -I${yap_cv_mysql}/include "
|
||||
fi,
|
||||
@ -42,6 +45,7 @@ AC_ARG_WITH(odbc,
|
||||
else
|
||||
yap_cv_odbc=$withval
|
||||
LDFLAGS="$LDFLAGS -L${yap_cv_odbc}/lib "
|
||||
MYDDAS_LDFLAGS+=" -L${yap_cv_odbc}/lib "
|
||||
CPPFLAGS="$CPPFLAGS -I${yap_cv_odbc}/include "
|
||||
MYDDAS_CPPFLAGS="$MYDDAS_CPPFLAGS -I${yap_cv_odbc}/include "
|
||||
fi,
|
||||
@ -56,6 +60,7 @@ AC_ARG_WITH(sqlite3,
|
||||
else
|
||||
yap_cv_sqlite3=$withval
|
||||
LDFLAGS="$LDFLAGS -L${yap_cv_sqlite3}/lib "
|
||||
MYDDAS_LDFLAGS+=" -L${yap_cv_sqlite3}/lib "
|
||||
CPPFLAGS="$CPPFLAGS -I${yap_cv_sqlite3}/include "
|
||||
MYDDAS_CPPFLAGS="$MYDDAS_CPPFLAGS -I${yap_cv_sqlite3}/include "
|
||||
fi,
|
||||
@ -70,6 +75,7 @@ AC_ARG_WITH(postgres,
|
||||
else
|
||||
yap_cv_postgres=$withval
|
||||
LDFLAGS="$LDFLAGS -L${yap_cv_postgres}/lib "
|
||||
MYDDAS_LDFLAGS+=" -L${yap_cv_postgres}/lib "
|
||||
CPPFLAGS="$CPPFLAGS -I${yap_cv_postgres}/include "
|
||||
MYDDAS_CPPFLAGS="$MYDDAS_CPPFLAGS -I${yap_cv_postgres}/include "
|
||||
fi,
|
||||
@ -188,7 +194,9 @@ then
|
||||
fi
|
||||
|
||||
|
||||
MYDDAS_LIBS="$LIBS"
|
||||
MYDDAS_LDFLAGS="$LDFLAGS"
|
||||
MYDDAS_LIBS="$LIBS"
|
||||
MYDDAS_LIBS="$LIBS"
|
||||
LIBS="$OLD_LIBS"
|
||||
CPPFLAGS="$OLD_CPPFLAGS"
|
||||
else
|
||||
@ -206,3 +214,4 @@ AC_SUBST(PKG_MYDDAS)
|
||||
AC_SUBST(OBJECTS_MYDDAS)
|
||||
AC_SUBST(MYDDAS_CPPFLAGS)
|
||||
AC_SUBST(MYDDAS_LIBS)
|
||||
AC_SUBST(MYDDAS_LDFLAGS)
|
||||
|
@ -88,8 +88,8 @@ myddas_init_initialize_connection(void *conn,void *enviromment,
|
||||
}
|
||||
|
||||
MYDDAS_UTIL_PREDICATE
|
||||
myddas_init_initialize_predicate(char *pred_name, int pred_arity,
|
||||
char *pred_module, MYDDAS_UTIL_PREDICATE next){
|
||||
myddas_init_initialize_predicate(const char *pred_name, int pred_arity,
|
||||
const char *pred_module, MYDDAS_UTIL_PREDICATE next){
|
||||
CACHE_REGS
|
||||
MYDDAS_UTIL_PREDICATE new = NULL;
|
||||
MYDDAS_MALLOC(new,struct myddas_list_preds);
|
||||
|
@ -317,9 +317,9 @@ c_db_odbc_connect( USES_REGS1 ) {
|
||||
|
||||
MYDDAS_UTIL_CONNECTION new = NULL;
|
||||
|
||||
char *driver = AtomName(AtomOfTerm(arg_driver));
|
||||
char *user = AtomName(AtomOfTerm(arg_user));
|
||||
char *passwd = AtomName(AtomOfTerm(arg_passwd));
|
||||
const char *driver = AtomName(AtomOfTerm(arg_driver));
|
||||
const char *user = AtomName(AtomOfTerm(arg_user));
|
||||
const char *passwd = AtomName(AtomOfTerm(arg_passwd));
|
||||
|
||||
SQLHENV henv;
|
||||
SQLHDBC hdbc;
|
||||
@ -447,7 +447,7 @@ c_db_odbc_number_of_fields( USES_REGS1 ) {
|
||||
Term arg_fields = Deref(ARG3);
|
||||
|
||||
|
||||
char *relation = AtomName(AtomOfTerm(arg_relation));
|
||||
const char *relation = AtomName(AtomOfTerm(arg_relation));
|
||||
|
||||
SQLHDBC hdbc =(SQLHDBC) (IntegerOfTerm(arg_conn));
|
||||
SQLHSTMT hstmt;
|
||||
@ -487,7 +487,7 @@ c_db_odbc_get_attributes_types( USES_REGS1 ) {
|
||||
Term arg_conn = Deref(ARG2);
|
||||
Term arg_types_list = Deref(ARG3);
|
||||
|
||||
char *relation = AtomName(AtomOfTerm(arg_relation));
|
||||
const char *relation = AtomName(AtomOfTerm(arg_relation));
|
||||
SQLHDBC hdbc =(SQLHDBC) (IntegerOfTerm(arg_conn));
|
||||
SQLHSTMT hstmt;
|
||||
|
||||
@ -690,7 +690,7 @@ c_db_odbc_number_of_fields_in_query( USES_REGS1 ) {
|
||||
Term arg_conn = Deref(ARG2);
|
||||
Term arg_fields = Deref(ARG3);
|
||||
|
||||
char *sql = AtomName(AtomOfTerm(arg_query));
|
||||
const char *sql = AtomName(AtomOfTerm(arg_query));
|
||||
|
||||
SQLHDBC hdbc =(SQLHDBC) (IntegerOfTerm(arg_conn));
|
||||
SQLHSTMT hstmt;
|
||||
|
@ -428,8 +428,8 @@ c_postgres_query( USES_REGS1 ) {
|
||||
Term arg_mode = Deref(ARG4);
|
||||
Term arg_arity = ARG5;
|
||||
|
||||
char *sql = AtomName(AtomOfTerm(arg_sql_query));
|
||||
char *mode = AtomName(AtomOfTerm(arg_mode));
|
||||
const char *sql = AtomName(AtomOfTerm(arg_sql_query));
|
||||
const char *mode = AtomName(AtomOfTerm(arg_mode));
|
||||
PGresult *res;
|
||||
PGconn *db = AddressOfTerm(arg_db);
|
||||
|
||||
@ -507,7 +507,7 @@ c_postgres_number_of_fields( USES_REGS1 ) {
|
||||
Term arg_db = Deref(ARG2);
|
||||
Term arg_fields = ARG3;
|
||||
|
||||
char *relation = AtomName(AtomOfTerm(arg_relation));
|
||||
const char *relation = AtomName(AtomOfTerm(arg_relation));
|
||||
PGconn *db = AddressOfTerm(arg_db);
|
||||
const char *stmt;
|
||||
PGresult *res;
|
||||
@ -537,10 +537,10 @@ c_postgres_get_attributes_types( USES_REGS1 ) {
|
||||
Term arg_types_list = Deref(ARG3);
|
||||
Term list, head;
|
||||
|
||||
char *relation = AtomName(AtomOfTerm(arg_relation));
|
||||
const char *relation = AtomName(AtomOfTerm(arg_relation));
|
||||
PGconn *db = AddressOfTerm(arg_db);
|
||||
char sql[256];
|
||||
int row;
|
||||
//int row;
|
||||
PGresult *res;
|
||||
|
||||
const char *stmt;
|
||||
@ -548,6 +548,8 @@ c_postgres_get_attributes_types( USES_REGS1 ) {
|
||||
|
||||
sprintf(sql,"SELECT * FROM TABLE `%s`",relation);
|
||||
// Leave data for extraction
|
||||
stmt = AtomName(Yap_LookupAtom(sql));
|
||||
// Leave data for extraction
|
||||
GET_POSTGRES (prepare(db, stmt, sql, 0, NULL), res );
|
||||
|
||||
/* executar a query SQL */
|
||||
@ -642,7 +644,7 @@ c_postgres_get_fields_properties( USES_REGS1 ) {
|
||||
Term head, list;
|
||||
PGresult *res;
|
||||
|
||||
char *relation = AtomName(AtomOfTerm(nome_relacao));
|
||||
const char *relation = AtomName(AtomOfTerm(nome_relacao));
|
||||
char sql[256];
|
||||
Int num_fields,i;
|
||||
PGconn *db = AddressOfTerm(arg_db);
|
||||
@ -821,7 +823,7 @@ c_postgres_row( USES_REGS1 ) {
|
||||
PGresult *res;
|
||||
while((res = PQgetResult(res_set->db)) != NULL);
|
||||
int i;
|
||||
if (i == res_set->nrows) {
|
||||
if ((i = res_set->nrows) == 0) {
|
||||
// no more data
|
||||
PQfinish( res_set->db );
|
||||
free(res_set);
|
||||
|
@ -154,8 +154,8 @@ c_db_add_preds ( USES_REGS1 ){
|
||||
/* pe = RepPredProp(PredPropByFunc(FunctorOfTerm(arg_pred),arg_module)); */
|
||||
|
||||
|
||||
char *nome = AtomName(AtomOfTerm(arg_nome));
|
||||
char *module = AtomName(AtomOfTerm(arg_module));
|
||||
const char *nome = AtomName(AtomOfTerm(arg_nome));
|
||||
const char *module = AtomName(AtomOfTerm(arg_module));
|
||||
Int aridade = IntegerOfTerm(arg_aridade);
|
||||
Int *conn = (Int *) IntegerOfTerm(arg_conn);
|
||||
|
||||
@ -178,8 +178,8 @@ c_db_check_if_exists_pred ( USES_REGS1 ){
|
||||
Term arg_module = Deref(ARG3);
|
||||
|
||||
|
||||
char *nome = AtomName(AtomOfTerm(arg_nome));
|
||||
char *module = AtomName(AtomOfTerm(arg_module));
|
||||
const char *nome = AtomName(AtomOfTerm(arg_nome));
|
||||
const char *module = AtomName(AtomOfTerm(arg_module));
|
||||
Int aridade = IntegerOfTerm(arg_aridade);
|
||||
|
||||
if (myddas_util_search_predicate(nome,aridade,module) == NULL)
|
||||
@ -195,8 +195,8 @@ c_db_delete_predicate( USES_REGS1 ){
|
||||
Term arg_name = Deref(ARG2);
|
||||
Term arg_arity = Deref(ARG3);
|
||||
|
||||
char *module = AtomName(AtomOfTerm(arg_module));
|
||||
char *name = AtomName(AtomOfTerm(arg_name));
|
||||
const char *module = AtomName(AtomOfTerm(arg_module));
|
||||
const char *name = AtomName(AtomOfTerm(arg_name));
|
||||
Int arity = IntegerOfTerm(arg_arity);
|
||||
|
||||
MYDDAS_UTIL_PREDICATE predicate =
|
||||
|
@ -28,8 +28,8 @@ struct myddas_global {
|
||||
};
|
||||
|
||||
struct myddas_list_preds {
|
||||
char *pred_module;
|
||||
char *pred_name;
|
||||
const char *pred_module;
|
||||
const char *pred_name;
|
||||
short pred_arity;
|
||||
//void *pe;
|
||||
MYDDAS_UTIL_PREDICATE next;
|
||||
|
@ -23,7 +23,7 @@
|
||||
|
||||
/* Search for the predicate in the given predicate list*/
|
||||
static MYDDAS_UTIL_PREDICATE
|
||||
myddas_util_find_predicate(char *, Int , char *, MYDDAS_UTIL_PREDICATE);
|
||||
myddas_util_find_predicate(const char *, Int , const char *, MYDDAS_UTIL_PREDICATE);
|
||||
/* Deletes a predicate list */
|
||||
static void
|
||||
myddas_util_delete_predicate_list(MYDDAS_UTIL_PREDICATE);
|
||||
@ -58,8 +58,8 @@ myddas_util_connection_type(void *con){
|
||||
|
||||
|
||||
MYDDAS_UTIL_PREDICATE
|
||||
myddas_util_search_predicate(char *pred_name, Int pred_arity,
|
||||
char *pred_module){
|
||||
myddas_util_search_predicate(const char *pred_name, Int pred_arity,
|
||||
const char *pred_module){
|
||||
CACHE_REGS
|
||||
MYDDAS_UTIL_PREDICATE pred=NULL;
|
||||
MYDDAS_UTIL_CONNECTION top = Yap_REGS.MYDDAS_GLOBAL_POINTER->myddas_top_connections;
|
||||
@ -75,8 +75,8 @@ myddas_util_search_predicate(char *pred_name, Int pred_arity,
|
||||
/* When using this function, we must guarante that this predicate
|
||||
it's unique */
|
||||
MYDDAS_UTIL_CONNECTION
|
||||
myddas_util_add_predicate(char *pred_name, Int pred_arity,
|
||||
char *pred_module, void *con){
|
||||
myddas_util_add_predicate(const char *pred_name, Int pred_arity,
|
||||
const char *pred_module, void *con){
|
||||
|
||||
MYDDAS_UTIL_CONNECTION node_con =
|
||||
myddas_util_search_connection(con);
|
||||
@ -231,8 +231,8 @@ void myddas_util_error_message(char *message ,Int line,char *file){
|
||||
}
|
||||
|
||||
static MYDDAS_UTIL_PREDICATE
|
||||
myddas_util_find_predicate(char *pred_name, Int pred_arity,
|
||||
char *pred_module, MYDDAS_UTIL_PREDICATE list){
|
||||
myddas_util_find_predicate(const char *pred_name, Int pred_arity,
|
||||
const char *pred_module, MYDDAS_UTIL_PREDICATE list){
|
||||
|
||||
for(;list != NULL ; list = list->next)
|
||||
if (pred_arity == list->pred_arity &&
|
||||
@ -348,13 +348,13 @@ myddas_util_get_pred_arity(void *pointer){
|
||||
return temp->pred_arity;
|
||||
}
|
||||
|
||||
char *
|
||||
const char *
|
||||
myddas_util_get_pred_name(void *pointer){
|
||||
MYDDAS_UTIL_PREDICATE temp = (MYDDAS_UTIL_PREDICATE) pointer;
|
||||
return temp->pred_name;
|
||||
}
|
||||
|
||||
char *
|
||||
const char *
|
||||
myddas_util_get_pred_module(void *pointer){
|
||||
MYDDAS_UTIL_PREDICATE temp = (MYDDAS_UTIL_PREDICATE) pointer;
|
||||
return temp->pred_module;
|
||||
|
Reference in New Issue
Block a user