Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- C/Database Toolchest Library - name: <b>isaminit</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
Name:       isaminit

Purpose:    initalize ISAM library, allocate buffers

Prototype:  int isaminit(int bufcnt, int bufsize);

Header:     isam.h

Inputs:     bufcnt  - number of buffers for buffer pool
            bufsize - size of each buffer in buffer pool

Description:
        isaminit initializes the processing for the ISAM library.  The
        first time that you call iopen_db or icreate_db, isaminit
        is called automatically using the default values for the arguments.
        You may call it directly (before the first call to iopen_db or
        icreate_db) if you wish to use other values.

        If you call isaminit twice without an intervening call to
        isamexit, the second call to isaminit is ignored.

        bufcnt is the number of buffers to allocate in the buffer pool.
        The buffer pool is used for the index file.  If you specifiy 0 or
        DEFAULT_BUFCNT, the default number of buffers is allocated.  If you
        otherwise specify a number that is less than the minimum, the minimum
        count is silently used.

        bufsize is the size of each buffer in the buffer pool, in bytes.
        If you specify 0 or DEFAULT_BLKSIZE, the default buffer size is used.
        If you otherwise specify a size that is less than the minimum, the
        minimum size is silently used.

        If you plan to simultaneously open index files with different block
        sizes, be sure to choose a bufsize that is large enough to handle
        the largest block.  If you always use the default block size when
        creating an index file, the default buffer size is correct.

        The number of buffers in the pool can be changed after isaminit is
        called by calling the CBT routines cbaddbufs or cbrmbufs.  You
        can discover the current number of buffers in the pool by calling
        cbbufcnt.

        The size of the buffers cannot be changed after calling isaminit,
        unless you call isamexit to terminate ISAM processing then
        re-initialize by calling isaminit with a different bufsize.
        You can discover the size of the buffers in the pool by calling
        cbbufsize.

        It is an error if there is not enough memory to create the number of
        buffers requested.  If you don't have much memory but want to use as
        many buffers as possible, a better strategy is to call isaminit
        asking for just one buffer (this will actually get you the absolute
        minimum number of buffers), then call cbaddbufs to add many
        buffers (this will add as many buffers as there is room for).  You can
        discover the number of buffers in the pool by calling cbbufcnt.

Returns:
        OK, or ERROR if the buffer pool cannot be created.

See Also: isamexit iopen_db icreate_db cbaddbufs cbrmbufs cbbufcnt

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson