我正在读取一个巨大的文件,并使用预statement.executeBatch()准备语句在mysql中插入记录.以下是代码:
for(int i = 0; i < file.length; i++) {
count += 1
statement.setString(1, record.id)
statement.setString(2, record.date)
statement.setString(3, record.msg)
statement.addBatch()
if (count % 1000 == 0)
statement.executeBatch()
}
statement.executeBatch()
Run Code Online (Sandbox Code Playgroud)
Slick如何帮助(也许模仿上面的代码)?