mattn
d10e2c8f62
Reset statement. Fixes #150
2014-11-16 23:51:46 +09:00
mattn
e63d2546a0
set/reset finalizer to free SQLite3 handles
2014-11-14 17:13:35 +09:00
mattn
12a1c0f435
rows.Close()
2014-11-14 02:21:49 +09:00
mattn
e5819757da
Should affect on only 386
2014-10-24 19:38:05 +09:00
mattn
c1aa7ac706
Merge pull request #155 from kartaca/master
...
fixed timezone problem for datetime types
2014-10-24 18:22:46 +09:00
Mehmet Gurevin
6710e996b5
fixed timezone problem for datetime types
2014-10-23 20:12:32 +03:00
mattn
00716954b7
Specify by -D
2014-10-22 13:31:54 +09:00
mattn
1fbcb3cdc2
Thread safe
2014-10-20 15:19:03 +09:00
romo
86932b40b0
add Version func for retrieving SQLite library version info
2014-10-13 11:05:49 +09:00
mattn
a80c27ba33
Merge commit '3d78a08b9f3307ac3874f5c120f7d4166c62efb9'
2014-09-10 15:02:09 +09:00
mattn
3d78a08b9f
Workaround for #109 , #147
2014-09-10 14:58:32 +09:00
mattn
3ab1d6f348
Merge branch 'master' of https://github.com/mattn/go-sqlite3
2014-09-03 09:21:35 +09:00
mattn
0a0c543dc0
Merge branch 'pr/135'
2014-09-03 09:21:15 +09:00
Peter Waller
764e046d89
Add "date" to decltypes parsed as a unix time
2014-09-02 16:36:34 +01:00
mattn
72cb8db627
Fixed checking parameter count
2014-08-18 18:48:48 +09:00
mattn
b718c29aea
Merge branch 'master' of github.com:mattn/go-sqlite3
2014-08-18 18:24:12 +09:00
mattn
d069822191
Check parameter count
2014-08-18 18:23:58 +09:00
mattn
6535341da9
Add one blank line for godoc
2014-08-18 17:00:59 +09:00
mattn
5e5d088a36
Add license header
2014-08-18 16:56:31 +09:00
Peter Waller
ff0960b999
Add 'date' to rc.decltypes interpreted as a time
2014-08-11 11:03:27 +01:00
Sven Engelhardt
deaffef7cb
implicitly close Stmt in Queryer, Close #131
...
the cls field tracks if the Stmt should be implicitly closed, in the
Exec() call the generated statement is always closed
2014-07-15 18:13:47 +02:00
Sean Duffy
d444acb5da
Add missing time format, fixes #43
2014-07-08 10:56:44 +01:00
mattn
d9e7576acf
Fix error on Execer. Close #124
2014-06-26 03:54:30 +09:00
mattn
d56eb93ecb
Implements Execer/Queryer. Close #60 , #82 , #113
2014-06-25 11:41:58 +09:00
mattn
a59fbb40eb
Merge pull request #116 from c14n/master
...
Enable extended error codes.
2014-06-25 11:34:13 +09:00
mattn
f7d2df0102
Remove dead code in SQLiteRows.Bind. Close #119
2014-06-25 11:30:31 +09:00
Christoph Martin
f395aa170e
Enable extended error codes.
2014-04-01 14:01:19 +02:00
tpltnt
487e651e19
tiny typo fix
2014-02-18 01:06:30 +01:00
mpl
4a7ad328b7
Next(): populate Row with []byte instead of string, as per driver doc
...
Fix on behalf of bradfitz, see
http://golang.org/pkg/database/sql/driver/#Rows
2013-12-05 16:58:38 +01:00
Robert Knight
19cb26da92
Provide more detailed error messages
...
Use the sqlite3_errmsg() API to retrieve more specific error
messages.
eg. Attempting to exec 'CREATE TABLE ExistingTableName (...)'
will now report 'table already exists: ExistingTableName' rather
than 'SQL logic error or missing database'
2013-11-19 09:13:19 +00:00
mattn
056b49918a
Merge pull request #88 from hattya/close_v2
...
Use sqlite3_close_v2()
2013-10-24 17:02:49 -07:00
Akinori Hattori
ef9b514cad
sqlite3_column_blob() returns NULL for zero-length BLOB
2013-10-24 22:25:07 +09:00
Akinori Hattori
4970c4bff6
Use sqlite3_close_v2()
2013-10-24 22:21:37 +09:00
mattn
2a2faeaf38
Include errno.h when build on cygwin. Closes #87
2013-10-02 12:51:44 +09:00
mattn
1ca536cf83
Disable Execer/Queryer until database/sql/driver implement QueryRow: #82
2013-09-12 10:46:35 +09:00
mattn
7dadd98d75
Execer/Queryer should use transaction
2013-09-12 09:11:01 +09:00
mattn
f595dd9955
Fixes Queryer
2013-09-09 13:44:24 +09:00
mattn
77ebf39cf9
Fixes Execer/Queryer
2013-09-09 12:28:34 +09:00
mattn
9150577da1
Close rows if not nil
2013-09-09 11:26:55 +09:00
mattn
21c1469999
Must not close statement
2013-09-09 11:14:26 +09:00
mattn
3f20cb1697
Implements Queryer
2013-09-09 10:56:45 +09:00
mattn
132e6e9898
Remove debug message
2013-09-09 10:51:54 +09:00
mattn
d4673cd31c
Implements Execer
2013-09-09 10:44:44 +09:00
Jochen Voss
2d6a60e2f5
Start work on introducing machine-readable error codes.
...
This commit introduces a new type 'ErrNo', implementing the error
interface. Constants for all sqlite3 error codes are provided
in the new source file "error.go".
2013-08-30 22:35:32 +09:00
Carlos Castillo
0dd71564e2
Changed extension support to load from a string list of extensions
...
By loading extensions this way, it's not possible to later load
extensions using db.Exec, which improves security, and makes it much
easier to load extensions correctly. The zero value for the slice
(the empty slice) loads no extensions by default.
The extension example has been updated to use this much simpler system.
The ConnectHook field is still in SQLiteDriver in case it's needed for
other driver-wide initialization.
Updates #71 of mattn/go-sqlite3.
2013-08-24 20:36:35 -07:00
Carlos Castillo
976f43861f
Added error return to ConnectHook and fixed extension example
...
The ConnectHook field of an SQLiteDriver should return an error in
case something bad happened during the hook.
The extension example needs to load the extension in a ConnectHook,
otherwise the extension is only loaded in a single connection in the pool.
By putting the extension loading in the ConnectHook, its called for every
connection that is opened by the sql.DB.
2013-08-24 20:04:51 -07:00
mattn
ac279b69bf
Fixes typo
2013-08-23 14:26:33 +09:00
mattn
3abc26b4ef
Add AutoCommit
2013-08-23 14:11:15 +09:00
mattn
e6850435ff
Possible to register custom driver
2013-08-23 13:58:54 +09:00
mattn
f6dadd82d8
Add new driver name 'sqlite3_with_extensions'
2013-08-23 09:57:22 +09:00
mattn
34a33cffaa
Rervert ff8e6729ce
2013-08-14 12:07:38 +09:00
mattn
c7bece2a70
Fixes package name
2013-08-13 22:10:30 +09:00
Jochen Voss
ff8e6729ce
Start work on introducing machine-readable error codes.
...
This commit introduces a new type 'ErrNo', implementing the error
interface. Constants for all sqlite3 error codes are provided
in the new source file "error.go".
2013-08-13 21:45:05 +09:00
David Hill
ecc4ab4956
call sqlite3_column_blob() before sqlite3_column_bytes()
...
sqlite3 documentation states sqlite3_column_blob could modify the
the content and recommends the "safest and easiest" policy is to
invoke sqlite3_column_blob() followed by sqlite3_column_bytes()
from: http://www.sqlite.org/c3ref/column_blob.html
2013-08-02 00:41:09 -04:00
mattn
f1d58ee64a
go fmt
2013-05-11 21:45:48 +09:00
Russ Cox
d93259577c
the SQLiteResult refers to the connection after it should no longer be referring to the connection. The fix is to fetch the answers before Exec returns, just in case someone wants them.
2013-05-11 21:45:25 +09:00
mattn
0f6f374d27
Treat int as 64bit
2013-04-09 15:18:47 +09:00
mattn
d9f6dadfbf
Add int32 type, close #55
2013-04-08 17:39:03 +09:00
mattn
bbd33c0ffc
Fix #54
2013-04-06 23:06:48 +09:00
mattn
bfae0c6cef
Fixed #37
2013-02-13 10:32:40 +09:00
mattn
9b745ee433
Some older version of sqlite3 does not have SQLITE_OPEN_URI.
2013-02-03 23:25:30 +09:00
mattn
6e13c4512d
Add comments.
2013-01-31 16:48:30 +09:00
mattn
ae4b60773a
add flag SQLITE_OPEN_URI to open. closes #38
2013-01-29 09:17:54 +09:00
Micah Stetson
44496728c2
Support more of the timestamp formats undestood by SQLite
2012-12-29 16:51:15 -08:00
Micah Stetson
ce139f706b
Support time values with nanosecond precision
2012-12-29 16:36:29 -08:00
Micah Stetson
f6d10a2a58
Convert times to UTC before storage
2012-12-29 14:47:17 -08:00
Micah Stetson
58c4612c1e
Fix #33 and #34
2012-12-29 14:20:27 -08:00
mattn
f86c8f208d
check destination type whether it's *time.Time or not.
2012-12-26 10:01:39 +09:00
mattn
acf6044aaf
No return error when invalid datetime.
2012-12-26 09:52:55 +09:00
mattn
b758711b08
fixed last_id/changes. it seems long alignment values.
2012-12-07 12:58:08 +09:00
Dobrosław Żybort
430103cc9e
Add support for extracting `2006-01-02 15:04:05.000` formatted datetime.
2012-11-29 13:26:24 +01:00
lye
dcd44f5118
Add support for extracting 2006-01-02 formatted timestamps.
...
SQLite3 stores timestamps very naively -- they're completely untyped,
and can contain any value. The previous implementation always inserts
values in the 'datetime' format, and returns an error when attempting to
extract a field with a different format.
Some legacy databases, unfortunately, were generated using the 'date'
SQLite3 function, which produces rows in the '2006-01-02' format. This
patch adds a special case so that these rows can be extracted without
error.
2012-11-03 19:45:58 -05:00
Carlos Castillo
58cfe6309d
Modified for windows support.
2012-10-27 19:58:40 -07:00
John Gallagher
a76fd8f336
Fix read of invalid (already freed) memory.
2012-10-15 20:57:32 -04:00
mattn
d05555a677
workaround on windows. currently, int64 does not work correctly.
2012-09-12 11:43:37 +09:00
cds
3456489fa1
gofmt + fix erroneous t.Errorf("foo:", err) statements to t.Error("foo:", err) .
...
Original:
--- FAIL: TestInsert (0.00 seconds)
sqlite3_test.go:42: Failed to create table:%!(EXTRA *errors.errorString=unable to open database file)
With corrections:
--- FAIL: TestInsert (0.00 seconds)
sqlite3_test.go:42: Failed to create table: unable to open database file
2012-09-11 08:35:53 -05:00
Thomas Leske
a4e5e7a617
bug fix: Byte slices belong to the caller and so must be copies.
...
With the exeption of slices in the result type sql.RawBytes,
new calls to Sqlite must not corrupt slices.
2012-08-20 17:20:58 +02:00
jander
6865865265
Handle bool values with "BOOLEAN" columns.
2012-05-25 17:01:03 +08:00
John Gallagher
db2c00ccd8
Increase busy timeout to 5 seconds.
...
500ms is short enough that go-sql-test sometimes fails with "database
locked", and it's the value used by Python's sqlite3 driver.
2012-04-07 00:37:02 -04:00
John Gallagher
3abc337b8e
Handle time.Time values with "timestamp" columns.
2012-04-07 00:29:24 -04:00
mattn
224815d665
merged #11
...
close #11
2012-03-12 14:20:55 +09:00
Sven Engelhardt
81a88cec73
database/sql expects io.EOF after all rows have been Next'ed
...
Return io.EOF, so rows.Next() will automatically call rows.Close()
after all results have been returned.
2012-03-02 09:06:56 +09:00
mattn
8cbe65c9c3
merged bradfitz's patch. thanks.
2012-02-20 16:14:49 +09:00
lye
3524ead0a5
For boolean values, marshal true to SQLite 1, not -1
...
SQLite stores boolean values as an integer, serializing true as 1 and
false as 0 [1], but it does not actually enforce this range. To match
the documentation (and fix the broken test case), this patch makes a Go
boolean true serialize properly to 1.
[1] http://www.sqlite.org/datatype3.html
2012-02-06 22:59:24 +00:00
Scott Lawrence
f082596746
Fixing build at tip
2012-01-20 11:44:24 -05:00
Alien Science
5d9fdcab93
Fixed double free when closing SQLiteStmt
...
Rows should not close the statement because Stmt has its own close
function. This caused a double free error/crash on Fedora 16 x86_64.
2012-01-19 20:26:09 +01:00
lye
6a23a746e1
Use pkg-config instead of a hardcoded LDFLAGS
2012-01-10 00:16:34 +00:00
Sven Engelhardt
01566134d1
allow to insert zero-length strings into database
...
&b[0] fails with an index out-of-bounds error for a slice with len()==0
2011-12-02 23:32:38 +01:00
mattn
fdbb364aba
fix LastInsertId()/RowsAffected().
2011-11-15 11:03:31 +09:00
mattn
7211b7212b
last inserted row ID, affected rows.
2011-11-14 22:10:13 +09:00
mattn
650166a9cf
clean
2011-11-14 10:09:46 +09:00
mattn
0b35f58e9d
gofmt.
2011-11-11 21:38:53 +09:00
mattn
6c2d2c4b6b
first import.
2011-11-11 21:36:22 +09:00