Comments (7)
If it makes it easier to read, here is the code without the panicOnErr stuff.
package main
import (
"database/sql"
"fmt"
_ "github.com/go-sql-driver/mysql"
)
func main() {
var scanIn sql.RawBytes //Change this to []byte and hang doesn't happen
//Initialize database and test table
fmt.Println("Connecting to database")
db, _ := sql.Open("mysql", "root@tcp(localhost:3306)/ExampleDBName")
db.Ping()
fmt.Println("DB connected")
tx, _ := db.Begin()
tx.Exec(`CREATE TEMPORARY TABLE goTest (i int NOT NULL) ENGINE=MEMORY`)
tx.Exec(`INSERT INTO goTest VALUES (?), (?)`, 6, 7)
rows, _ := tx.Query(`SELECT * FROM goTest`)
for i := 0; i < 2; i++ {
rows.Next()
rows.Scan(&scanIn)
}
rows.Close()
for i := 0; i < 2; i++ {
rows, _ := tx.Query(`SELECT * FROM goTest WHERE i=?`, 6+i)
rows.Next()
rows.Scan(&scanIn)
//rows.Next() //Uncomment this line and the hang doesn't happen
fmt.Println("Close started")
rows.Close() //Hangs here 2nd time
fmt.Println("Close Ended")
}
}
from mysql.
Related Issues (20)
- Installation command contains extra character HOT 2
- could you please support prepared sql for mysql5.7 and mysql8.0 user create/rename/drop etc...?
- busy buffer error after connection reset by peer HOT 7
- db.Close() does not close connection after query HOT 1
- OUT parameters for Stored Procedure Calls
- undefined: strings.Cut HOT 2
- ENUM and SET column types cannot be identified HOT 3
- 'go get' no longer supported HOT 1
- Please update documentation (installation - go get -u github.com/go-sql-driver/mysql fails for newer go versions) HOT 1
- BUG: resource don't release when db.Exec have error. HOT 8
- DSN: support - in database name HOT 2
- context deadline exceeded HOT 1
- panic in escapeStringBackslash HOT 3
- Empty result with max unsigned int value
- For some reason the data is not showing. HOT 1
- Cut a new v1.7.2 release HOT 14
- Potential out of bound access in `(*mysqlConn).handleErrorPacket` HOT 7
- Toggle Click in Leaderboards
- mysql startWatcher panic error HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mysql.