tags:

views:

178

answers:

1

Hello,

I'm exploring a piece of software making use of Oracle API and as far as I can see often object methods expect as an argument a "OCCI context" or a "OCCI environment" values.

An example is a constructor of an Account object:

Account( oracle::occi::Environment* env );

later overloaded with

Account( void* oraCtx );

I can understand that somehow they have to do with sort of a "connection handler", but I'd like to know more.

I googled around but I couldn't find anything clear enough for me, it seems every doc starts from the assumption you already know Oracle API.

Thanks.

+3  A: 

OCCI Environment lets you define your own memory management functions which OCCI will later use.

When you create an environment, you pass the pointers to your own malloc, realloc and free:

static Environment * createEnvironment(Mode mode = DEFAULT,
   void *ctxp = 0,
   void *(*malocfp)(void *ctxp, size_t size) = 0,
   void *(*ralocfp)(void *ctxp, void *memptr, size_t newsize) = 0,
   void (*mfreefp)(void *ctxp, void *memptr) = 0);

Context is just a pointer to an Environment that is passed to these functions when OCCI calls them.

Quassnoi