Skip to content

Commit

Permalink
SNOW-988972 changes
Browse files Browse the repository at this point in the history
* renaming directory to cmd/variant from cmd/insertvariantobject
* adding defer around the DROP TABLE statement
  • Loading branch information
sfc-gh-dszmolka committed Dec 12, 2023
1 parent daf06b3 commit 09fc982
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,13 @@ func main() {
if err != nil {
log.Fatalf("failed to run the query. %v, err: %v", createTableQuery, err)
}

defer func() {
fmt.Printf("Dropping the table: %v\n", dropQuery)
_, err = db.Exec(dropQuery)
if err != nil {
log.Fatalf("failed to run the query. %v, err: %v", dropQuery, err)
}
}()
fmt.Printf("Inserting VARIANT and OBJECT data into table: %v\n", insertQuery)
_, err = db.Exec(insertQuery,
string(jsonStr),
Expand Down Expand Up @@ -99,10 +105,5 @@ func main() {
fmt.Printf("ERROR: %v\n", rows.Err())
return
}
fmt.Printf("Dropping the table: %v\n", dropQuery)
_, err = db.Exec(dropQuery)
if err != nil {
log.Fatalf("failed to run the query. %v, err: %v", dropQuery, err)
}

}

0 comments on commit 09fc982

Please sign in to comment.