KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
How do I batch sql statements with Go's database/sql package? In Java I would do it like this : // Create a prepared statement String sql = "INSERT INTO my_table VALUES(?)"; PreparedStatement pstmt = connection.prepareStatement(sql); // Insert 10 rows of data for (int i=0; i<10; i++) { pstmt.setString(1, ""+i); pstmt.addBatch(); } // Execute the batch int [] updateCounts = pstmt.executeBatch(); How would I achieve the same in Go?
Tags (comma-separated)
Save Edits
Cancel