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
e802ee80
Commit
e802ee80
authored
Jun 15, 2014
by
gwenn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix ScanValue when DefaultTimeLayout is empty.
parent
93c633c3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
2 deletions
+6
-2
stmt.go
stmt.go
+6
-2
No files found.
stmt.go
View file @
e802ee80
...
...
@@ -842,7 +842,7 @@ func (s *Stmt) ScanValue(index int, blob bool) (value interface{}, isNull bool)
case
Null
:
return
nil
,
true
case
Text
:
// does not work as expected if column type affinity is TEXT but inserted value was a numeric
if
s
.
c
.
ScanNumericalAsTime
&&
s
.
ColumnTypeAffinity
(
index
)
==
Numerical
{
if
s
.
c
.
ScanNumericalAsTime
&&
s
.
c
.
DefaultTimeLayout
!=
""
&&
s
.
ColumnTypeAffinity
(
index
)
==
Numerical
{
p
:=
C
.
sqlite3_column_text
(
s
.
stmt
,
C
.
int
(
index
))
txt
:=
C
.
GoString
((
*
C
.
char
)(
unsafe
.
Pointer
(
p
)))
value
,
err
:=
time
.
Parse
(
s
.
c
.
DefaultTimeLayout
,
txt
)
...
...
@@ -859,7 +859,11 @@ func (s *Stmt) ScanValue(index int, blob bool) (value interface{}, isNull bool)
p
:=
C
.
sqlite3_column_text
(
s
.
stmt
,
C
.
int
(
index
))
return
C
.
GoString
((
*
C
.
char
)(
unsafe
.
Pointer
(
p
))),
false
case
Integer
:
return
int64
(
C
.
sqlite3_column_int64
(
s
.
stmt
,
C
.
int
(
index
))),
false
value
:=
int64
(
C
.
sqlite3_column_int64
(
s
.
stmt
,
C
.
int
(
index
)))
if
s
.
c
.
ScanNumericalAsTime
&&
s
.
c
.
DefaultTimeLayout
==
""
&&
s
.
ColumnTypeAffinity
(
index
)
==
Numerical
{
return
time
.
Unix
(
value
,
0
),
false
}
return
value
,
false
case
Float
:
// does not work as expected if column type affinity is REAL but inserted value was an integer
return
float64
(
C
.
sqlite3_column_double
(
s
.
stmt
,
C
.
int
(
index
))),
false
case
Blob
:
...
...
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