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
28bfee41
Commit
28bfee41
authored
Nov 23, 2013
by
gwenn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Clean up.
parent
23b5fbc2
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
11 additions
and
10 deletions
+11
-10
blob.go
blob.go
+8
-7
busy_test.go
busy_test.go
+1
-1
driver.go
driver.go
+1
-1
meta.go
meta.go
+1
-1
No files found.
blob.go
View file @
28bfee41
...
...
@@ -103,11 +103,11 @@ func (r *BlobReader) Read(v []byte) (int, error) {
if
r
.
offset
>=
size
{
return
0
,
io
.
EOF
}
if
len
(
v
)
>
(
size
-
r
.
offset
)
{
v
=
v
[
0
:
size
-
r
.
offset
]
n
:=
size
-
r
.
offset
if
len
(
v
)
<
n
{
n
=
len
(
v
)
}
p
:=
&
v
[
0
]
n
:=
len
(
v
)
rv
:=
C
.
sqlite3_blob_read
(
r
.
bl
,
unsafe
.
Pointer
(
p
),
C
.
int
(
n
),
C
.
int
(
r
.
offset
))
if
rv
!=
C
.
SQLITE_OK
{
return
0
,
r
.
c
.
error
(
rv
,
"BlobReader.Read"
)
...
...
@@ -131,7 +131,7 @@ func (r *BlobReader) Seek(offset int64, whence int) (int64, error) {
}
r
.
offset
=
size
+
int
(
offset
)
default
:
return
0
,
r
.
c
.
specificError
(
"Bad seekMode
"
)
return
0
,
r
.
c
.
specificError
(
"Bad seekMode
: %d"
,
whence
)
}
return
int64
(
r
.
offset
),
nil
}
...
...
@@ -162,12 +162,13 @@ func (w *BlobReadWriter) Write(v []byte) (int, error) {
return
0
,
io
.
EOF
}
/* Write must return a non-nil error if it returns n < len(v) */
if
len
(
v
)
>
(
size
-
w
.
offset
)
{
v
=
v
[
0
:
size
-
w
.
offset
]
n
:=
size
-
w
.
offset
if
len
(
v
)
<=
n
{
n
=
len
(
v
)
}
else
{
err
=
io
.
EOF
}
p
:=
&
v
[
0
]
n
:=
len
(
v
)
rv
:=
C
.
sqlite3_blob_write
(
w
.
bl
,
unsafe
.
Pointer
(
p
),
C
.
int
(
n
),
C
.
int
(
w
.
offset
))
if
rv
!=
C
.
SQLITE_OK
{
return
0
,
w
.
c
.
error
(
rv
,
"BlobReadWiter.Write"
)
...
...
busy_test.go
View file @
28bfee41
...
...
@@ -70,7 +70,7 @@ func TestBusyTimeout(t *testing.T) {
checkNoError
(
t
,
db1
.
BeginTransaction
(
Exclusive
),
"couldn't begin transaction: %s"
)
//join := make(chan bool)
checkNoError
(
t
,
db2
.
BusyTimeout
(
time
.
Duration
(
500
)
*
time
.
Millisecond
),
"couldn't set busy timeout: %s"
)
checkNoError
(
t
,
db2
.
BusyTimeout
(
500
*
time
.
Millisecond
),
"couldn't set busy timeout: %s"
)
go
func
()
{
time
.
Sleep
(
time
.
Millisecond
)
db1
.
Rollback
()
...
...
driver.go
View file @
28bfee41
...
...
@@ -51,7 +51,7 @@ func (d *impl) Open(name string) (driver.Conn, error) {
if
err
!=
nil
{
return
nil
,
err
}
c
.
BusyTimeout
(
time
.
Duration
(
10
)
*
time
.
Second
)
c
.
BusyTimeout
(
10
*
time
.
Second
)
return
&
conn
{
c
},
nil
}
...
...
meta.go
View file @
28bfee41
...
...
@@ -263,7 +263,7 @@ func (c *Conn) Indexes(dbName, table string) ([]Index, error) {
}
// IndexColumns returns one description for each column in the named index.
// Only Column.Cid and Column.Name are specified. All other fields are unspecifed.
// Only Column.Cid and Column.Name are specified. All other fields are unspecif
i
ed.
// (See http://www.sqlite.org/pragma.html#pragma_index_info)
func
(
c
*
Conn
)
IndexColumns
(
dbName
,
index
string
)
([]
Column
,
error
)
{
var
pragma
string
...
...
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