Database Session Table Management

The database session table management module has the file name dbengses.c. This module provides session table management features for the Bbuuzzb database server. Any mention of QNX in this document refers to the QNX 4.x OS. This API can be compiled for all stated platforms except DOS.

The session table is implemented as a Bbuuzzb system table with the first field of each record holding the table tid and the remaining fields of the record containing the current record contents. When the Bbuuzzb database server receives a request, the program first decides on whether to look into the session table for the record contents. This decision is based on whether the session_flag is high and the nature of the database request. Generally, any database command that involves reading or writing to the current record or any file input/output activity will involve the session table. The decision to restore and then save (rs) the record contents is made in the function dbeng_session_should_rs.

Here is a list of functions in this module:

- dbeng_session_save
- dbeng_session_restore
- dbeng_session_delete
- dbeng_session_should_rs
- dbeng_session_flush_all
- dbeng_session_open
- dbeng_session_close
- dbeng_session_del_rec

# Module Dependencies

This module is part of the Bbuuzzb database server and must be linked with the following modules:

- fio.c
- parse.c
- logger.c
- ip.c (all platforms except QNX)
- ipcsrv.c
- ipcomm.c (all platforms except QNX)
- sys_log.c
- slogcode.c
- sloc.c (all platforms except QNX)
- slconfig.c (all platforms except QNX)
- sliocode.c (all platforms except QNX)
- sconnect.c (all platforms except QNX)
- dbeng.c
- dblocal.c
- dbiocode.c
- dbengcfg.c
- dblocfg.c
- dbengcat.c

In the Linux/Unix/QNX platforms, this module is compiled along with the other database modules as part of the script cdbeng.

# Module Header Files

This module depends on the following header files:

- stdhead.h
- dbeng.h
- dbmess.h
- dbengcfg.h
- dbengses.h

# Module Functions

## dbeng_session_save

    Prototype  : int dbeng_session_save(int tid)
    Parameters :
          Name : tid
    Description: tid

    Returns    : dbeng code

This function will save the current record data (if any) to the current session table. In addition the file associated with the tid will be closed.

## dbeng_session_restore

    Prototype  : int dbeng_session_restore(int tid)
    Parameters :
          Name : tid
    Description: tid

    Returns    : dbeng code

This function will restore the record data associated with tid from the current session table and also open the file.

## dbeng_session_delete

    Prototype  : int dbeng_session_delete(int tid)
    Parameters :
          Name : tid
    Description: tid

    Returns    : dbeng code

This function will delete the session table record with the matching tid.

## dbeng_session_should_rs

    Prototype  : int dbeng_session_should_rs(int mtyp, char *com, int *tid)
    Parameters :
          Name : mtyp
    Description: database command code

          Name : com
    Description: command parameters (if any)

          Name : tid
    Description: returned tid

    Returns    : TRUE if session should be restored and then saved, FALSE otherwise

This function will determine whether record data should be restored and then saved based on the database command code. If record data should be restored and then saved, the table tid will be extracted and returned to the caller.

## dbeng_session_flush_all

    Prototype  : int dbeng_session_flush_all(void)

    Returns    : dbeng code

This function will empty the session table of all records by deleting the table and re-creating it.

## dbeng_session_open

    Prototype  : static int dbeng_session_open(void)

    Returns    : dbeng code

This private function will open the session table.

## dbeng_session_close

    Prototype  : static int dbeng_session_close(void)

    Returns    : dbeng code

This private function will close the session table.

## dbeng_session_del_rec

    Prototype  : static int dbeng_session_del_rec(struct dbeng_table *ot)
    Parameters :
          Name : ot
    Description: pointer to table structure

    Returns    : dbeng code

This function will delete a session table record with the matching specification given in the pointer to table structure. The session table is expected to be already open.

Goto Top | Future Lab Home | Contact Webmaster | Feedback

Copyright © 2001-2006 Future Lab, Last Updated Jun 30, 2006