mirror of https://github.com/perkeep/perkeep.git
static sqlite work in progress
Change-Id: I33db758bfec3226c1d90a3ea79d79b90ee883720
This commit is contained in:
parent
b3efd08c05
commit
0099626906
|
@ -1,4 +1,5 @@
|
|||
*~
|
||||
*.o
|
||||
*.pyc
|
||||
\#*\#
|
||||
.\#*
|
||||
|
@ -11,3 +12,4 @@ _gotest*
|
|||
_testmain*
|
||||
_go_.[568]
|
||||
_embed_*.go
|
||||
_cgo*
|
||||
|
|
|
@ -9,8 +9,9 @@ package sqlite
|
|||
|
||||
#include <stdlib.h>
|
||||
|
||||
#undef SQLITE_OS_UNIX
|
||||
#define SQLITE_OS_OTHER 1
|
||||
#include "sqlite3.c"
|
||||
#include "sqlite3_os_go.c"
|
||||
|
||||
static int my_bind_text(sqlite3_stmt *stmt, int n, char *p, int np) {
|
||||
return sqlite3_bind_text(stmt, n, p, np, SQLITE_TRANSIENT);
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,52 @@
|
|||
typedef struct GoFile GoFile;
|
||||
struct GoFile {
|
||||
sqlite3_io_methods const *pMethod; /* Always the first entry */
|
||||
};
|
||||
|
||||
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;
|
||||
#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; }
|
|
@ -1,12 +1,11 @@
|
|||
package main
|
||||
package sqlite
|
||||
|
||||
import (
|
||||
"camdev/sqlite"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestFoo(t *testing.T) {
|
||||
db, err := sqlite.Open("foo.db")
|
||||
db, err := Open("foo.db")
|
||||
if err != nil {
|
||||
t.Fatalf("open: %v", err)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue