forked from mirror/go-sqlcipher
Rename the wrapper functions to not pollute the sqlite3_* namespace
This commit is contained in:
parent
eb08795f52
commit
68e53de11e
30
sqlite3.go
30
sqlite3.go
|
@ -79,37 +79,37 @@ _sqlite3_exec(sqlite3* db, const char* pcmd, long long* rowid, long long* change
|
|||
}
|
||||
|
||||
#ifdef SQLITE_ENABLE_UNLOCK_NOTIFY
|
||||
extern int sqlite3_step_blocking(sqlite3_stmt *stmt);
|
||||
extern int _sqlite3_step_blocking(sqlite3_stmt* stmt, long long* rowid, long long* changes);
|
||||
extern int sqlite3_prepare_v2_blocking(sqlite3 *db, const char *zSql, int nBytes, sqlite3_stmt **ppStmt, const char **pzTail);
|
||||
extern int _sqlite3_step_blocking(sqlite3_stmt *stmt);
|
||||
extern int _sqlite3_step_row_blocking(sqlite3_stmt* stmt, long long* rowid, long long* changes);
|
||||
extern int _sqlite3_prepare_v2_blocking(sqlite3 *db, const char *zSql, int nBytes, sqlite3_stmt **ppStmt, const char **pzTail);
|
||||
|
||||
static int
|
||||
sqlite3_step_internal(sqlite3_stmt *stmt)
|
||||
_sqlite3_step_internal(sqlite3_stmt *stmt)
|
||||
{
|
||||
return sqlite3_step_blocking(stmt);
|
||||
return _sqlite3_step_blocking(stmt);
|
||||
}
|
||||
|
||||
static int
|
||||
_sqlite3_step_internal(sqlite3_stmt* stmt, long long* rowid, long long* changes)
|
||||
_sqlite3_step_row_internal(sqlite3_stmt* stmt, long long* rowid, long long* changes)
|
||||
{
|
||||
return _sqlite3_step_blocking(stmt, rowid, changes);
|
||||
return _sqlite3_step_row_blocking(stmt, rowid, changes);
|
||||
}
|
||||
|
||||
static int
|
||||
sqlite3_prepare_v2_internal(sqlite3 *db, const char *zSql, int nBytes, sqlite3_stmt **ppStmt, const char **pzTail)
|
||||
_sqlite3_prepare_v2_internal(sqlite3 *db, const char *zSql, int nBytes, sqlite3_stmt **ppStmt, const char **pzTail)
|
||||
{
|
||||
return sqlite3_prepare_v2_blocking(db, zSql, nBytes, ppStmt, pzTail);
|
||||
return _sqlite3_prepare_v2_blocking(db, zSql, nBytes, ppStmt, pzTail);
|
||||
}
|
||||
|
||||
#else
|
||||
static int
|
||||
sqlite3_step_internal(sqlite3_stmt *stmt)
|
||||
_sqlite3_step_internal(sqlite3_stmt *stmt)
|
||||
{
|
||||
return sqlite3_step(stmt);
|
||||
}
|
||||
|
||||
static int
|
||||
_sqlite3_step_internal(sqlite3_stmt* stmt, long long* rowid, long long* changes)
|
||||
_sqlite3_step_row_internal(sqlite3_stmt* stmt, long long* rowid, long long* changes)
|
||||
{
|
||||
int rv = sqlite3_step(stmt);
|
||||
sqlite3* db = sqlite3_db_handle(stmt);
|
||||
|
@ -119,7 +119,7 @@ _sqlite3_step_internal(sqlite3_stmt* stmt, long long* rowid, long long* changes)
|
|||
}
|
||||
|
||||
static int
|
||||
sqlite3_prepare_v2_internal(sqlite3 *db, const char *zSql, int nBytes, sqlite3_stmt **ppStmt, const char **pzTail)
|
||||
_sqlite3_prepare_v2_internal(sqlite3 *db, const char *zSql, int nBytes, sqlite3_stmt **ppStmt, const char **pzTail)
|
||||
{
|
||||
return sqlite3_prepare_v2(db, zSql, nBytes, ppStmt, pzTail);
|
||||
}
|
||||
|
@ -1674,7 +1674,7 @@ func (c *SQLiteConn) prepare(ctx context.Context, query string) (driver.Stmt, er
|
|||
defer C.free(unsafe.Pointer(pquery))
|
||||
var s *C.sqlite3_stmt
|
||||
var tail *C.char
|
||||
rv := C.sqlite3_prepare_v2_internal(c.db, pquery, -1, &s, &tail)
|
||||
rv := C._sqlite3_prepare_v2_internal(c.db, pquery, -1, &s, &tail)
|
||||
if rv != C.SQLITE_OK {
|
||||
return nil, c.lastError()
|
||||
}
|
||||
|
@ -1908,7 +1908,7 @@ func (s *SQLiteStmt) exec(ctx context.Context, args []namedValue) (driver.Result
|
|||
}
|
||||
|
||||
var rowid, changes C.longlong
|
||||
rv := C._sqlite3_step_internal(s.s, &rowid, &changes)
|
||||
rv := C._sqlite3_step_row_internal(s.s, &rowid, &changes)
|
||||
if rv != C.SQLITE_ROW && rv != C.SQLITE_OK && rv != C.SQLITE_DONE {
|
||||
err := s.c.lastError()
|
||||
C.sqlite3_reset(s.s)
|
||||
|
@ -1980,7 +1980,7 @@ func (rc *SQLiteRows) Next(dest []driver.Value) error {
|
|||
if rc.s.closed {
|
||||
return io.EOF
|
||||
}
|
||||
rv := C.sqlite3_step_internal(rc.s.s)
|
||||
rv := C._sqlite3_step_internal(rc.s.s)
|
||||
if rv == C.SQLITE_DONE {
|
||||
return io.EOF
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
extern int unlock_notify_wait(sqlite3 *db);
|
||||
|
||||
int
|
||||
sqlite3_step_blocking(sqlite3_stmt *stmt)
|
||||
_sqlite3_step_blocking(sqlite3_stmt *stmt)
|
||||
{
|
||||
int rv;
|
||||
sqlite3* db;
|
||||
|
@ -35,7 +35,7 @@ sqlite3_step_blocking(sqlite3_stmt *stmt)
|
|||
}
|
||||
|
||||
int
|
||||
_sqlite3_step_blocking(sqlite3_stmt* stmt, long long* rowid, long long* changes)
|
||||
_sqlite3_step_row_blocking(sqlite3_stmt* stmt, long long* rowid, long long* changes)
|
||||
{
|
||||
int rv;
|
||||
sqlite3* db;
|
||||
|
@ -62,7 +62,7 @@ _sqlite3_step_blocking(sqlite3_stmt* stmt, long long* rowid, long long* changes)
|
|||
}
|
||||
|
||||
int
|
||||
sqlite3_prepare_v2_blocking(sqlite3 *db, const char *zSql, int nBytes, sqlite3_stmt **ppStmt, const char **pzTail)
|
||||
_sqlite3_prepare_v2_blocking(sqlite3 *db, const char *zSql, int nBytes, sqlite3_stmt **ppStmt, const char **pzTail)
|
||||
{
|
||||
int rv;
|
||||
|
||||
|
|
Loading…
Reference in New Issue