1. 09 Oct, 2018 1 commit
  2. 17 Aug, 2018 1 commit
  3. 10 Aug, 2018 1 commit
  4. 27 May, 2018 8 commits
  5. 26 Apr, 2018 2 commits
  6. 19 Mar, 2018 2 commits
  7. 16 Mar, 2018 2 commits
    • Kirill Smelkov's avatar
      fixup! open: Fix error message · d90dd8b9
      Kirill Smelkov authored
      This commit fixes 0d47edb6. Recently I hit the following: I was trying
      to open the database via
      
      	sqlite3.Open(dburl, sqlite3.OpenNoMutex)
      
      i.e. by passing flags, but erroneously no OpenReadWrite or something
      similar, and got
      
      	"testdata/1.sqlite: bad parameter or other API misuse"
      
      as the error.
      
      The message was confusing because there is no "open" action in it, so
      add the action to OpenError and the mesage becomes:
      
      	"testdata/1.sqlite: open: bad parameter or other API misuse"
      
      See full discussion for structure of error messages here:
      
      https://github.com/gwenn/gosqlite/pull/14
      d90dd8b9
    • Kirill Smelkov's avatar
      Switch to pkg-config to detect libsqlite3 CFLAGS/LDFLAGS · 355427a8
      Kirill Smelkov authored
      Recently I was playing with custom builds of libsqlite3 and neither
      -lsqlite3 without other options find the library, not the compilation at
      all works because libsqlite3 headers cannot be found.
      
      There is established way to make this all working: by using pkg-config
      builder can query it for a "package" cflags or libs e.g. this way:
      
      	$ pkg-config --cflags sqlite3
      	-I/home/kirr/local/sqlite/include
      
      	$ pkg-config --libs sqlite3
      	-L/home/kirr/local/sqlite/lib -lsqlite3
      
      and use so-provided flags for the build.
      
      And if the build is not custom pkg-config will just report cflags/libs
      for a system package:
      
      	$ pkg-config --cflags sqlite3
      
      	$ pkg-config --libs sqlite3
      	-lsqlite3
      
      Since CGo provides support for pkg-config out of the box [1] we can use
      it to get proper libsqlite3 CFLAGS/LDFLAGS.
      
      I guess FreeBSD flags (added in e90ca0e4) becomes also not needed,
      because by default pkg-config searches for package descriptions in
      /usr/local/{lib,share}/pkgconfig too, so I'm switching that to
      pkg-config too.
      
      We leave explicit `-lsqlite3` to be there for non-(linux or freebsd) to
      support Windows and Mac where pkg-config is probably not available by
      default.
      
      [1] https://golang.org/cmd/cgo/#Shdr-Using_cgo_with_the_go_command
      355427a8
  8. 20 Feb, 2018 2 commits
    • gwenn's avatar
      Merge pull request #14 from navytux/y/open-error · 900751f4
      gwenn authored
      open: Fix error message
      900751f4
    • Kirill Smelkov's avatar
      open: Fix error message · 0d47edb6
      Kirill Smelkov authored
      By accident I was trying to open a non-existing database file and got
      the following message:
      
      	unable to open database file (unable to open database file)
      
      which was not helpful.
      
      By convention the error returned by a function should contain the
      context passed to that function - the filename in Open case, the
      operation performed and the error description. So
      
      - teach OpenError to print filename of the opened database and the
        operation.
      - don't duplicate the code in braces if we have the error message
        with the same text because they are often redundant.
      - if we have only error code but not a message, still we have to include
        the filename and operation in the printed context.
      - in the Open itself: always return OpenError on handling errors from
        sqlite3_open_v2 even if db == nil - instead of returning only Errno
        without any context.
      
      Now the error in my case is:
      
      	notfound.db: unable to open database file
      
      ( @gwenn requested to omit the ": open" (operation) probable because it
        duplicates error detail a bit )
      
      /helped-by @gwenn
      0d47edb6
  9. 18 Feb, 2018 2 commits
  10. 09 Feb, 2018 2 commits
  11. 31 Dec, 2017 2 commits
  12. 18 Sep, 2017 1 commit
  13. 02 Sep, 2017 2 commits
  14. 08 Jul, 2017 1 commit
  15. 15 Jun, 2017 2 commits
  16. 12 Jun, 2017 2 commits
  17. 15 Mar, 2017 2 commits
  18. 05 Mar, 2017 5 commits