G:/ScriptBasic/source/extensions/bdb/interface.c File Reference

#include <sys/types.h>
#include <errno.h>
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <db.h>
#include "../../basext.h"

Go to the source code of this file.

Data Structures

struct  _MyDb
struct  _BdbObject

Defines

#define BDB_ERROR_INVALID_FILE_NAME   0x00080001
#define BDB_ERROR_INVALID_DB_HANDLE   0x00080002
#define BDB_ERROR_TRANSACTION_NOT_CLOSED   0x00080003
#define BDB_ERROR_TRANSACTION_NOT_OPENED   0x00080004
#define BDB_ERROR_KEY_NOT_FOUND   0x00080005
#define BDB_INCOMPLETE   0x00080006
#define BDB_KEYEMPTY   0x00080007
#define BDB_KEYEXIST   0x00080008
#define BDB_LOCK_DEADLOCK   0x00080009
#define BDB_LOCK_NOTGRANTED   0x0008000A
#define BDB_NOTFOUND   0x0008000B
#define BDB_OLD_VERSION   0x0008000C
#define BDB_RUNRECOVERY   0x0008000D
#define BDB_DELETED   0x0008000E
#define BDB_NEEDSPLIT   0x0008000F
#define BDB_SWAPBYTES   0x00080010
#define BDB_TXN_CKP   0x00080011
#define X(A, B)
#define X(A, B)   if( besCONFIG(B) && !strcmp(besCONFIG(B),"yes") )p->flags |= A;
#define X(A, B)   if( s=besCONFIG(A) )p->dbenv->B = atol(s);

Typedefs

typedef _MyDb MyDb
typedef _MyDbpMyDb
typedef _BdbObject BdbObject
typedef _BdbObjectpBdbObject

Functions

