good morning!!!!
Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
U
upper
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Harbor Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
open
upper
Commits
b4111cb2
Commit
b4111cb2
authored
10 years ago
by
Carlos Nieto
Browse files
Options
Downloads
Plain Diff
Merge pull request #20 from maxhawkins/panic
Fix nil panic in postgresql/result.go
parents
6cb22f84
602e78b2
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
postgresql/database_test.go
+22
-0
22 additions, 0 deletions
postgresql/database_test.go
postgresql/result.go
+4
-9
4 additions, 9 deletions
postgresql/result.go
with
26 additions
and
9 deletions
postgresql/database_test.go
+
22
−
0
View file @
b4111cb2
...
...
@@ -159,6 +159,28 @@ func TestTruncate(t *testing.T) {
}
}
func
TestSetCursorError
(
t
*
testing
.
T
)
{
sess
,
err
:=
db
.
Open
(
wrapperName
,
settings
)
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
defer
sess
.
Close
()
artist
,
err
:=
sess
.
Collection
(
"artist"
)
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
// trigger Postgres error. "" is not an int.
res
:=
artist
.
Find
(
db
.
Cond
{
"id"
:
""
})
var
row
map
[
string
]
interface
{}
err
=
res
.
One
(
&
row
)
if
err
==
db
.
ErrNoMoreRows
||
err
==
nil
{
t
.
Fatalf
(
"err = %#v, want PQ error"
,
err
)
}
}
// This test appends some data into the "artist" table.
func
TestAppend
(
t
*
testing
.
T
)
{
...
...
This diff is collapsed.
Click to expand it.
postgresql/result.go
+
4
−
9
View file @
b4111cb2
...
...
@@ -147,24 +147,19 @@ func (self *Result) One(dst interface{}) error {
// Fetches the next result from the resultset.
func
(
self
*
Result
)
Next
(
dst
interface
{})
error
{
var
err
error
// Current cursor.
err
=
self
.
setCursor
()
err
:=
self
.
setCursor
()
if
err
!=
nil
{
self
.
Close
()
return
err
}
// Fetching the next result from the cursor.
err
=
self
.
table
.
T
.
FetchRow
(
dst
,
self
.
cursor
)
if
err
!=
nil
{
self
.
Close
()
return
err
}
return
err
return
nil
}
// Removes the matching items from the collection.
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment