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
6f753a8e
Commit
6f753a8e
authored
Feb 14, 2014
by
gwenn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Minor optim.
parent
edac256f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
12 deletions
+12
-12
function.go
function.go
+6
-6
vtab.go
vtab.go
+6
-6
No files found.
function.go
View file @
6f753a8e
...
...
@@ -376,8 +376,8 @@ type sqliteFunction struct {
final
FinalFunction
d
DestroyDataFunction
pApp
interface
{}
scalarCtxs
map
[
*
ScalarContext
]
bool
aggrCtxs
map
[
*
AggregateContext
]
bool
scalarCtxs
map
[
*
ScalarContext
]
struct
{}
aggrCtxs
map
[
*
AggregateContext
]
struct
{}
}
//export goXAuxDataDestroy
...
...
@@ -400,7 +400,7 @@ func goXFunc(scp, udfp, ctxp unsafe.Pointer, argc int, argv unsafe.Pointer) {
c
.
udf
=
udf
C
.
goSqlite3SetAuxdata
((
*
C
.
sqlite3_context
)(
c
.
sc
),
0
,
unsafe
.
Pointer
(
c
))
// To make sure it is not cged
udf
.
scalarCtxs
[
c
]
=
true
udf
.
scalarCtxs
[
c
]
=
struct
{}{}
}
c
.
argv
=
(
**
C
.
sqlite3_value
)(
argv
)
udf
.
scalar
(
c
,
argc
)
...
...
@@ -420,7 +420,7 @@ func goXStep(scp, udfp unsafe.Pointer, argc int, argv unsafe.Pointer) {
c
.
sc
=
(
*
Context
)(
scp
)
*
(
*
unsafe
.
Pointer
)(
cp
)
=
unsafe
.
Pointer
(
c
)
// To make sure it is not cged
udf
.
aggrCtxs
[
c
]
=
true
udf
.
aggrCtxs
[
c
]
=
struct
{}{}
}
else
{
c
=
(
*
AggregateContext
)(
p
)
}
...
...
@@ -476,7 +476,7 @@ func (c *Conn) CreateScalarFunction(functionName string, nArg int, deterministic
fmt
.
Sprintf
(
"<Conn.CreateScalarFunction(%q)"
,
functionName
))
}
// To make sure it is not gced, keep a reference in the connection.
udf
:=
&
sqliteFunction
{
f
,
nil
,
nil
,
d
,
pApp
,
make
(
map
[
*
ScalarContext
]
bool
),
nil
}
udf
:=
&
sqliteFunction
{
f
,
nil
,
nil
,
d
,
pApp
,
make
(
map
[
*
ScalarContext
]
struct
{}
),
nil
}
if
len
(
c
.
udfs
)
==
0
{
c
.
udfs
=
make
(
map
[
string
]
*
sqliteFunction
)
}
...
...
@@ -500,7 +500,7 @@ func (c *Conn) CreateAggregateFunction(functionName string, nArg int, pApp inter
fmt
.
Sprintf
(
"<Conn.CreateAggregateFunction(%q)"
,
functionName
))
}
// To make sure it is not gced, keep a reference in the connection.
udf
:=
&
sqliteFunction
{
nil
,
step
,
final
,
d
,
pApp
,
nil
,
make
(
map
[
*
AggregateContext
]
bool
)}
udf
:=
&
sqliteFunction
{
nil
,
step
,
final
,
d
,
pApp
,
nil
,
make
(
map
[
*
AggregateContext
]
struct
{}
)}
if
len
(
c
.
udfs
)
==
0
{
c
.
udfs
=
make
(
map
[
string
]
*
sqliteFunction
)
}
...
...
vtab.go
View file @
6f753a8e
...
...
@@ -22,13 +22,13 @@ type sqliteModule struct {
c
*
Conn
name
string
module
Module
vts
map
[
*
sqliteVTab
]
bool
vts
map
[
*
sqliteVTab
]
struct
{}
}
type
sqliteVTab
struct
{
module
*
sqliteModule
vTab
VTab
vtcs
map
[
*
sqliteVTabCursor
]
bool
vtcs
map
[
*
sqliteVTabCursor
]
struct
{}
}
type
sqliteVTabCursor
struct
{
...
...
@@ -65,9 +65,9 @@ func goMInit(db, pClientData unsafe.Pointer, argc int, argv **C.char, pzErr **C.
vt
:=
&
sqliteVTab
{
m
,
vTab
,
nil
}
// prevents 'vt' from being gced
if
m
.
vts
==
nil
{
m
.
vts
=
make
(
map
[
*
sqliteVTab
]
bool
)
m
.
vts
=
make
(
map
[
*
sqliteVTab
]
struct
{}
)
}
m
.
vts
[
vt
]
=
true
m
.
vts
[
vt
]
=
struct
{}{}
*
pzErr
=
nil
return
unsafe
.
Pointer
(
vt
)
}
...
...
@@ -101,9 +101,9 @@ func goVOpen(pVTab unsafe.Pointer, pzErr **C.char) unsafe.Pointer {
// prevents 'vt' from being gced
vtc
:=
&
sqliteVTabCursor
{
vt
,
vTabCursor
}
if
vt
.
vtcs
==
nil
{
vt
.
vtcs
=
make
(
map
[
*
sqliteVTabCursor
]
bool
)
vt
.
vtcs
=
make
(
map
[
*
sqliteVTabCursor
]
struct
{}
)
}
vt
.
vtcs
[
vtc
]
=
true
vt
.
vtcs
[
vtc
]
=
struct
{}{}
*
pzErr
=
nil
return
unsafe
.
Pointer
(
vtc
)
}
...
...
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