USE_MYDDAS when we have a driver for the DBMS

This commit is contained in:
Vítor Santos Costa
2015-02-10 09:17:59 +00:00
parent 350caa388b
commit 081b2a464e
7 changed files with 221 additions and 184 deletions

View File

@@ -1,4 +1,4 @@
#if defined MYDDAS_ODBC || defined MYDDAS_MYSQL || defined MYDDAS_SQLITE3
#ifdef USE_MYDDAS
#include <stdio.h>
#include <stdlib.h>
@@ -15,13 +15,13 @@
MYDDAS_GLOBAL
myddas_init_initialize_myddas(void){
MYDDAS_GLOBAL global = NULL;
/* We cannot call MYDDAS_MALLOC were because the global
register isn't yet initialized */
global = (MYDDAS_GLOBAL) malloc (sizeof(struct myddas_global));
#ifdef DEBUG
printf ("MALLOC %p %s %d\n",global,__FILE__,__LINE__);
#endif
#endif
global->myddas_top_connections = NULL;
#ifdef MYDDAS_TOP_LEVEL
global->myddas_top_level_connection = NULL;
@@ -30,7 +30,7 @@ myddas_init_initialize_myddas(void){
global->myddas_statistics = (MYDDAS_GLOBAL_STATS) malloc (sizeof(struct myddas_global_stats));
#ifdef DEBUG
printf ("MALLOC %p %s %d\n",global->myddas_statistics,__FILE__,__LINE__);
#endif
#endif
global->myddas_statistics->stats = NULL;
#endif
@@ -46,18 +46,18 @@ myddas_init_initialize_myddas(void){
global->free_called = 0;
global->memory_freed = 0;
#endif
return global;
}
/* Inserts the new node on the front of the list */
MYDDAS_UTIL_CONNECTION
MYDDAS_UTIL_CONNECTION
myddas_init_initialize_connection(void *conn,void *enviromment,
MYDDAS_UTIL_CONNECTION next){
CACHE_REGS
MYDDAS_UTIL_CONNECTION new = NULL;
MYDDAS_MALLOC(new,struct myddas_list_connection);
if (new == NULL)
{
return NULL;
@@ -74,11 +74,11 @@ myddas_init_initialize_connection(void *conn,void *enviromment,
/* List integrity */
new->next=next;
new->previous=NULL;
/* If there's already at least one node
/* If there's already at least one node
on the list */
if (next != NULL)
next->previous=new;
#ifdef MYDDAS_STATS
new->stats = NULL;
new->stats = myddas_stats_initialize_connection_stats();
@@ -86,30 +86,30 @@ myddas_init_initialize_connection(void *conn,void *enviromment,
return new;
}
MYDDAS_UTIL_PREDICATE
MYDDAS_UTIL_PREDICATE
myddas_init_initialize_predicate(char *pred_name, int pred_arity,
char *pred_module, MYDDAS_UTIL_PREDICATE next){
CACHE_REGS
MYDDAS_UTIL_PREDICATE new = NULL;
MYDDAS_MALLOC(new,struct myddas_list_preds);
if (new == NULL)
if (new == NULL)
{
return NULL;
}
new->pred_name=pred_name;
new->pred_arity=pred_arity;
new->pred_module=pred_module;
/* List integrity */
new->next=next;
new->previous=NULL;
/* If there's already at least one node
/* If there's already at least one node
on the list */
if (next != NULL)
next->previous=new;
return new;
}
#endif
#endif