Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gosqlite
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gosqlite
Commits
28ac60e4
Commit
28ac60e4
authored
Nov 02, 2013
by
gwenn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add some tests.
parent
50a64510
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
1 deletion
+33
-1
README.md
README.md
+1
-1
blob_test.go
blob_test.go
+17
-0
stmt_test.go
stmt_test.go
+15
-0
No files found.
README.md
View file @
28ac60e4
...
...
@@ -15,7 +15,7 @@ See [package documentation](http://godoc.org/github.com/gwenn/gosqlite).
If your OS does not bundle SQLite3 development files (or old ones):
-
download and copy SQLite3 files
```
sh
ell
```
sh
$
cp
~/Downloads/sqlite-amalgamation-xxx/sqlite3.
{
c,h
}
$GOPATH
/src/github.com/gwenn/gosqlite
```
...
...
blob_test.go
View file @
28ac60e4
...
...
@@ -72,3 +72,20 @@ func TestBlobMisuse(t *testing.T) {
/*err = bw.Close()
assert(t, "error expected", err != nil)*/
}
func
TestZeroLengthBlob
(
t
*
testing
.
T
)
{
db
:=
open
(
t
)
defer
checkClose
(
db
,
t
)
err
:=
db
.
Exec
(
"CREATE TABLE test (content BLOB);"
)
checkNoError
(
t
,
err
,
"error creating table: %s"
)
err
=
db
.
Exec
(
"INSERT INTO test VALUES (?)"
,
ZeroBlobLength
(
0
))
checkNoError
(
t
,
err
,
"insert error: %s"
)
rowid
:=
db
.
LastInsertRowid
()
var
blob
[]
byte
err
=
db
.
OneValue
(
"SELECT content FROM test WHERE rowid = ?"
,
&
blob
,
rowid
)
checkNoError
(
t
,
err
,
"select error: %s"
)
assert
(
t
,
"nil blob expected"
,
blob
==
nil
)
}
stmt_test.go
View file @
28ac60e4
...
...
@@ -453,3 +453,18 @@ func TestBindEmptyZeroNotTransformedToNull(t *testing.T) {
_
,
null
=
s
.
ScanValue
(
1
,
false
)
assert
(
t
,
"Zero time expected"
,
!
null
)
}
func
TestColumnType
(
t
*
testing
.
T
)
{
db
:=
open
(
t
)
defer
checkClose
(
db
,
t
)
createTable
(
db
,
t
)
s
,
err
:=
db
.
Prepare
(
"SELECT * from test"
)
checkNoError
(
t
,
err
,
"prepare error: %s"
)
defer
checkFinalize
(
s
,
t
)
for
col
:=
0
;
col
<
s
.
ColumnCount
();
col
++
{
//println(col, s.ColumnName(col), s.ColumnOriginName(col), s.ColumnType(col), s.ColumnDeclaredType(col))
assertEquals
(
t
,
"expected %s but got %s type"
,
Null
,
s
.
ColumnType
(
col
))
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment