NAME

sp_open - open or create

SYNOPSIS

#include <sophia.h>

int sp_open(void *object);

DESCRIPTION

sp_open(env): create environment, open or create pre-defined databases.

sp_open(database): create or open database.

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_open() returns 0. On error, it returns -1.

SEE ALSO

Sophia API