static unsigned long ConvertBdbErrors (int BdbError)
besVERSION_NEGOTIATE return (int)
 if (s=besCONFIG("bdb.limits.lg_max"))
 if (if(=besCONFIG("bdb.dir.log")) p->dbenv->set_lg_dir(p->dbenv s=besCONFIG("bdb.dir.data"))
 if (p==NULL)
p dbenv close (p->dbenv, 0)
besEND besFUNCTION (sb_db_open)
 besCONVERT2ZCHAR (Argument, pszFileName)
 besDEREFERENCE (Argument)
 besCONVERT2LONG (Argument)
 if (Argument)
dbpp set_flags (dbpp, DB_DUP)
 besFREE (pszFileName)
 if (ret)
 if (if pTable==NULL)
 besALLOC_RETURN_STRING (sizeof(pMyDb))
 memcpy (STRINGVALUE(besRETURNVALUE),&pTable, sizeof(DB *))
besEND besFUNCTION (sb_db_close)
 memcpy (&pTable, STRINGVALUE(Argument), sizeof(DB *))
 if (pTable->pCursor) pTable->pCursor->c_close(pTable->pCursor) = pTable->next
 besFREE (pTable)
 if (int ret)
 memcpy (&pTable, STRINGVALUE(Argument), sizeof(pMyDb))
 memset (&key, 0, sizeof(DBT))
 if (VARIABLE Argument)
 if (if(&&ret!=ENOMEM) return ConvertBdbErrors(ret) ret==DB_KEYEMPTY||ret==DB_NOTFOUND)
besEND besFUNCTION (sb_db_trcommit)
besEND besFUNCTION (sb_db_trabort)

Variables

 return
besEND besSUB_FINISH pBdbObject p
pMyDb pTable
 p = (pBdbObject)besMODULEPOINTER
 return
 Argument = besARGUMENT(2)
 Argument = besARGUMENT(3)
 ret
 pTable = besALLOC(sizeof(MyDb))
 ret = dbpp->cursor(pTable->pdb,pTable->txnid,&(pTable->pCursor),0)
return COMMAND_ERROR_SUCCESS
 dbpp = pTable->pdb
 ret = dbpp->close(dbpp,0)
else p pDbList = pTable->next
 dbpp = pTable->pdb
 Argument = besARGUMENT(2)
 dbpp = pTable->pdb
 Argument = besARGUMENT(2)
data data = NULL
data ulen = 0
data flags = DB_DBT_USERMEM
 ret = pTable->pCursor->c_get(pTable->pCursor,&key,&data,flags)
 dbpp = pTable->pdb
 Argument = besARGUMENT(2)
data data = NULL
data ulen = 0
data flags = DB_DBT_USERMEM
 ret = pTable->pCursor->c_get(pTable->pCursor,&key,&data,DB_NEXT)
 dbpp = pTable->pdb
key data = NULL
key ulen = 0
key flags = DB_DBT_USERMEM
data data = NULL
data ulen = 0
data flags = DB_DBT_USERMEM
 ret = pTable->pCursor->c_get(pTable->pCursor,&key,&data,DB_CURRENT)
 dbpp = pTable->pdb
 Argument = besARGUMENT(2)
data data = NULL
data ulen = 0
data flags = DB_DBT_USERMEM
 ret = pTable->pCursor->c_get(pTable->pCursor,&key,&data,DB_PREV)
 dbpp = pTable->pdb
data data = NULL
data ulen = 0
data flags = DB_DBT_USERMEM
 ret = pTable->pCursor->c_get(pTable->pCursor,&key,&data,DB_LAST)
 dbpp = pTable->pdb
 Argument = besARGUMENT(2)
 dbpp = pTable->pdb
 ret = pTable->pCursor->c_del(pTable->pCursor,0)
 dbpp = pTable->pdb
 Argument = besARGUMENT(2)
p InTransaction = 1
return COMMAND_ERROR_SUCCESS
p InTransaction = 0
return COMMAND_ERROR_SUCCESS
p InTransaction = 0
return COMMAND_ERROR_SUCCESS


Define Documentation

#define BDB_DELETED   0x0008000E
 

Definition at line 43 of file interface.c.

Referenced by ConvertBdbErrors().

#define BDB_ERROR_INVALID_DB_HANDLE   0x00080002
 

Definition at line 31 of file interface.c.

Referenced by besFUNCTION().

#define BDB_ERROR_INVALID_FILE_NAME   0x00080001
 

Definition at line 30 of file interface.c.

Referenced by besFUNCTION().

#define BDB_ERROR_KEY_NOT_FOUND   0x00080005
 

Definition at line 34 of file interface.c.

#define BDB_ERROR_TRANSACTION_NOT_CLOSED   0x00080003
 

Definition at line 32 of file interface.c.

#define BDB_ERROR_TRANSACTION_NOT_OPENED   0x00080004
 

Definition at line 33 of file interface.c.

#define BDB_INCOMPLETE   0x00080006
 

Definition at line 35 of file interface.c.

Referenced by ConvertBdbErrors().

#define BDB_KEYEMPTY   0x00080007
 

Definition at line 36 of file interface.c.

Referenced by ConvertBdbErrors().

#define BDB_KEYEXIST   0x00080008
 

Definition at line 37 of file interface.c.

Referenced by ConvertBdbErrors().

#define BDB_LOCK_DEADLOCK   0x00080009
 

Definition at line 38 of file interface.c.

Referenced by ConvertBdbErrors().

#define BDB_LOCK_NOTGRANTED   0x0008000A
 

Definition at line 39 of file interface.c.

Referenced by ConvertBdbErrors().

#define BDB_NEEDSPLIT   0x0008000F
 

Definition at line 44 of file interface.c.

Referenced by ConvertBdbErrors().

#define BDB_NOTFOUND   0x0008000B
 

Definition at line 40 of file interface.c.

Referenced by ConvertBdbErrors().

#define BDB_OLD_VERSION   0x0008000C
 

Definition at line 41 of file interface.c.

Referenced by ConvertBdbErrors().

#define BDB_RUNRECOVERY   0x0008000D
 

Definition at line 42 of file interface.c.

Referenced by ConvertBdbErrors().

#define BDB_SWAPBYTES   0x00080010
 

Definition at line 45 of file interface.c.

Referenced by ConvertBdbErrors().

#define BDB_TXN_CKP   0x00080011
 

Definition at line 46 of file interface.c.

Referenced by ConvertBdbErrors().

#define X A,
 )     if( s=besCONFIG(A) )p->dbenv->B = atol(s);
 

