NAME

sp_env - create a new environment handle

SYNOPSIS

#include <sophia.h>

void *sp_env(void);

DESCRIPTION

The sp_env() function allocates new Sophia environment object.

The object is intended for usage by sp_open() and must be configured first. After using, an object should be freed by sp_destroy().

Please take a look at Configuration, and Database administration sections.

Common workflow is described here.

EXAMPLE

void *env = sp_env();
sp_setstring(env, "sophia.path", "./storage", 0);
sp_setstring(env, "db", "test", 0);
sp_open(env);
void *db = sp_getobject(env, "db.test");
/* do transactions */
sp_destroy(env);

RETURN VALUE

On success, sp_env() allocates new environment object pointer. On error, it returns NULL.

SEE ALSO

Sophia API