Coder Social home page Coder Social logo

gosqlite's People

Contributors

rsc avatar

Watchers

 avatar  avatar

gosqlite's Issues

Fail when checking API compatibility

What steps will reproduce the problem?
run ./all.bash 
when Checking API compatibility 

What is the expected output? What do you see instead?

Expected:
ALL TESTS PASSED

Error:
# Checking API compatibility.
2012/11/30 12:30:56 unknown type of variable "Row", type *ast.CallExpr, error = 
not a known function "Errno"
code: Errno(100)


What version of the product are you using? On what operating system?
go version devel +86eed47f9b5c Thu Nov 29 18:00:51 2012 -0800
mac os x

Please provide any additional information below.
just fix it by changing

    Row            = Errno(100) //   /* sqlite3_step() has another row ready */
    Done           = Errno(101) //   /* sqlite3_step() has finished executing */

to

    Row           error = Errno(100) //   /* sqlite3_step() has another row ready */
    Done          error = Errno(101) //   /* sqlite3_step() has finished executing */


Original issue reported on code.google.com by [email protected] on 30 Nov 2012 at 3:44

[PATCH] add wrapper for C.sqlite3_last_insert_rowid

gosqlite is missing a function to retrieve the id of the last inserted row, as 
documented on <http://www.sqlite.org/c3ref/last_insert_rowid.html>. 
Fortunately, adding it is trivial:

func (c *Conn) LastInsertRowID() (int64) {
    return int64(C.sqlite3_last_insert_rowid(c.db))
}

Original issue reported on code.google.com by [email protected] on 16 Jan 2011 at 3:35

unable to close the database

Open the DB:

    conn, err := sqlite.Open("database.db")
    if err != nil {
        panic(err)
    }
    defer conn.Close()
    conn.BusyTimeout(1500)

make a simple query:

    queryString := "SELECT * FROM persons;"
    err = conn.Exec(queryString)

After the query, the program outputs:

Error closing DB: The database file is locked: unable to close due to 
unfinalised statements

Using go1 on linux amd64

Original issue reported on code.google.com by [email protected] on 26 Jul 2012 at 11:50

Unable to install from goinstall

What steps will reproduce the problem?
1. $ goinstall gosqlite.googlecode.com/hg

What is the expected output? What do you see instead?
goinstall returns: goinstall: gosqlite.googlecode.com/hg: package has no files

What version of the product are you using? On what operating system?
goinstall from latest Go Release (release.2011-02-01.1)

Please provide any additional information below.
If done manually, works fine

Original issue reported on code.google.com by [email protected] on 8 Feb 2011 at 10:47

Error-prone usage about BLOB data?

What steps will reproduce the problem?
1. Define a table with BLOB coloum.
   SQL: 
       create table images(id int, img BLOB)
2. Read data.
   CODE:
       func getImg(conn *sqlite.Conn) []byte {
           var img []byte
           s, _ := conn.Prepare("select img from images")
           s.Exec()
           if s.Next() { s.Scan(&img) }
           s.Finalize()
           return img
       }    
3. Now the return value of getImg() is INCORRECT.

What is the expected output? What do you see instead?
The Question is here in source:   sqlite.go:217
       data = (*[1<<30]byte)(unsafe.Pointer(p))[0:n]
Here no data copy. But when stmt Finalized, all memory will be released.

What version of the product are you using? On what operating system?


Please provide any additional information below.


Original issue reported on code.google.com by [email protected] on 29 Jun 2010 at 11:42

gosqlite will not compile on OS Mavericks 10.9.4

What steps will reproduce the problem?
1. mkdir mygo2
2. export GOPATH=~/mygo2
3. go get code.google.com/p/gosqlite/sqlite

What is the expected output? What do you see instead?

go get should build gosqlite in my workspace instead I see:

Peggys-MacBook-Air:mygo2 pegerita$ go get code.google.com/p/gosqlite/sqlite
# code.google.com/p/gosqlite/sqlite
could not determine kind of name for C.free
could not determine kind of name for C.sqlite3_backup_remaining
could not determine kind of name for C.sqlite3_backup_pagecount
could not determine kind of name for C.sqlite3_backup_finish
could not determine kind of name for C.sqlite3_reset
could not determine kind of name for C.GoString
could not determine kind of name for C.sqlite3_errmsg
could not determine kind of name for C.sqlite3_libversion
could not determine kind of name for C.sqlite3_backup_step
could not determine kind of name for C.sqlite3_busy_timeout
could not determine kind of name for C.my_bind_text
could not determine kind of name for C.sqlite3_column_bytes
could not determine kind of name for C.sqlite3_open_v2
could not determine kind of name for C.CString


What version of the product are you using? On what operating system?

I am using Mac OS Mavericks 10.9.4

go version
go version go1.1.2 darwin/amd64
Peggys-MacBook-Air:mygo2 pegerita$ gcc -v
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr 
--with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacO
SX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/c++/4.2.1
Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM 3.4svn)
Target: x86_64-apple-darwin13.3.0
Thread model: posix



