Hello community, here is the log from the commit of package go-gosqlite for openSUSE:Factory checked in at 2012-01-19 16:55:35 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/go-gosqlite (Old) and /work/SRC/openSUSE:Factory/.go-gosqlite.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "go-gosqlite", Maintainer is "" Changes: -------- --- /work/SRC/openSUSE:Factory/go-gosqlite/go-gosqlite.changes 2011-10-27 19:16:28.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.go-gosqlite.new/go-gosqlite.changes 2012-01-19 16:55:36.000000000 +0100 @@ -1,0 +2,5 @@ +Tue Jan 10 09:21:18 UTC 2012 - sasc...@suse.de + +- Update to 12/01/2012 mercurial release + +------------------------------------------------------------------- Old: ---- gosqlite-0.0.0+hg20110601.tar.bz2 New: ---- Makefile gosqlite-0.0.0+hg20120110.tar.bz2 gosqlite-weekly-fixes.patch ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ go-gosqlite.spec ++++++ --- /var/tmp/diff_new_pack.dh1Bcw/_old 2012-01-19 16:55:37.000000000 +0100 +++ /var/tmp/diff_new_pack.dh1Bcw/_new 2012-01-19 16:55:37.000000000 +0100 @@ -1,5 +1,8 @@ # -# Copyright (c), 2011, Sascha Peilicke <sasc...@gmx.de> +# spec file for package go-gosqlite +# +# Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany. +# Copyright (c) 2012 Sascha Peilicke <sasc...@gmx.de> # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -10,15 +13,20 @@ # license that conforms to the Open Source Definition (Version 1.9) # published by the Open Source Initiative. +# Please submit bugfixes or comments via http://bugs.opensuse.org/ +# + Name: go-gosqlite -Version: 0.0.0+hg20110601 +Version: 0.0.0+hg20120110 Release: 0 Summary: Trivial SQLite binding for Go -Group: Development/Languages/Other License: BSD-3-Clause -URL: http://code.google.com/p/gosqlite/ +Group: Development/Languages/Other +Url: http://code.google.com/p/gosqlite/ Source0: gosqlite-%{version}.tar.bz2 Source1: LICENSE +Source2: Makefile +Patch0: gosqlite-weekly-fixes.patch BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRequires: go-devel %if 0%{?fedora_version} || 0%{?rhel_version} || 0%{?centos_version} @@ -37,7 +45,9 @@ %prep %setup -q -n gosqlite +%patch0 -p1 cp %{SOURCE1} . +cp %{SOURCE2} ./sqlite %build %install ++++++ Makefile ++++++ include $(GOROOT)/src/Make.inc TARG=code.google.com/p/gosqlite CGOFILES:=sqlite.go include $(GOROOT)/src/Make.pkg ++++++ gosqlite-0.0.0+hg20110601.tar.bz2 -> gosqlite-0.0.0+hg20120110.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gosqlite/sqlite/Makefile new/gosqlite/sqlite/Makefile --- old/gosqlite/sqlite/Makefile 2011-06-01 14:37:10.000000000 +0200 +++ new/gosqlite/sqlite/Makefile 1970-01-01 01:00:00.000000000 +0100 @@ -1,18 +0,0 @@ -# Copyright 2010 The Go Authors. All rights reserved. -# Use of this source code is governed by a BSD-style -# license that can be found in the LICENSE file. - -include $(GOROOT)/src/Make.inc - -TARG=gosqlite.googlecode.com/hg/sqlite - -CGOFILES=\ - sqlite.go - -ifeq ($(GOOS),darwin) -CGO_LDFLAGS=/usr/lib/libsqlite3.0.dylib -else -CGO_LDFLAGS=-L/usr/local/lib/oeis -lsqlite3 -endif - -include $(GOROOT)/src/Make.pkg diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gosqlite/sqlite/sqlite.go new/gosqlite/sqlite/sqlite.go --- old/gosqlite/sqlite/sqlite.go 2011-06-01 14:37:10.000000000 +0200 +++ new/gosqlite/sqlite/sqlite.go 2012-01-10 09:50:04.000000000 +0100 @@ -6,6 +6,8 @@ package sqlite /* +#cgo LDFLAGS: -lsqlite3 + #include <sqlite3.h> #include <stdlib.h> @@ -28,6 +30,7 @@ import "C" import ( + "errors" "fmt" "os" "reflect" @@ -38,7 +41,7 @@ type Errno int -func (e Errno) String() string { +func (e Errno) Error() string { s := errText[e] if s == "" { return fmt.Sprintf("errno %d", int(e)) @@ -47,76 +50,76 @@ } var ( - ErrError os.Error = Errno(1) // /* SQL error or missing database */ - ErrInternal os.Error = Errno(2) // /* Internal logic error in SQLite */ - ErrPerm os.Error = Errno(3) // /* Access permission denied */ - ErrAbort os.Error = Errno(4) // /* Callback routine requested an abort */ - ErrBusy os.Error = Errno(5) // /* The database file is locked */ - ErrLocked os.Error = Errno(6) // /* A table in the database is locked */ - ErrNoMem os.Error = Errno(7) // /* A malloc() failed */ - ErrReadOnly os.Error = Errno(8) // /* Attempt to write a readonly database */ - ErrInterrupt os.Error = Errno(9) // /* Operation terminated by sqlite3_interrupt()*/ - ErrIOErr os.Error = Errno(10) // /* Some kind of disk I/O error occurred */ - ErrCorrupt os.Error = Errno(11) // /* The database disk image is malformed */ - ErrFull os.Error = Errno(13) // /* Insertion failed because database is full */ - ErrCantOpen os.Error = Errno(14) // /* Unable to open the database file */ - ErrEmpty os.Error = Errno(16) // /* Database is empty */ - ErrSchema os.Error = Errno(17) // /* The database schema changed */ - ErrTooBig os.Error = Errno(18) // /* String or BLOB exceeds size limit */ - ErrConstraint os.Error = Errno(19) // /* Abort due to constraint violation */ - ErrMismatch os.Error = Errno(20) // /* Data type mismatch */ - ErrMisuse os.Error = Errno(21) // /* Library used incorrectly */ - ErrNolfs os.Error = Errno(22) // /* Uses OS features not supported on host */ - ErrAuth os.Error = Errno(23) // /* Authorization denied */ - ErrFormat os.Error = Errno(24) // /* Auxiliary database format error */ - ErrRange os.Error = Errno(25) // /* 2nd parameter to sqlite3_bind out of range */ - ErrNotDB os.Error = Errno(26) // /* File opened that is not a database file */ - Row = Errno(100) // /* sqlite3_step() has another row ready */ - Done = Errno(101) // /* sqlite3_step() has finished executing */ + ErrError error = Errno(1) // /* SQL error or missing database */ + ErrInternal error = Errno(2) // /* Internal logic error in SQLite */ + ErrPerm error = Errno(3) // /* Access permission denied */ + ErrAbort error = Errno(4) // /* Callback routine requested an abort */ + ErrBusy error = Errno(5) // /* The database file is locked */ + ErrLocked error = Errno(6) // /* A table in the database is locked */ + ErrNoMem error = Errno(7) // /* A malloc() failed */ + ErrReadOnly error = Errno(8) // /* Attempt to write a readonly database */ + ErrInterrupt error = Errno(9) // /* Operation terminated by sqlite3_interrupt()*/ + ErrIOErr error = Errno(10) // /* Some kind of disk I/O error occurred */ + ErrCorrupt error = Errno(11) // /* The database disk image is malformed */ + ErrFull error = Errno(13) // /* Insertion failed because database is full */ + ErrCantOpen error = Errno(14) // /* Unable to open the database file */ + ErrEmpty error = Errno(16) // /* Database is empty */ + ErrSchema error = Errno(17) // /* The database schema changed */ + ErrTooBig error = Errno(18) // /* String or BLOB exceeds size limit */ + ErrConstraint error = Errno(19) // /* Abort due to constraint violation */ + ErrMismatch error = Errno(20) // /* Data type mismatch */ + ErrMisuse error = Errno(21) // /* Library used incorrectly */ + ErrNolfs error = Errno(22) // /* Uses OS features not supported on host */ + ErrAuth error = Errno(23) // /* Authorization denied */ + ErrFormat error = Errno(24) // /* Auxiliary database format error */ + ErrRange error = Errno(25) // /* 2nd parameter to sqlite3_bind out of range */ + ErrNotDB error = Errno(26) // /* File opened that is not a database file */ + Row = Errno(100) // /* sqlite3_step() has another row ready */ + Done = Errno(101) // /* sqlite3_step() has finished executing */ ) -var errText = map[Errno]string { - 1: "SQL error or missing database", - 2: "Internal logic error in SQLite", - 3: "Access permission denied", - 4: "Callback routine requested an abort", - 5: "The database file is locked", - 6: "A table in the database is locked", - 7: "A malloc() failed", - 8: "Attempt to write a readonly database", - 9: "Operation terminated by sqlite3_interrupt()*/", - 10: "Some kind of disk I/O error occurred", - 11: "The database disk image is malformed", - 12: "NOT USED. Table or record not found", - 13: "Insertion failed because database is full", - 14: "Unable to open the database file", - 15: "NOT USED. Database lock protocol error", - 16: "Database is empty", - 17: "The database schema changed", - 18: "String or BLOB exceeds size limit", - 19: "Abort due to constraint violation", - 20: "Data type mismatch", - 21: "Library used incorrectly", - 22: "Uses OS features not supported on host", - 23: "Authorization denied", - 24: "Auxiliary database format error", - 25: "2nd parameter to sqlite3_bind out of range", - 26: "File opened that is not a database file", +var errText = map[Errno]string{ + 1: "SQL error or missing database", + 2: "Internal logic error in SQLite", + 3: "Access permission denied", + 4: "Callback routine requested an abort", + 5: "The database file is locked", + 6: "A table in the database is locked", + 7: "A malloc() failed", + 8: "Attempt to write a readonly database", + 9: "Operation terminated by sqlite3_interrupt()*/", + 10: "Some kind of disk I/O error occurred", + 11: "The database disk image is malformed", + 12: "NOT USED. Table or record not found", + 13: "Insertion failed because database is full", + 14: "Unable to open the database file", + 15: "NOT USED. Database lock protocol error", + 16: "Database is empty", + 17: "The database schema changed", + 18: "String or BLOB exceeds size limit", + 19: "Abort due to constraint violation", + 20: "Data type mismatch", + 21: "Library used incorrectly", + 22: "Uses OS features not supported on host", + 23: "Authorization denied", + 24: "Auxiliary database format error", + 25: "2nd parameter to sqlite3_bind out of range", + 26: "File opened that is not a database file", 100: "sqlite3_step() has another row ready", 101: "sqlite3_step() has finished executing", } -func (c *Conn) error(rv C.int) os.Error { +func (c *Conn) error(rv C.int) error { if c == nil || c.db == nil { - return os.NewError("nil sqlite database") + return errors.New("nil sqlite database") } if rv == 0 { return nil } - if rv == 21 { // misuse + if rv == 21 { // misuse return Errno(rv) } - return os.NewError(Errno(rv).String() + ": " + C.GoString(C.sqlite3_errmsg(c.db))) + return errors.New(Errno(rv).Error() + ": " + C.GoString(C.sqlite3_errmsg(c.db))) } type Conn struct { @@ -124,33 +127,33 @@ } func Version() string { - p := C.sqlite3_libversion(); - return C.GoString(p); + p := C.sqlite3_libversion() + return C.GoString(p) } -func Open(filename string) (*Conn, os.Error) { +func Open(filename string) (*Conn, error) { if C.sqlite3_threadsafe() == 0 { - return nil, os.NewError("sqlite library was not compiled for thread-safe operation") + return nil, errors.New("sqlite library was not compiled for thread-safe operation") } var db *C.sqlite3 name := C.CString(filename) defer C.free(unsafe.Pointer(name)) rv := C.sqlite3_open_v2(name, &db, - C.SQLITE_OPEN_FULLMUTEX | - C.SQLITE_OPEN_READWRITE | - C.SQLITE_OPEN_CREATE, + C.SQLITE_OPEN_FULLMUTEX| + C.SQLITE_OPEN_READWRITE| + C.SQLITE_OPEN_CREATE, nil) if rv != 0 { return nil, Errno(rv) } if db == nil { - return nil, os.NewError("sqlite succeeded without returning a database") + return nil, errors.New("sqlite succeeded without returning a database") } return &Conn{db}, nil } -func NewBackup(dst *Conn, dstTable string, src *Conn, srcTable string) (*Backup, os.Error) { +func NewBackup(dst *Conn, dstTable string, src *Conn, srcTable string) (*Backup, error) { dname := C.CString(dstTable) sname := C.CString(srcTable) defer C.free(unsafe.Pointer(dname)) @@ -164,18 +167,18 @@ } type Backup struct { - sb *C.sqlite3_backup + sb *C.sqlite3_backup dst, src *Conn } -func (b *Backup) Step(npage int) os.Error { +func (b *Backup) Step(npage int) error { rv := C.sqlite3_backup_step(b.sb, C.int(npage)) if rv == 0 || Errno(rv) == ErrBusy || Errno(rv) == ErrLocked { return nil } return Errno(rv) } - + type BackupStatus struct { Remaining int PageCount int @@ -185,8 +188,8 @@ return BackupStatus{int(C.sqlite3_backup_remaining(b.sb)), int(C.sqlite3_backup_pagecount(b.sb))} } -func (b *Backup) Run(npage int, sleepNs int64, c chan<- BackupStatus) os.Error { - var err os.Error +func (b *Backup) Run(npage int, sleepNs int64, c chan<- BackupStatus) error { + var err error for { err = b.Step(npage) if err != nil { @@ -197,10 +200,10 @@ } time.Sleep(sleepNs) } - return b.dst.error(C.sqlite3_errcode(b.dst.db)) + return b.dst.error(C.sqlite3_errcode(b.dst.db)) } -func (b *Backup) Close() os.Error { +func (b *Backup) Close() error { if b.sb == nil { return os.EINVAL } @@ -209,7 +212,7 @@ return nil } -func (c *Conn) BusyTimeout(ms int) os.Error { +func (c *Conn) BusyTimeout(ms int) error { rv := C.sqlite3_busy_timeout(c.db, C.int(ms)) if rv == 0 { return nil @@ -217,7 +220,7 @@ return Errno(rv) } -func (c *Conn) Exec(cmd string, args ...interface{}) os.Error { +func (c *Conn) Exec(cmd string, args ...interface{}) error { s, err := c.Prepare(cmd) if err != nil { return err @@ -235,17 +238,17 @@ } type Stmt struct { - c *Conn + c *Conn stmt *C.sqlite3_stmt - err os.Error - t0 int64 - sql string + err error + t0 int64 + sql string args string } -func (c *Conn) Prepare(cmd string) (*Stmt, os.Error) { +func (c *Conn) Prepare(cmd string) (*Stmt, error) { if c == nil || c.db == nil { - return nil, os.NewError("nil sqlite database") + return nil, errors.New("nil sqlite database") } cmdstr := C.CString(cmd) defer C.free(unsafe.Pointer(cmdstr)) @@ -258,7 +261,7 @@ return &Stmt{c: c, stmt: stmt, sql: cmd, t0: time.Nanoseconds()}, nil } -func (s *Stmt) Exec(args ...interface{}) os.Error { +func (s *Stmt) Exec(args ...interface{}) error { s.args = fmt.Sprintf(" %v", []interface{}(args)) rv := C.sqlite3_reset(s.stmt) if rv != 0 { @@ -267,7 +270,7 @@ n := int(C.sqlite3_bind_parameter_count(s.stmt)) if n != len(args) { - return os.NewError(fmt.Sprintf("incorrect argument count for Stmt.Exec: have %d want %d", len(args), n)) + return errors.New(fmt.Sprintf("incorrect argument count for Stmt.Exec: have %d want %d", len(args), n)) } for i, v := range args { @@ -282,7 +285,7 @@ return s.c.error(rv) } continue - + case bool: if v { str = "1" @@ -293,7 +296,7 @@ default: str = fmt.Sprint(v) } - + cstr := C.CString(str) rv := C.my_bind_text(s.stmt, C.int(i+1), cstr, C.int(len(str))) C.free(unsafe.Pointer(cstr)) @@ -304,7 +307,7 @@ return nil } -func (s *Stmt) Error() os.Error { +func (s *Stmt) Error() error { return s.err } @@ -317,29 +320,29 @@ if err != Done { s.err = s.c.error(rv) } - return false + return false } -func (s *Stmt) Reset() os.Error { +func (s *Stmt) Reset() error { C.sqlite3_reset(s.stmt) return nil } -func (s *Stmt) Scan(args ...interface{}) os.Error { +func (s *Stmt) Scan(args ...interface{}) error { n := int(C.sqlite3_column_count(s.stmt)) if n != len(args) { - return os.NewError(fmt.Sprintf("incorrect argument count for Stmt.Scan: have %d want %d", len(args), n)) + return errors.New(fmt.Sprintf("incorrect argument count for Stmt.Scan: have %d want %d", len(args), n)) } - + for i, v := range args { n := C.sqlite3_column_bytes(s.stmt, C.int(i)) p := C.sqlite3_column_blob(s.stmt, C.int(i)) if p == nil && n > 0 { - return os.NewError("got nil blob") + return errors.New("got nil blob") } var data []byte if n > 0 { - data = (*[1<<30]byte)(unsafe.Pointer(p))[0:n] + data = (*[1 << 30]byte)(unsafe.Pointer(p))[0:n] } switch v := v.(type) { case *[]byte: @@ -351,23 +354,23 @@ case *int: x, err := strconv.Atoi(string(data)) if err != nil { - return os.NewError("arg " + strconv.Itoa(i) + " as int: " + err.String()) + return errors.New("arg " + strconv.Itoa(i) + " as int: " + err.Error()) } *v = x case *int64: x, err := strconv.Atoi64(string(data)) if err != nil { - return os.NewError("arg " + strconv.Itoa(i) + " as int64: " + err.String()) + return errors.New("arg " + strconv.Itoa(i) + " as int64: " + err.Error()) } *v = x case *float64: x, err := strconv.Atof64(string(data)) if err != nil { - return os.NewError("arg " + strconv.Itoa(i) + " as float64: " + err.String()) + return errors.New("arg " + strconv.Itoa(i) + " as float64: " + err.Error()) } *v = x default: - return os.NewError("unsupported type in Scan: " + reflect.TypeOf(v).String()) + return errors.New("unsupported type in Scan: " + reflect.TypeOf(v).String()) } } return nil @@ -381,7 +384,7 @@ return time.Nanoseconds() - s.t0 } -func (s *Stmt) Finalize() os.Error { +func (s *Stmt) Finalize() error { rv := C.sqlite3_finalize(s.stmt) if rv != 0 { return s.c.error(rv) @@ -389,9 +392,9 @@ return nil } -func (c *Conn) Close() os.Error { +func (c *Conn) Close() error { if c == nil || c.db == nil { - return os.NewError("nil sqlite database") + return errors.New("nil sqlite database") } rv := C.sqlite3_close(c.db) if rv != 0 { ++++++ gosqlite-weekly-fixes.patch ++++++ diff -ru a/sqlite/sqlite.go b/sqlite/sqlite.go --- a/sqlite/sqlite.go 2012-01-10 09:50:04.920429412 +0100 +++ b/sqlite/sqlite.go 2012-01-10 10:20:40.375473148 +0100 @@ -35,8 +35,8 @@ "os" "reflect" "strconv" - "unsafe" "time" + "unsafe" ) type Errno int @@ -188,7 +188,7 @@ return BackupStatus{int(C.sqlite3_backup_remaining(b.sb)), int(C.sqlite3_backup_pagecount(b.sb))} } -func (b *Backup) Run(npage int, sleepNs int64, c chan<- BackupStatus) error { +func (b *Backup) Run(npage int, sleepNs time.Duration, c chan<- BackupStatus) error { var err error for { err = b.Step(npage) @@ -241,7 +241,7 @@ c *Conn stmt *C.sqlite3_stmt err error - t0 int64 + t0 time.Time sql string args string } @@ -258,7 +258,7 @@ if rv != 0 { return nil, c.error(rv) } - return &Stmt{c: c, stmt: stmt, sql: cmd, t0: time.Nanoseconds()}, nil + return &Stmt{c: c, stmt: stmt, sql: cmd, t0: time.Now()}, nil } func (s *Stmt) Exec(args ...interface{}) error { @@ -358,13 +358,13 @@ } *v = x case *int64: - x, err := strconv.Atoi64(string(data)) + x, err := strconv.ParseInt(string(data), 10, 64) if err != nil { return errors.New("arg " + strconv.Itoa(i) + " as int64: " + err.Error()) } *v = x case *float64: - x, err := strconv.Atof64(string(data)) + x, err := strconv.ParseFloat(string(data), 64) if err != nil { return errors.New("arg " + strconv.Itoa(i) + " as float64: " + err.Error()) } @@ -380,10 +380,6 @@ return s.sql + s.args } -func (s *Stmt) Nanoseconds() int64 { - return time.Nanoseconds() - s.t0 -} - func (s *Stmt) Finalize() error { rv := C.sqlite3_finalize(s.stmt) if rv != 0 { Only in b/sqlite: .sqlite.go.swp -- To unsubscribe, e-mail: opensuse-commit+unsubscr...@opensuse.org For additional commands, e-mail: opensuse-commit+h...@opensuse.org