)I,Berkeley DB: DbMpoolFile::get[P

DbMpoolFile::get





#include <db_cxx.h>

intEDbMpoolFile::get(db_pgno_t *pgnoaddr, u_int32_t flags, void **pagep);





Description



FThe DbMpoolFile::get method copies a pointer to the page with the page@number specified by pgnoaddr, from the source file in thetDbMpoolFile, into the memory location referenced by pagep.HIf the page does not exist or cannot be retrieved, DbMpoolFile::get willfail.

?Page numbers begin at 0, i.e., the first page in the file is%page number 0, not page number 1.

0The returned page is size_t type aligned.

VThe flags argument is specified by logically OR'ing together one or moreof the following values:

Y

DB_MPOOL_CREATE
If the specified page does not exist, create it. In this case,?the pgin method,if specified, is called.X

DB_MPOOL_LAST
Return the last page of the source file and copy its page number.to the location referenced by pgnoaddr.]

DB_MPOOL_NEW
Create a new page in the file and copy its page number to the location-referenced by pgnoaddr. In this case,?the pgin method,#if specified, is not called.


FThe DB_MPOOL_CREATE, DB_MPOOL_LAST and DB_MPOOL_NEW flags are mutually exclusive.

GCreated pages have all their bytes set to 0, unless otherwise specifiedwhen the file was opened.

=All pages returned by DbMpoolFile::get will be retained (i.e.wpinned in the pool until a subsequent call to DbMpoolFile::put.

The DbMpoolFile::get>method either returns errno or throws an exception that:encapsulates an errno on failure, and 0 on success.



Errors

WIf a fatal error occurs in Berkeley DB, the DbMpoolFile::get method may fail and eitherIreturn DB_RUNRECOVERY or throw an exception encapsulating DB_RUNRECOVERY,Gat which point all subsequent database calls will also fail in the sameFway. Methods marked as returning errno will, by default, throwHan exception that encapsulates the error information. The default error\behavior can be changed, see DbException.

The DbMpoolFile::get&method may fail and throw an exceptionKfor any of the errors specified for the following Berkeley DB and C library functions:DBmemp->pgin(3),DBmemp->pgout(3), abort(3), close(3),dbenv->db_paniccall(3), fcntl(3), fflush(3), fprintf(3),free(3), fstat(3), fsync(3), getenv(3), getpid(3), getuid(3), isdigit(3),>DbLog::compare,:DbLog::flush, lseek(3), malloc(3), memcmp(3), memcpy(3), memset(3),mmap(3),open(3), pread(3),pstat_getdynamic(3), pwrite(3),read(3),sigfillset(3),sigprocmask(3),stat(3), strerror(3), strlen(3), sysconf(3),time(3), unlink(3), vfprintf(3), vsnprintf(3),and write(3).

!In addition, the DbMpoolFile::get&method may fail and throw an exceptionor return errnofor the following conditions:

9

EAGAIN
The page reference count has overflowed.C(This should never happen unless there's a bug in the application.)
B

EINVAL
An invalid flag value or parameter was specified.

MThe DB_MPOOL_NEW flag was set and the source file was not opened for writing.

BThe requested page does not exist and DB_MPOOL_CREATE was not set.

IMore than one of DB_MPOOL_CREATE, DB_MPOOL_LAST and DB_MPOOL_NEW was set.

J

ENOMEM
The cache is full and no more pages will fit in the pool.




Class

>DbMpoolFile



See Also

FDbMpoolFile::close,DbMpoolFile::get,DDbMpoolFile::open,BDbMpoolFile::put,ADbMpoolFile::setandDDbMpoolFile::sync.
ÿÿ