Definition at line 153 of file interface.c.

#define X A,
 )     if( besCONFIG(B) && !strcmp(besCONFIG(B),"yes") )p->flags |= A;
 

Definition at line 153 of file interface.c.

#define X A,
 ) 
 

Value:

A = besCONFIG(B);\
               if( A && !*A )A=NULL;\
               if( A )iConfigLines++;

Definition at line 153 of file interface.c.

Referenced by pfEnv(), and pfFtpEnv().


Typedef Documentation

typedef struct _BdbObject BdbObject
 

typedef struct _MyDb MyDb
 

typedef struct _BdbObject * pBdbObject
 

typedef struct _MyDb * pMyDb
 


Function Documentation

besALLOC_RETURN_STRING sizeof(pMyDb  ) 
 

Referenced by besFUNCTION(), if(), and switch().

besCONVERT2LONG Argument   ) 
 

Referenced by basext_GetArgsF(), besFUNCTION(), if(), and switch().

besCONVERT2ZCHAR Argument  ,
pszFileName 
 

Referenced by besFUNCTION(), CHECK_OPTION(), and if().

besDEREFERENCE Argument   ) 
 

Referenced by basext_GetArgsF(), besFUNCTION(), CHECK_OPTION(), if(), and return().

besFREE pTable   ) 
 

besFREE pszFileName   ) 
 

Referenced by __RemoveImage(), basext_GetArgsF(), besFUNCTION(), buffercollect(), CHECK_OPTION(), delete_Wrapper(), F_LibraryLoaded(), if(), release_list(), switch(), and zlibfree_interface().

besEND besFUNCTION sb_db_trabort   ) 
 

Definition at line 939 of file interface.c.

besEND besFUNCTION sb_db_trcommit   ) 
 

Definition at line 917 of file interface.c.

besEND besFUNCTION sb_db_close   ) 
 

Definition at line 345 of file interface.c.

References BDB_ERROR_INVALID_DB_HANDLE.

besEND besFUNCTION sb_db_open   ) 
 

Definition at line 226 of file interface.c.

References BDB_ERROR_INVALID_FILE_NAME, and besRETURNVALUE.

p dbenv close p->  dbenv,
 

static unsigned long ConvertBdbErrors int  BdbError  )  [static]
 

Definition at line 69 of file interface.c.

References BDB_DELETED, BDB_INCOMPLETE, BDB_KEYEMPTY, BDB_KEYEXIST, BDB_LOCK_DEADLOCK, BDB_LOCK_NOTGRANTED, BDB_NEEDSPLIT, BDB_NOTFOUND, BDB_OLD_VERSION, BDB_RUNRECOVERY, BDB_SWAPBYTES, BDB_TXN_CKP, DB_DELETED, DB_INCOMPLETE, DB_KEYEMPTY, DB_KEYEXIST, DB_LOCK_DEADLOCK, DB_LOCK_NOTGRANTED, DB_NEEDSPLIT, DB_NOTFOUND, DB_OLD_VERSION, DB_RUNRECOVERY, DB_SWAPBYTES, and DB_TXN_CKP.

Referenced by if().

if if( && ret != ENOMEM ) return ConvertBdbErrors(ret ret = = DB_KEYEMPTY || ret == DB_NOTFOUND  ) 
 

Definition at line 510 of file interface.c.

if VARIABLE  Argument  ) 
 

Definition at line 446 of file interface.c.

if int  ret  ) 
 

Definition at line 380 of file interface.c.

if pTable->  pCursor  )  = pTable->next
 

if if  pTable = NULL  ) 
 

