mirror of https://github.com/perkeep/perkeep.git
70 lines
2.3 KiB
C
70 lines
2.3 KiB
C
#include "_cgo_export.h"
|
|
|
|
typedef struct GoFile GoFile;
|
|
struct GoFile {
|
|
sqlite3_io_methods const *pMethod; /* Always the first entry */
|
|
};
|
|
|
|
static int go_vfs_open(sqlite3_vfs* vfs,
|
|
const char* zName,
|
|
sqlite3_file* file,
|
|
int flags,
|
|
int* pOutFlags) {
|
|
struct GoVFSOpen_return r;
|
|
r = GoVFSOpen((char*) zName, flags);
|
|
if (r.r0 == -1) {
|
|
return SQLITE_ERROR;
|
|
}
|
|
|
|
return SQLITE_ERROR;
|
|
}
|
|
|
|
int sqlite3_os_init(void) {
|
|
static sqlite3_vfs vfs;
|
|
memset(&vfs, 0, sizeof(vfs));
|
|
vfs.iVersion = 3;
|
|
vfs.szOsFile = sizeof(GoFile);
|
|
vfs.mxPathname = 512;
|
|
vfs.pNext = NULL;
|
|
vfs.zName = "go";
|
|
vfs.pAppData = NULL;
|
|
vfs.xOpen = go_vfs_open;
|
|
#if 0
|
|
int (*xOpen)(sqlite3_vfs*, const char *zName, sqlite3_file*,
|
|
int flags, int *pOutFlags);
|
|
int (*xDelete)(sqlite3_vfs*, const char *zName, int syncDir);
|
|
int (*xAccess)(sqlite3_vfs*, const char *zName, int flags, int *pResOut);
|
|
int (*xFullPathname)(sqlite3_vfs*, const char *zName, int nOut, char *zOut);
|
|
void *(*xDlOpen)(sqlite3_vfs*, const char *zFilename);
|
|
void (*xDlError)(sqlite3_vfs*, int nByte, char *zErrMsg);
|
|
void (*(*xDlSym)(sqlite3_vfs*,void*, const char *zSymbol))(void);
|
|
void (*xDlClose)(sqlite3_vfs*, void*);
|
|
int (*xRandomness)(sqlite3_vfs*, int nByte, char *zOut);
|
|
int (*xSleep)(sqlite3_vfs*, int microseconds);
|
|
int (*xCurrentTime)(sqlite3_vfs*, double*);
|
|
int (*xGetLastError)(sqlite3_vfs*, int, char *);
|
|
/*
|
|
** The methods above are in version 1 of the sqlite_vfs object
|
|
** definition. Those that follow are added in version 2 or later
|
|
*/
|
|
int (*xCurrentTimeInt64)(sqlite3_vfs*, sqlite3_int64*);
|
|
/*
|
|
** The methods above are in versions 1 and 2 of the sqlite_vfs object.
|
|
** Those below are for version 3 and greater.
|
|
*/
|
|
int (*xSetSystemCall)(sqlite3_vfs*, const char *zName, sqlite3_syscall_ptr);
|
|
sqlite3_syscall_ptr (*xGetSystemCall)(sqlite3_vfs*, const char *zName);
|
|
const char *(*xNextSystemCall)(sqlite3_vfs*, const char *zName);
|
|
/*
|
|
** The methods above are in versions 1 through 3 of the sqlite_vfs object.
|
|
** New fields may be appended in figure versions. The iVersion
|
|
** value will increment whenever this happens.
|
|
*/
|
|
};
|
|
#endif
|
|
sqlite3_vfs_register(&vfs, 1);
|
|
return SQLITE_OK;
|
|
}
|
|
|
|
int sqlite3_os_end(void) { return SQLITE_OK; }
|