📄 memdatabase.h
字号:
#ifndef MEMDATABASE_H#define MEMDATABASE_H#include <stdio.h>#include <sys/sem.h>#include <sys/shm.h>#include "ErrCode.h"#define FPOS( type, field ) ( (int)&(( type *) 0)-> field )#define FLEN( type, field ) ( sizeof((( type *) 0)-> field ))#define SetKeyMemDB(p,type,field) ( SetTableKey(p,FPOS(type,field),FLEN(type,field)) )#define DeclareCursorMemDB(p,type,field,value) ( DeclareTableKey(p,FPOS(type,field),FLEN(type,field),(void*)value) )#define MAX_FETCHKEY_NUM 10#define MAX_FETCHVALUE_LEN 256typedef struct{ int iKeyOffSet; /* The Key field offset */ int iKeyLen; /* The Key field len */ char sValue[MAX_FETCHVALUE_LEN]; /* The Value of Fetch Key */}FETCH_KEY_DEF;typedef struct{ int iIpcKey; /* The key of ShareMemory and Semphore */ int iShmId; /* The Id of ShareMemory */ int iSemId; /* The Id of Semphore */ long lFetchNum; /* The Index of Fetch */ int iFetchKeyNum; /* The Fetch Key Number */ FETCH_KEY_DEF stuFetchKeyBuf[MAX_FETCHKEY_NUM]; /* The Declare Fetch Key Define */ char *pShmArea; /* The Point to ShareMemory */}MEMDATABASE;int CreateMemDB(MEMDATABASE **pMemDB,char *pTableName,int iIpcKey,long lMaxRecord,int RecordLen);int DropMemDB(MEMDATABASE *pMemDB);int AttachMemDB(MEMDATABASE **pMemDB,int iIpcKey);int FetchCursorMemDB(MEMDATABASE *pMemDB,char *pInBuffer);int CloseCursorMemDB(MEMDATABASE *pMemDB);int SelectOneMemDB(MEMDATABASE *pMemDB,char *pInBuffer);int SelectMemDB(MEMDATABASE *pMemDB,char *pInBuffer);int UpdateMemDB(MEMDATABASE *pMemDB,char *pInBuffer);int DeleteMemDB(MEMDATABASE *pMemDB,char *pInBuffer);int DeleteOneMemDB(MEMDATABASE *pMemDB,char *pInBuffer);int InsertMemDB(MEMDATABASE *pMemDB,char *pInBuffer);void TruncateMemDB(MEMDATABASE *pMemDB);#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -