fixed last_id/changes. it seems long alignment values.

This commit is contained in:
mattn 2012-12-07 12:58:08 +09:00
parent 430103cc9e
commit b758711b08
1 changed files with 16 additions and 4 deletions

View File

@ -14,6 +14,20 @@ static int
_sqlite3_bind_blob(sqlite3_stmt *stmt, int n, void *p, int np) { _sqlite3_bind_blob(sqlite3_stmt *stmt, int n, void *p, int np) {
return sqlite3_bind_blob(stmt, n, p, np, SQLITE_TRANSIENT); return sqlite3_bind_blob(stmt, n, p, np, SQLITE_TRANSIENT);
} }
#include <stdio.h>
#include <stdint.h>
static long
_sqlite3_last_insert_rowid(sqlite3* db) {
return (long) sqlite3_last_insert_rowid(db);
}
static long
_sqlite3_changes(sqlite3* db) {
return (long) sqlite3_changes(db);
}
*/ */
import "C" import "C"
import ( import (
@ -221,13 +235,11 @@ type SQLiteResult struct {
} }
func (r *SQLiteResult) LastInsertId() (int64, error) { func (r *SQLiteResult) LastInsertId() (int64, error) {
var rr int64 return int64(C._sqlite3_last_insert_rowid(r.s.c.db)), nil
rr = int64(C.sqlite3_last_insert_rowid(r.s.c.db))
return rr, nil
} }
func (r *SQLiteResult) RowsAffected() (int64, error) { func (r *SQLiteResult) RowsAffected() (int64, error) {
return int64(C.sqlite3_changes(r.s.c.db)), nil return int64(C._sqlite3_changes(r.s.c.db)), nil
} }
func (s *SQLiteStmt) Exec(args []driver.Value) (driver.Result, error) { func (s *SQLiteStmt) Exec(args []driver.Value) (driver.Result, error) {