Please provide any additional information below.


Original issue reported on code.google.com by [email protected] on 24 Jul 2014 at 2:09

Junk in the error text

Error number 9 contains leftovers from the C comment.

        9: "Operation terminated by sqlite3_interrupt()*/",

should be:

        9: "Operation terminated by sqlite3_interrupt()",

Original issue reported on code.google.com by [email protected] on 17 Jan 2011 at 7:27

[PATCH] Use native sqllite3 methods for better performance

What steps will reproduce the problem?
sqlite_column and sqlite_bind both have numeric version
which when used can be more efficient.


What is the expected output? What do you see instead?
SQllite3 converts from numeric to string and then we 
convert back from string to numeric in gosqlite.

What version of the product are you using? On what operating system?
tip, linux

Please provide any additional information below.


Original issue reported on code.google.com by [email protected] on 7 Jun 2011 at 10:08

Attachments:

I can not go get http://code.google.com/p/gosqlite/sqlite

What steps will reproduce the problem?
1. when I run the command: go get http://code.google.com/p/gosqlite/sqlite
I got the result is :
unrecognized import path http:/code.google.com/p/gosqlite/sqlite
2. and also, if I download the source code to $GOROOT/src/pkg/code.google.com/p
and then run the command: go tool cgo -- -lsqlite3 sqlite.go
I got the error:
  unrecognized sqlite3 ...
  and also the related functions which are all unrecognized


What version of the product are you using? On what operating system?
sqlite3 is 3.7; and Go is the latest. OS is redhat centos 



Original issue reported on code.google.com by [email protected] on 20 Jun 2012 at 3:22

Fix for latest Go release

What steps will reproduce the problem?
1. Run make

What is the expected output? What do you see instead?
gosqlite compiles.
It fails due to a language change.

What version of the product are you using? On what operating system?
Latest on Mac OS X

Please provide any additional information below.
Diff attached.

Original issue reported on code.google.com by [email protected] on 30 Sep 2010 at 3:19

Attachments:

Compilation Issues since r56

What steps will reproduce the problem?
1. checkout go tip from mercurial or -u release (not r56)
2. import github.com/thomaslee/go-dbd-sqlite
3. checkout gosqlite HEAD from mercurial using goinstall
4. manually trigger the build using gomake to get around Issue #10
5. build fails, Go revision is too new

What is the expected output? What do you see instead?
[~/go/src/pkg/gosqlite.googlecode.com/hg/sqlite]$ make
8g  -o _go_.8  _obj/sqlite.cgo1.go _obj/_cgo_gotypes.go
sqlite.go:340[_obj/sqlite.cgo1.go:343]: undefined: reflect.Typeof
make: *** [_go_.8] Error 1

What version of the product are you using? On what operating system?
Latest go version, latest gosqlite from HG tip.

Please provide any additional information below.
It still works with r56, but all of the other software that I use has been 
updated to work with r57 (or a separate maintenance branch for r56 exists, in 
the case of github.com/skelterjohn/go-gb)

What happened in reflect package?  Help!
(Thanks)

Original issue reported on code.google.com by [email protected] on 5 May 2011 at 9:51

Does not compile with latest go

sqlite.go:168[_obj/sqlite.cgo1.go:171]: cannot use sleepNs (type int64) as type 
time.Duration in function argument
sqlite.go:228[_obj/sqlite.cgo1.go:231]: undefined: time.Nanoseconds
sqlite.go:351[_obj/sqlite.cgo1.go:354]: undefined: time.Nanoseconds

What steps will reproduce the problem?
1.
2.
3.

What is the expected output? What do you see instead?


What version of the product are you using? On what operating system?


Please provide any additional information below.


Original issue reported on code.google.com by [email protected] on 4 Dec 2011 at 5:06

Nil values not stored in database

What steps will reproduce the problem?
1. Create prepared statement
2. Try to bind nil to one of the "?" parameters

What is the expected output? What do you see instead?
Stores "" or "<nil>", instead of null column value.  


Please provide any additional information below.

Seems like a pretty easy fix:

