Skip to content

Commit

Permalink
Merge pull request #84 from akhilravuri1/master
Browse files Browse the repository at this point in the history
DirectExec Api test cases
  • Loading branch information
akhilravuri1 authored May 19, 2020
2 parents 6ccefb1 + 9b81fc7 commit 59457a4
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
9 changes: 9 additions & 0 deletions testdata/ExecDirect_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package main

import "testing"

func TestExecDirect(t *testing.T) {
if ExecDirect() == nil {
t.Error("Error in ExecDirect")
}
}
17 changes: 17 additions & 0 deletions testdata/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,16 @@ func Query() error {
return nil
}

//ExecDirect will execute the query without prepare
func ExecDirect() error {
db, _ := sql.Open("go_ibm_db", con)
_, err := db.Query("select * from rocket")
if err != nil {
return err
}
return nil
}

//Scan will Scan the data in the rows
func Scan() error {
db, _ := sql.Open("go_ibm_db", con)
Expand Down Expand Up @@ -1014,4 +1024,11 @@ func main() {
} else {
fmt.Println("Fail")
}

result29 := ExecDirect()
if result29 == nil {
fmt.Println("Pass")
} else {
fmt.Println("Fail")
}
}

0 comments on commit 59457a4

Please sign in to comment.