aboutsummaryrefslogtreecommitdiff
path: root/sqlite3.go
diff options
context:
space:
mode:
authorYasuhiro Matsumoto <mattn.jp@gmail.com>2017-03-21 09:14:48 +0900
committerYasuhiro Matsumoto <mattn.jp@gmail.com>2017-03-21 09:14:48 +0900
commit866c3293d9a76aa491e56cc978d0d7fb0e63e121 (patch)
tree8e97fadc977d5f2d21d1c9372b2e50dc93bf13f7 /sqlite3.go
parentfix test (diff)
downloadgolite-866c3293d9a76aa491e56cc978d0d7fb0e63e121.tar.gz
golite-866c3293d9a76aa491e56cc978d0d7fb0e63e121.tar.xz
fix breaking compatibility.
revert cf4bd560f1588d96c502b4c3407fe1a10cef4a28 close #394
Diffstat (limited to 'sqlite3.go')
-rw-r--r--sqlite3.go12
1 files changed, 6 insertions, 6 deletions
diff --git a/sqlite3.go b/sqlite3.go
index 2d504d9..3a9a4dd 100644
--- a/sqlite3.go
+++ b/sqlite3.go
@@ -298,7 +298,7 @@ func (ai *aggInfo) Done(ctx *C.sqlite3_context) {
// Commit transaction.
func (tx *SQLiteTx) Commit() error {
_, err := tx.c.exec(context.Background(), "COMMIT", nil)
- if err != nil && err.(*Error).Code == C.SQLITE_BUSY {
+ if err != nil && err.(Error).Code == C.SQLITE_BUSY {
// sqlite3 will leave the transaction open in this scenario.
// However, database/sql considers the transaction complete once we
// return from Commit() - we must clean up to honour its semantics.
@@ -399,12 +399,12 @@ func (c *SQLiteConn) AutoCommit() bool {
return int(C.sqlite3_get_autocommit(c.db)) != 0
}
-func (c *SQLiteConn) lastError() *Error {
+func (c *SQLiteConn) lastError() error {
rv := C.sqlite3_errcode(c.db)
if rv == C.SQLITE_OK {
return nil
}
- return &Error{
+ return Error{
Code: ErrNo(rv),
ExtendedCode: ErrNoExtended(C.sqlite3_extended_errcode(c.db)),
err: C.GoString(C.sqlite3_errmsg(c.db)),
@@ -519,7 +519,7 @@ func (c *SQLiteConn) begin(ctx context.Context) (driver.Tx, error) {
return &SQLiteTx{c}, nil
}
-func errorString(err *Error) string {
+func errorString(err Error) string {
return C.GoString(C.sqlite3_errstr(C.int(err.Code)))
}
@@ -601,7 +601,7 @@ func (d *SQLiteDriver) Open(dsn string) (driver.Conn, error) {
C.SQLITE_OPEN_CREATE,
nil)
if rv != 0 {
- return nil, &Error{Code: ErrNo(rv)}
+ return nil, Error{Code: ErrNo(rv)}
}
if db == nil {
return nil, errors.New("sqlite succeeded without returning a database")
@@ -609,7 +609,7 @@ func (d *SQLiteDriver) Open(dsn string) (driver.Conn, error) {
rv = C.sqlite3_busy_timeout(db, C.int(busyTimeout))
if rv != C.SQLITE_OK {
- return nil, &Error{Code: ErrNo(rv)}
+ return nil, Error{Code: ErrNo(rv)}
}
conn := &SQLiteConn{db: db, loc: loc, txlock: txlock}