Skip to content

Commit

Permalink
added the missing function body for wg_attach_logged_database()
Browse files Browse the repository at this point in the history
  • Loading branch information
Priit Järv committed Jan 12, 2014
1 parent 5eb9cae commit 04f76e2
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
23 changes: 23 additions & 0 deletions Db/dbmem.c
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,29 @@ void* wg_attach_existing_database(char* dbasename){
return shm;
}

/** returns a pointer to the existing database, NULL if failure.
*
* Starts journal logging in the database.
*/

void* wg_attach_logged_database(char* dbasename, gint size){
void* shm = wg_attach_memsegment(dbasename, size, size, 1, 1);
if(shm) {
int err;
/* Check the header for compatibility.
* XXX: this is not required for a fresh database. */
if((err = wg_check_header_compat(dbmemsegh(shm)))) {
if(err < -1) {
show_memory_error("Existing segment header is incompatible");
wg_print_code_version();
wg_print_header_version(dbmemsegh(shm));
}
return NULL;
}
}
return shm;
}


/** Attach to shared memory segment.
* Normally called internally by wg_attach_database()
Expand Down
1 change: 1 addition & 0 deletions wgdb.def
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ LIBRARY WGDB
EXPORTS
wg_attach_database
wg_attach_existing_database
wg_attach_logged_database
wg_detach_database
wg_delete_database
wg_create_record
Expand Down

0 comments on commit 04f76e2

Please sign in to comment.