mynewt-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ccoll...@apache.org
Subject [16/40] incubator-mynewt-newt git commit: Remove Godeps; user can acquire deps via "go get".
Date Tue, 15 Mar 2016 04:46:35 GMT
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/c08cb449/newt/Godeps/_workspace/src/github.com/mattn/go-sqlite3/README.md
----------------------------------------------------------------------
diff --git a/newt/Godeps/_workspace/src/github.com/mattn/go-sqlite3/README.md b/newt/Godeps/_workspace/src/github.com/mattn/go-sqlite3/README.md
deleted file mode 100644
index 4383f0c..0000000
--- a/newt/Godeps/_workspace/src/github.com/mattn/go-sqlite3/README.md
+++ /dev/null
@@ -1,62 +0,0 @@
-go-sqlite3
-==========
-
-[![Build Status](https://travis-ci.org/mattn/go-sqlite3.png?branch=master)](https://travis-ci.org/mattn/go-sqlite3)
-[![Coverage Status](https://coveralls.io/repos/mattn/go-sqlite3/badge.png?branch=master)](https://coveralls.io/r/mattn/go-sqlite3?branch=master)
-
-Description
------------
-
-sqlite3 driver conforming to the built-in database/sql interface
-
-Installation
-------------
-
-This package can be installed with the go get command:
-
-    go get github.com/mattn/go-sqlite3
-    
-Documentation
--------------
-
-API documentation can be found here: http://godoc.org/github.com/mattn/go-sqlite3
-
-Examples can be found under the `./_example` directory
-
-FAQ
----
-
-* Can't build go-sqlite3 on windows 64bit.
-
-    > Probably, you are using go 1.0, go1.0 has a problem when it comes to compiling/linking
on windows 64bit. 
-    > See: https://github.com/mattn/go-sqlite3/issues/27
-
-* Getting insert error while query is opened.
-
-    > You can pass some arguments into the connection string, for example, a URI.
-    > See: https://github.com/mattn/go-sqlite3/issues/39
-
-* Do you want cross compiling? mingw on Linux or Mac?
-
-    > See: https://github.com/mattn/go-sqlite3/issues/106
-    > See also: http://www.limitlessfx.com/cross-compile-golang-app-for-windows-from-linux.html
-
-* Want to get time.Time with current locale
-
-    Use `loc=auto` in SQLite3 filename schema like `file:foo.db?loc=auto`.
-
-License
--------
-
-MIT: http://mattn.mit-license.org/2012
-
-sqlite3-binding.c, sqlite3-binding.h, sqlite3ext.h
-
-The -binding suffix was added to avoid build failures under gccgo.
-
-In this repository, those files are amalgamation code that copied from SQLite3. The license
of those codes are depend on the license of SQLite3.
-
-Author
-------
-
-Yasuhiro Matsumoto (a.k.a mattn)

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/c08cb449/newt/Godeps/_workspace/src/github.com/mattn/go-sqlite3/backup.go
----------------------------------------------------------------------
diff --git a/newt/Godeps/_workspace/src/github.com/mattn/go-sqlite3/backup.go b/newt/Godeps/_workspace/src/github.com/mattn/go-sqlite3/backup.go
deleted file mode 100644
index 3807c60..0000000
--- a/newt/Godeps/_workspace/src/github.com/mattn/go-sqlite3/backup.go
+++ /dev/null
@@ -1,70 +0,0 @@
-// Copyright (C) 2014 Yasuhiro Matsumoto <mattn.jp@gmail.com>.
-//
-// Use of this source code is governed by an MIT-style
-// license that can be found in the LICENSE file.
-
-package sqlite3
-
-/*
-#include <sqlite3-binding.h>
-#include <stdlib.h>
-*/
-import "C"
-import (
-	"runtime"
-	"unsafe"
-)
-
-type SQLiteBackup struct {
-	b *C.sqlite3_backup
-}
-
-func (c *SQLiteConn) Backup(dest string, conn *SQLiteConn, src string) (*SQLiteBackup, error)
{
-	destptr := C.CString(dest)
-	defer C.free(unsafe.Pointer(destptr))
-	srcptr := C.CString(src)
-	defer C.free(unsafe.Pointer(srcptr))
-
-	if b := C.sqlite3_backup_init(c.db, destptr, conn.db, srcptr); b != nil {
-		bb := &SQLiteBackup{b: b}
-		runtime.SetFinalizer(bb, (*SQLiteBackup).Finish)
-		return bb, nil
-	}
-	return nil, c.lastError()
-}
-
-// Backs up for one step. Calls the underlying `sqlite3_backup_step` function.
-// This function returns a boolean indicating if the backup is done and
-// an error signalling any other error. Done is returned if the underlying C
-// function returns SQLITE_DONE (Code 101)
-func (b *SQLiteBackup) Step(p int) (bool, error) {
-	ret := C.sqlite3_backup_step(b.b, C.int(p))
-	if ret == C.SQLITE_DONE {
-		return true, nil
-	} else if ret != 0 && ret != C.SQLITE_LOCKED && ret != C.SQLITE_BUSY {
-		return false, Error{Code: ErrNo(ret)}
-	}
-	return false, nil
-}
-
-func (b *SQLiteBackup) Remaining() int {
-	return int(C.sqlite3_backup_remaining(b.b))
-}
-
-func (b *SQLiteBackup) PageCount() int {
-	return int(C.sqlite3_backup_pagecount(b.b))
-}
-
-func (b *SQLiteBackup) Finish() error {
-	return b.Close()
-}
-
-func (b *SQLiteBackup) Close() error {
-	ret := C.sqlite3_backup_finish(b.b)
-	if ret != 0 {
-		return Error{Code: ErrNo(ret)}
-	}
-	b.b = nil
-	runtime.SetFinalizer(b, nil)
-	return nil
-}

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/c08cb449/newt/Godeps/_workspace/src/github.com/mattn/go-sqlite3/doc.go
----------------------------------------------------------------------
diff --git a/newt/Godeps/_workspace/src/github.com/mattn/go-sqlite3/doc.go b/newt/Godeps/_workspace/src/github.com/mattn/go-sqlite3/doc.go
deleted file mode 100644
index 51364c3..0000000
--- a/newt/Godeps/_workspace/src/github.com/mattn/go-sqlite3/doc.go
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
-Package sqlite3 provides interface to SQLite3 databases.
-
-This works as driver for database/sql.
-
-Installation
-
-    go get github.com/mattn/go-sqlite3
-
-Supported Types
-
-Currently, go-sqlite3 support following data types.
-
-    +------------------------------+
-    |go        | sqlite3           |
-    |----------|-------------------|
-    |nil       | null              |
-    |int       | integer           |
-    |int64     | integer           |
-    |float64   | float             |
-    |bool      | integer           |
-    |[]byte    | blob              |
-    |string    | text              |
-    |time.Time | timestamp/datetime|
-    +------------------------------+
-
-SQLite3 Extension
-
-You can write your own extension module for sqlite3. For example, below is a
-extension for Regexp matcher operation.
-
-    #include <pcre.h>
-    #include <string.h>
-    #include <stdio.h>
-    #include <sqlite3ext.h>
-    
-    SQLITE_EXTENSION_INIT1
-    static void regexp_func(sqlite3_context *context, int argc, sqlite3_value **argv) {
-      if (argc >= 2) {
-        const char *target  = (const char *)sqlite3_value_text(argv[1]);
-        const char *pattern = (const char *)sqlite3_value_text(argv[0]);
-        const char* errstr = NULL;
-        int erroff = 0;
-        int vec[500];
-        int n, rc;
-        pcre* re = pcre_compile(pattern, 0, &errstr, &erroff, NULL);
-        rc = pcre_exec(re, NULL, target, strlen(target), 0, 0, vec, 500); 
-        if (rc <= 0) {
-          sqlite3_result_error(context, errstr, 0);
-          return;
-        }
-        sqlite3_result_int(context, 1);
-      }
-    }
-    
-    #ifdef _WIN32
-    __declspec(dllexport)
-    #endif
-    int sqlite3_extension_init(sqlite3 *db, char **errmsg,
-          const sqlite3_api_routines *api) {
-      SQLITE_EXTENSION_INIT2(api);
-      return sqlite3_create_function(db, "regexp", 2, SQLITE_UTF8,
-          (void*)db, regexp_func, NULL, NULL);
-    }
-
-It need to build as so/dll shared library. And you need to register
-extension module like below.
-
-	sql.Register("sqlite3_with_extensions",
-		&sqlite3.SQLiteDriver{
-			Extensions: []string{
-				"sqlite3_mod_regexp",
-			},
-		})
-
-Then, you can use this extension.
-
-	rows, err := db.Query("select text from mytable where name regexp '^golang'")
-
-Connection Hook
-
-You can hook and inject your codes when connection established. database/sql
-doesn't provide the way to get native go-sqlite3 interfaces. So if you want,
-you need to hook ConnectHook and get the SQLiteConn.
-
-	sql.Register("sqlite3_with_hook_example",
-			&sqlite3.SQLiteDriver{
-					ConnectHook: func(conn *sqlite3.SQLiteConn) error {
-						sqlite3conn = append(sqlite3conn, conn)
-						return nil
-					},
-			})
-
-*/
-package sqlite3

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/c08cb449/newt/Godeps/_workspace/src/github.com/mattn/go-sqlite3/error.go
----------------------------------------------------------------------
diff --git a/newt/Godeps/_workspace/src/github.com/mattn/go-sqlite3/error.go b/newt/Godeps/_workspace/src/github.com/mattn/go-sqlite3/error.go
deleted file mode 100644
index b910108..0000000
--- a/newt/Godeps/_workspace/src/github.com/mattn/go-sqlite3/error.go
+++ /dev/null
@@ -1,128 +0,0 @@
-// Copyright (C) 2014 Yasuhiro Matsumoto <mattn.jp@gmail.com>.
-//
-// Use of this source code is governed by an MIT-style
-// license that can be found in the LICENSE file.
-
-package sqlite3
-
-import "C"
-
-type ErrNo int
-
-const ErrNoMask C.int = 0xff
-
-type ErrNoExtended int
-
-type Error struct {
-	Code         ErrNo         /* The error code returned by SQLite */
-	ExtendedCode ErrNoExtended /* The extended error code returned by SQLite */
-	err          string        /* The error string returned by sqlite3_errmsg(),
-	this usually contains more specific details. */
-}
-
-// result codes from http://www.sqlite.org/c3ref/c_abort.html
-var (
-	ErrError      = ErrNo(1)  /* SQL error or missing database */
-	ErrInternal   = ErrNo(2)  /* Internal logic error in SQLite */
-	ErrPerm       = ErrNo(3)  /* Access permission denied */
-	ErrAbort      = ErrNo(4)  /* Callback routine requested an abort */
-	ErrBusy       = ErrNo(5)  /* The database file is locked */
-	ErrLocked     = ErrNo(6)  /* A table in the database is locked */
-	ErrNomem      = ErrNo(7)  /* A malloc() failed */
-	ErrReadonly   = ErrNo(8)  /* Attempt to write a readonly database */
-	ErrInterrupt  = ErrNo(9)  /* Operation terminated by sqlite3_interrupt() */
-	ErrIoErr      = ErrNo(10) /* Some kind of disk I/O error occurred */
-	ErrCorrupt    = ErrNo(11) /* The database disk image is malformed */
-	ErrNotFound   = ErrNo(12) /* Unknown opcode in sqlite3_file_control() */
-	ErrFull       = ErrNo(13) /* Insertion failed because database is full */
-	ErrCantOpen   = ErrNo(14) /* Unable to open the database file */
-	ErrProtocol   = ErrNo(15) /* Database lock protocol error */
-	ErrEmpty      = ErrNo(16) /* Database is empty */
-	ErrSchema     = ErrNo(17) /* The database schema changed */
-	ErrTooBig     = ErrNo(18) /* String or BLOB exceeds size limit */
-	ErrConstraint = ErrNo(19) /* Abort due to constraint violation */
-	ErrMismatch   = ErrNo(20) /* Data type mismatch */
-	ErrMisuse     = ErrNo(21) /* Library used incorrectly */
-	ErrNoLFS      = ErrNo(22) /* Uses OS features not supported on host */
-	ErrAuth       = ErrNo(23) /* Authorization denied */
-	ErrFormat     = ErrNo(24) /* Auxiliary database format error */
-	ErrRange      = ErrNo(25) /* 2nd parameter to sqlite3_bind out of range */
-	ErrNotADB     = ErrNo(26) /* File opened that is not a database file */
-	ErrNotice     = ErrNo(27) /* Notifications from sqlite3_log() */
-	ErrWarning    = ErrNo(28) /* Warnings from sqlite3_log() */
-)
-
-func (err ErrNo) Error() string {
-	return Error{Code: err}.Error()
-}
-
-func (err ErrNo) Extend(by int) ErrNoExtended {
-	return ErrNoExtended(int(err) | (by << 8))
-}
-
-func (err ErrNoExtended) Error() string {
-	return Error{Code: ErrNo(C.int(err) & ErrNoMask), ExtendedCode: err}.Error()
-}
-
-func (err Error) Error() string {
-	if err.err != "" {
-		return err.err
-	}
-	return errorString(err)
-}
-
-// result codes from http://www.sqlite.org/c3ref/c_abort_rollback.html
-var (
-	ErrIoErrRead              = ErrIoErr.Extend(1)
-	ErrIoErrShortRead         = ErrIoErr.Extend(2)
-	ErrIoErrWrite             = ErrIoErr.Extend(3)
-	ErrIoErrFsync             = ErrIoErr.Extend(4)
-	ErrIoErrDirFsync          = ErrIoErr.Extend(5)
-	ErrIoErrTruncate          = ErrIoErr.Extend(6)
-	ErrIoErrFstat             = ErrIoErr.Extend(7)
-	ErrIoErrUnlock            = ErrIoErr.Extend(8)
-	ErrIoErrRDlock            = ErrIoErr.Extend(9)
-	ErrIoErrDelete            = ErrIoErr.Extend(10)
-	ErrIoErrBlocked           = ErrIoErr.Extend(11)
-	ErrIoErrNoMem             = ErrIoErr.Extend(12)
-	ErrIoErrAccess            = ErrIoErr.Extend(13)
-	ErrIoErrCheckReservedLock = ErrIoErr.Extend(14)
-	ErrIoErrLock              = ErrIoErr.Extend(15)
-	ErrIoErrClose             = ErrIoErr.Extend(16)
-	ErrIoErrDirClose          = ErrIoErr.Extend(17)
-	ErrIoErrSHMOpen           = ErrIoErr.Extend(18)
-	ErrIoErrSHMSize           = ErrIoErr.Extend(19)
-	ErrIoErrSHMLock           = ErrIoErr.Extend(20)
-	ErrIoErrSHMMap            = ErrIoErr.Extend(21)
-	ErrIoErrSeek              = ErrIoErr.Extend(22)
-	ErrIoErrDeleteNoent       = ErrIoErr.Extend(23)
-	ErrIoErrMMap              = ErrIoErr.Extend(24)
-	ErrIoErrGetTempPath       = ErrIoErr.Extend(25)
-	ErrIoErrConvPath          = ErrIoErr.Extend(26)
-	ErrLockedSharedCache      = ErrLocked.Extend(1)
-	ErrBusyRecovery           = ErrBusy.Extend(1)
-	ErrBusySnapshot           = ErrBusy.Extend(2)
-	ErrCantOpenNoTempDir      = ErrCantOpen.Extend(1)
-	ErrCantOpenIsDir          = ErrCantOpen.Extend(2)
-	ErrCantOpenFullPath       = ErrCantOpen.Extend(3)
-	ErrCantOpenConvPath       = ErrCantOpen.Extend(4)
-	ErrCorruptVTab            = ErrCorrupt.Extend(1)
-	ErrReadonlyRecovery       = ErrReadonly.Extend(1)
-	ErrReadonlyCantLock       = ErrReadonly.Extend(2)
-	ErrReadonlyRollback       = ErrReadonly.Extend(3)
-	ErrReadonlyDbMoved        = ErrReadonly.Extend(4)
-	ErrAbortRollback          = ErrAbort.Extend(2)
-	ErrConstraintCheck        = ErrConstraint.Extend(1)
-	ErrConstraintCommitHook   = ErrConstraint.Extend(2)
-	ErrConstraintForeignKey   = ErrConstraint.Extend(3)
-	ErrConstraintFunction     = ErrConstraint.Extend(4)
-	ErrConstraintNotNull      = ErrConstraint.Extend(5)
-	ErrConstraintPrimaryKey   = ErrConstraint.Extend(6)
-	ErrConstraintTrigger      = ErrConstraint.Extend(7)
-	ErrConstraintUnique       = ErrConstraint.Extend(8)
-	ErrConstraintVTab         = ErrConstraint.Extend(9)
-	ErrConstraintRowId        = ErrConstraint.Extend(10)
-	ErrNoticeRecoverWAL       = ErrNotice.Extend(1)
-	ErrNoticeRecoverRollback  = ErrNotice.Extend(2)
-	ErrWarningAutoIndex       = ErrWarning.Extend(1)
-)

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/c08cb449/newt/Godeps/_workspace/src/github.com/mattn/go-sqlite3/error_test.go
----------------------------------------------------------------------
diff --git a/newt/Godeps/_workspace/src/github.com/mattn/go-sqlite3/error_test.go b/newt/Godeps/_workspace/src/github.com/mattn/go-sqlite3/error_test.go
deleted file mode 100644
index 1ccbe5b..0000000
--- a/newt/Godeps/_workspace/src/github.com/mattn/go-sqlite3/error_test.go
+++ /dev/null
@@ -1,242 +0,0 @@
-// Copyright (C) 2014 Yasuhiro Matsumoto <mattn.jp@gmail.com>.
-//
-// Use of this source code is governed by an MIT-style
-// license that can be found in the LICENSE file.
-
-package sqlite3
-
-import (
-	"database/sql"
-	"io/ioutil"
-	"os"
-	"path"
-	"testing"
-)
-
-func TestSimpleError(t *testing.T) {
-	e := ErrError.Error()
-	if e != "SQL logic error or missing database" {
-		t.Error("wrong error code:" + e)
-	}
-}
-
-func TestCorruptDbErrors(t *testing.T) {
-	dirName, err := ioutil.TempDir("", "sqlite3")
-	if err != nil {
-		t.Fatal(err)
-	}
-	defer os.RemoveAll(dirName)
-
-	dbFileName := path.Join(dirName, "test.db")
-	f, err := os.Create(dbFileName)
-	if err != nil {
-		t.Error(err)
-	}
-	f.Write([]byte{1, 2, 3, 4, 5})
-	f.Close()
-
-	db, err := sql.Open("sqlite3", dbFileName)
-	if err == nil {
-		_, err = db.Exec("drop table foo")
-	}
-
-	sqliteErr := err.(Error)
-	if sqliteErr.Code != ErrNotADB {
-		t.Error("wrong error code for corrupted DB")
-	}
-	if err.Error() == "" {
-		t.Error("wrong error string for corrupted DB")
-	}
-	db.Close()
-}
-
-func TestSqlLogicErrors(t *testing.T) {
-	dirName, err := ioutil.TempDir("", "sqlite3")
-	if err != nil {
-		t.Fatal(err)
-	}
-	defer os.RemoveAll(dirName)
-
-	dbFileName := path.Join(dirName, "test.db")
-	db, err := sql.Open("sqlite3", dbFileName)
-	if err != nil {
-		t.Error(err)
-	}
-	defer db.Close()
-
-	_, err = db.Exec("CREATE TABLE Foo (id INTEGER PRIMARY KEY)")
-	if err != nil {
-		t.Error(err)
-	}
-
-	const expectedErr = "table Foo already exists"
-	_, err = db.Exec("CREATE TABLE Foo (id INTEGER PRIMARY KEY)")
-	if err.Error() != expectedErr {
-		t.Errorf("Unexpected error: %s, expected %s", err.Error(), expectedErr)
-	}
-
-}
-
-func TestExtendedErrorCodes_ForeignKey(t *testing.T) {
-	dirName, err := ioutil.TempDir("", "sqlite3-err")
-	if err != nil {
-		t.Fatal(err)
-	}
-	defer os.RemoveAll(dirName)
-
-	dbFileName := path.Join(dirName, "test.db")
-	db, err := sql.Open("sqlite3", dbFileName)
-	if err != nil {
-		t.Error(err)
-	}
-	defer db.Close()
-
-	_, err = db.Exec("PRAGMA foreign_keys=ON;")
-	if err != nil {
-		t.Errorf("PRAGMA foreign_keys=ON: %v", err)
-	}
-
-	_, err = db.Exec(`CREATE TABLE Foo (
-		id INTEGER PRIMARY KEY AUTOINCREMENT,
-		value INTEGER NOT NULL,
-		ref INTEGER NULL REFERENCES Foo (id),
-		UNIQUE(value)
-	);`)
-	if err != nil {
-		t.Error(err)
-	}
-
-	_, err = db.Exec("INSERT INTO Foo (ref, value) VALUES (100, 100);")
-	if err == nil {
-		t.Error("No error!")
-	} else {
-		sqliteErr := err.(Error)
-		if sqliteErr.Code != ErrConstraint {
-			t.Errorf("Wrong basic error code: %d != %d",
-				sqliteErr.Code, ErrConstraint)
-		}
-		if sqliteErr.ExtendedCode != ErrConstraintForeignKey {
-			t.Errorf("Wrong extended error code: %d != %d",
-				sqliteErr.ExtendedCode, ErrConstraintForeignKey)
-		}
-	}
-
-}
-
-func TestExtendedErrorCodes_NotNull(t *testing.T) {
-	dirName, err := ioutil.TempDir("", "sqlite3-err")
-	if err != nil {
-		t.Fatal(err)
-	}
-	defer os.RemoveAll(dirName)
-
-	dbFileName := path.Join(dirName, "test.db")
-	db, err := sql.Open("sqlite3", dbFileName)
-	if err != nil {
-		t.Error(err)
-	}
-	defer db.Close()
-
-	_, err = db.Exec("PRAGMA foreign_keys=ON;")
-	if err != nil {
-		t.Errorf("PRAGMA foreign_keys=ON: %v", err)
-	}
-
-	_, err = db.Exec(`CREATE TABLE Foo (
-		id INTEGER PRIMARY KEY AUTOINCREMENT,
-		value INTEGER NOT NULL,
-		ref INTEGER NULL REFERENCES Foo (id),
-		UNIQUE(value)
-	);`)
-	if err != nil {
-		t.Error(err)
-	}
-
-	res, err := db.Exec("INSERT INTO Foo (value) VALUES (100);")
-	if err != nil {
-		t.Fatalf("Creating first row: %v", err)
-	}
-
-	id, err := res.LastInsertId()
-	if err != nil {
-		t.Fatalf("Retrieving last insert id: %v", err)
-	}
-
-	_, err = db.Exec("INSERT INTO Foo (ref) VALUES (?);", id)
-	if err == nil {
-		t.Error("No error!")
-	} else {
-		sqliteErr := err.(Error)
-		if sqliteErr.Code != ErrConstraint {
-			t.Errorf("Wrong basic error code: %d != %d",
-				sqliteErr.Code, ErrConstraint)
-		}
-		if sqliteErr.ExtendedCode != ErrConstraintNotNull {
-			t.Errorf("Wrong extended error code: %d != %d",
-				sqliteErr.ExtendedCode, ErrConstraintNotNull)
-		}
-	}
-
-}
-
-func TestExtendedErrorCodes_Unique(t *testing.T) {
-	dirName, err := ioutil.TempDir("", "sqlite3-err")
-	if err != nil {
-		t.Fatal(err)
-	}
-	defer os.RemoveAll(dirName)
-
-	dbFileName := path.Join(dirName, "test.db")
-	db, err := sql.Open("sqlite3", dbFileName)
-	if err != nil {
-		t.Error(err)
-	}
-	defer db.Close()
-
-	_, err = db.Exec("PRAGMA foreign_keys=ON;")
-	if err != nil {
-		t.Errorf("PRAGMA foreign_keys=ON: %v", err)
-	}
-
-	_, err = db.Exec(`CREATE TABLE Foo (
-		id INTEGER PRIMARY KEY AUTOINCREMENT,
-		value INTEGER NOT NULL,
-		ref INTEGER NULL REFERENCES Foo (id),
-		UNIQUE(value)
-	);`)
-	if err != nil {
-		t.Error(err)
-	}
-
-	res, err := db.Exec("INSERT INTO Foo (value) VALUES (100);")
-	if err != nil {
-		t.Fatalf("Creating first row: %v", err)
-	}
-
-	id, err := res.LastInsertId()
-	if err != nil {
-		t.Fatalf("Retrieving last insert id: %v", err)
-	}
-
-	_, err = db.Exec("INSERT INTO Foo (ref, value) VALUES (?, 100);", id)
-	if err == nil {
-		t.Error("No error!")
-	} else {
-		sqliteErr := err.(Error)
-		if sqliteErr.Code != ErrConstraint {
-			t.Errorf("Wrong basic error code: %d != %d",
-				sqliteErr.Code, ErrConstraint)
-		}
-		if sqliteErr.ExtendedCode != ErrConstraintUnique {
-			t.Errorf("Wrong extended error code: %d != %d",
-				sqliteErr.ExtendedCode, ErrConstraintUnique)
-		}
-		extended := sqliteErr.Code.Extend(3).Error()
-		expected := "constraint failed"
-		if extended != expected {
-			t.Errorf("Wrong basic error code: %q != %q",
-				extended, expected)
-		}
-	}
-
-}


Mime
View raw message