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
cdc1ffac
Commit
cdc1ffac
authored
Apr 01, 2013
by
gwenn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Avoids copying some data.
parent
77e10c5a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
6 deletions
+11
-6
driver.go
driver.go
+11
-6
No files found.
driver.go
View file @
cdc1ffac
...
...
@@ -11,7 +11,9 @@ import (
"io"
"log"
"os"
"reflect"
"time"
"unsafe"
)
func
init
()
{
...
...
@@ -57,12 +59,15 @@ func (d *Driver) Open(name string) (driver.Conn, error) {
// PRAGMA schema_version may be used to detect when the database schema is altered
func
(
c
*
connImpl
)
Exec
(
query
string
,
args
[]
driver
.
Value
)
(
driver
.
Result
,
error
)
{
// http://code.google.com/p/go-wiki/wiki/InterfaceSlice
tmp
:=
make
([]
interface
{},
len
(
args
))
for
i
,
arg
:=
range
args
{
tmp
[
i
]
=
arg
}
if
err
:=
c
.
c
.
Exec
(
query
,
tmp
...
);
err
!=
nil
{
// https://code.google.com/p/go-wiki/wiki/cgo#Turning_C_arrays_into_Go_slices
var
iargs
[]
interface
{}
if
len
(
args
)
>
0
{
h
:=
(
*
reflect
.
SliceHeader
)(
unsafe
.
Pointer
(
&
iargs
))
h
.
Data
=
uintptr
(
unsafe
.
Pointer
(
&
args
[
0
]))
h
.
Len
=
len
(
args
)
h
.
Cap
=
cap
(
args
)
}
if
err
:=
c
.
c
.
Exec
(
query
,
iargs
...
);
err
!=
nil
{
return
nil
,
err
}
return
c
,
nil
// FIXME RowAffected/noRows
...
...
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