如何使用Go的數(shù)據(jù)庫/ 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中實現(xiàn)相同目標?
- 3 回答
- 0 關(guān)注
- 188 瀏覽
添加回答
舉報
0/150
提交
取消