diff -r a88eb4732139 sqlite/sqlite.go
--- a/sqlite/sqlite.go  Wed Nov 02 13:57:15 2011 -0400
+++ b/sqlite/sqlite.go  Mon Jan 09 15:57:50 2012 -0500
@@ -275,6 +275,10 @@

    for i, v := range args {
        var str string
+       var rv C.int
+       if v == nil {
+           rv = C.sqlite3_bind_null(s.stmt, C.int(i+1))
+       } else {
        switch v := v.(type) {
        case []byte:
            var p *byte
@@ -298,8 +302,9 @@
        }

        cstr := C.CString(str)
-       rv := C.my_bind_text(s.stmt, C.int(i+1), cstr, C.int(len(str)))
+           rv = C.my_bind_text(s.stmt, C.int(i+1), cstr, C.int(len(str)))
        C.free(unsafe.Pointer(cstr))
+       }
        if rv != 0 {
            return s.c.error(rv)
        }


Original issue reported on code.google.com by [email protected] on 9 Jan 2012 at 9:00

Last insert row ID not exposed in Go interface

Unless I'm missing something (quite possible) there appears to be no facility 
for retrieving the ID of a newly inserted row. This functionality is provided 
in Sqlite3, just not exposed in gosqlite.

What version of the product are you using? On what operating system?
* Revision a88eb4732139 (Arch Linux)

Please provide any additional information below.
* I've attached a diff with the fix I have applied locally.

Original issue reported on code.google.com by oniony on 7 Nov 2011 at 10:23

Attachments:

Get the field names of a table

To get the field names of a table is neccesary the next functions:

* * *
func (s *Stmt) Columns() int {
    return int(C.sqlite3_column_count(s.stmt))
}

func (s *Stmt) ColumnName(column int) (name string) {
    cname := C.sqlite3_column_name(s.stmt, C.int(column))
    name = C.GoString(cname)
    return
* * *

Original issue reported on code.google.com by [email protected] on 2 Dec 2010 at 12:35

Return output of SQL statement

This function should be added since it's very usefull to get the output of a 
SQL statement.

* * *
func (c *Conn) QueryOutput(statement string) (a []string, err os.Error) {
    query, err := c.Prepare(statement)
    if err != nil {
        return
    }
    defer query.Finalize()

    if err = query.Exec(); err != nil {
        return
    }

    var field string

    for {
        if ok := query.Next(); !ok {
            break
        }

        if err = query.Scan(&field); err != nil {
            return nil, err
        }
        a = append(a, field)
    }

    return
}
* * *

Original issue reported on code.google.com by [email protected] on 1 Dec 2010 at 12:06

Please provide the sqlite3 error code in a custom Error

Please consider raising a custom Error, with access to sqlite3_errcode and 
sqlite3_extended_errcode.

Otherwise you get people doing crazy string matching on the error messages, and 
all the bugs that invariably causes.

e.g.  
https://github.com/dotcloud/docker/commit/e8af7fcf6da03da65a379c12c90e6626c31846
ae

Original issue reported on code.google.com by [email protected] on 13 Mar 2014 at 1:13

COMMIT errors don't close the Transaction

What steps will reproduce the problem?
1. Open several connections to the same database, all running simultaneously 
doing a simple transaction (e.g. Begin/Update/Commit), for instance run several 
goroutines with GOMAXPROCS > 1
2. Some of these transaction will fail at the COMMIT step saying "database is 
locked"
3. BEGIN a new TRANSACTION on a client which had the above error on COMMIT

What is the expected output? What do you see instead?
A new transaction should start, but instead this error is returned: "cannot 
start a transaction within a transaction".
The database connection cannot get out of the current transaction and start a 
new one.
The user of this library cannot work around this. SQLite3 wants the user to do 
a ROLLBACK in order to start a new TRANSACTION, but database.sql.Tx considers 
the entire transaction done once Commit() returned. Calling Rollback() after 
Commit returned has no effect.


What version of the product are you using? On what operating system?
The latest source code (Jul 2014) on linux amd64.


Please provide any additional information below.

I've attached a short patch which solves this issue. If there was an error on 
COMMIT, it performs a ROLLBACK before returning.

Original issue reported on code.google.com by [email protected] on 29 Jul 2014 at 7:12

Attachments:

does not compile with release.2010-09-29

diff -r e693baee322d sqlite/sqlite.go
--- a/sqlite/sqlite.go  Wed Aug 25 18:43:58 2010 -0400
+++ b/sqlite/sqlite.go  Mon Oct 04 11:30:06 2010 +0200
@@ -133,7 +133,7 @@
        return err
    }
    defer s.Finalize()
-   err = s.Exec(args)
+   err = s.Exec(args...)
    if err != nil {
        return err
    }

Original issue reported on code.google.com by [email protected] on 4 Oct 2010 at 9:31

Execution of prepared statements don't update SQLite database

I'm very new to go, so apologies if this is a false positive.

What steps will reproduce the problem?
1. stmt := prepareStmt(...
2. stmt.Exec(bindings...
3.

What is the expected output? What do you see instead?
Starting on line 166: func (s *Stmt) Exec(args ...interface{}) os.Error
The function uses a for loop to bind all the parameters, but then immediately 
returns nil and doesn't execute the statement - well that's what I think is 
happening.

Avoiding prepared statements, and just using func (c *Conn) Exec(cmd string, 
args ...interface{}) os.Error works fine.

What version of the product are you using? On what operating system?
Currently Mac OS X.

Please provide any additional information below.
I think the (s *Stmt) Exec may need s.Finalize() before the return.

Thoughts?

Original issue reported on code.google.com by [email protected] on 22 Sep 2010 at 1:21

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.