Definition at line 315 of file interface.c.

References ConvertBdbErrors(), p, pTable, ret, and _MyDb::txnid.

if ret   ) 
 

Definition at line 310 of file interface.c.

References besRETURNVALUE, ConvertBdbErrors(), and ret.

if Argument  = NULL  ) 
 

Definition at line 254 of file interface.c.

References DB_BTREE, DB_HASH, DB_QUEUE, DB_RECNO, DB_UNKNOWN, and type.

if p  = NULL  ) 
 

Definition at line 195 of file interface.c.

References _MyDb::next, NULL, _MyDb::pCursor, _MyDb::pdb, pTable, and _MyDb::txnid.

if if( = besCONFIG("bdb.dir.log") ) p->dbenv->set_lg_dir(p->dbenv  s = besCONFIG("bdb.dir.data")  ) 
 

Definition at line 173 of file interface.c.

if s  = besCONFIG("bdb.limits.lg_max")  ) 
 

Definition at line 157 of file interface.c.

References DB_LOCK_DEFAULT, DB_LOCK_OLDEST, DB_LOCK_RANDOM, and DB_LOCK_YOUNGEST.

memcpy pTable,
STRINGVALUE(Argument ,
sizeof(pMyDb
 

memcpy pTable,
STRINGVALUE(Argument ,
sizeof(DB *) 
 

memcpy STRINGVALUE(besRETURNVALUE ,
pTable,
sizeof(DB *) 
 

memset key,
,
sizeof(DBT
 

Referenced by allocset(), cgi_ReadHttpRequest(), CreateJunction(), execute_InitExecute(), file_flock(), file_lock(), handle_GetHandle(), ipreproc_InitStructure(), main(), memory_InitStructure(), printChar(), and stack_base().

besVERSION_NEGOTIATE return int   ) 
 

Definition at line 91 of file interface.c.

dbpp set_flags dbpp  ,
DB_DUP 
 


Variable Documentation

Argument = besARGUMENT(2)
 

Definition at line 837 of file interface.c.

Argument = besARGUMENT(2)
 

Definition at line 760 of file interface.c.

Argument = besARGUMENT(2)
 

Definition at line 655 of file interface.c.

Argument = besARGUMENT(2)
 

Definition at line 548 of file interface.c.

Argument = besARGUMENT(2)
 

Definition at line 489 of file interface.c.

Argument = besARGUMENT(2)
 

Definition at line 419 of file interface.c.

Argument = besARGUMENT(3)
 

Definition at line 268 of file interface.c.

Argument = besARGUMENT(2)
 

Definition at line 251 of file interface.c.

return COMMAND_ERROR_SUCCESS
 

Definition at line 958 of file interface.c.

return COMMAND_ERROR_SUCCESS
 

Definition at line 936 of file interface.c.

return COMMAND_ERROR_SUCCESS
 

Definition at line 914 of file interface.c.

return COMMAND_ERROR_SUCCESS
 

Definition at line 338 of file interface.c.

Referenced by _GetData(), besFUNCTION(), CHECK_OPTION(), epreproc(), execute_CopyCommandTable(), hook_Init(), if(), ipreproc_LoadInternalPreprocessor(), ipreproc_Process(), memory_ReplaceVariable(), memory_SetRef(), modu_GetFunctionByName(), modu_Init(), modu_LoadModule(), modu_ShutdownModule(), modu_UnloadAllModules(), modu_UnloadModule(), scriba_LoadInternalPreprocessor(), switch(), and unserconv().

data data = NULL
 

Definition at line 712 of file interface.c.

data data = NULL
 

Definition at line 667 of file interface.c.

data data = NULL
 

Definition at line 609 of file interface.c.

key data = NULL
 

Definition at line 604 of file interface.c.

data data = NULL
 

Definition at line 560 of file interface.c.

data data = NULL
 

Definition at line 504 of file interface.c.

dbpp = pTable->pdb
 

Definition at line 831 of file interface.c.

dbpp = pTable->pdb
 

Definition at line 802 of file interface.c.

dbpp = pTable->pdb
 

Definition at line 756 of file interface.c.

dbpp = pTable->pdb
 

Definition at line 707 of file interface.c.

dbpp = pTable->pdb
 

Definition at line 651 of file interface.c.

dbpp = pTable->pdb
 

Definition at line 601 of file interface.c.

dbpp = pTable->pdb
 

Definition at line 544 of file interface.c.

dbpp = pTable->pdb
 

Definition at line 485 of file interface.c.

dbpp = pTable->pdb
 

Definition at line 414 of file interface.c.

dbpp = pTable->pdb
 

Definition at line 365 of file interface.c.

data flags = DB_DBT_USERMEM
 

Definition at line 714 of file interface.c.

data flags = DB_DBT_USERMEM
 

Definition at line 669 of file interface.c.

data flags = DB_DBT_USERMEM
 

Definition at line 611 of file interface.c.

key flags = DB_DBT_USERMEM
 

Definition at line 606 of file interface.c.

data flags = DB_DBT_USERMEM
 

Definition at line 562 of file interface.c.

data flags = DB_DBT_USERMEM
 

Definition at line 506 of file interface.c.

Referenced by printDouble(), and printInt().

p InTransaction = 0
 

Definition at line 957 of file interface.c.

p InTransaction = 0
 

Definition at line 935 of file interface.c.

p InTransaction = 1
 

Definition at line 913 of file interface.c.

p = (pBdbObject)besMODULEPOINTER
 

Definition at line 193 of file interface.c.

besEND besSUB_FINISH pBdbObject p
 

Definition at line 190 of file interface.c.

else p pDbList = pTable->next
 

Definition at line 373 of file interface.c.

pTable = besALLOC(sizeof(MyDb))
 

Definition at line 314 of file interface.c.

pMyDb pTable
 

Definition at line 191 of file interface.c.

Referenced by if().

ret = pTable->pCursor->c_del(pTable->pCursor,0)
 

Definition at line 804 of file interface.c.

ret = pTable->pCursor->c_get(pTable->pCursor,&key,&data,DB_LAST)
 

Definition at line 717 of file interface.c.

ret = pTable->pCursor->c_get(pTable->pCursor,&key,&data,DB_PREV)
 

Definition at line 672 of file interface.c.

ret = pTable->pCursor->c_get(pTable->pCursor,&key,&data,DB_CURRENT)
 

Definition at line 614 of file interface.c.

ret = pTable->pCursor->c_get(pTable->pCursor,&key,&data,DB_NEXT)
 

Definition at line 565 of file interface.c.

ret = pTable->pCursor->c_get(pTable->pCursor,&key,&data,flags)
 

Definition at line 509 of file interface.c.

ret = dbpp->close(dbpp,0)
 

Definition at line 368 of file interface.c.

ret = dbpp->cursor(pTable->pdb,pTable->txnid,&(pTable->pCursor),0)
 

Definition at line 331 of file interface.c.

ret
 

Initial value:

 dbpp->open(dbpp,

                   NULL,

                   pszFileName,
                   NULL, /* sub databases are not supported yet */
                   type,
                   flags,
                   mode)

Definition at line 300 of file interface.c.

Referenced by build_IsFileBinaryFormat(), dupl(), end(), if(), and pathdialog().

return
 

Definition at line 211 of file interface.c.

return
 

Definition at line 186 of file interface.c.

Referenced by brushupinline().

data ulen = 0
 

Definition at line 713 of file interface.c.

data ulen = 0
 

Definition at line 668 of file interface.c.

data ulen = 0
 

Definition at line 610 of file interface.c.

key ulen = 0
 

Definition at line 605 of file interface.c.

data ulen = 0
 

Definition at line 561 of file interface.c.

data ulen = 0
 

Definition at line 505 of file interface.c.


Generated on Sun Mar 12 23:56:35 2006 for ScriptBasic by  doxygen 1.4.6-NO