如何使用Go的数据库/ SQL包批处理sql语句?在Java中,我会这样:// Create a prepared statementString sql = "INSERT INTO my_table VALUES(?)";PreparedStatement pstmt = connection.prepareStatement(sql);// Insert 10 rows of datafor (int i=0; i<10; i++) { pstmt.setString(1, ""+i); pstmt.addBatch();}// Execute the batchint [] updateCounts = pstmt.executeBatch();我将如何在Go中实现相同目标?
3 回答
- 3 回答
- 0 关注
- 169 浏览
添加回答
举报
0/150
提交
取消