This commit is contained in:
Sergey Bronnikov 2020-01-09 12:43:04 +03:00 committed by mattn
parent 53cff3fceb
commit d51eaf3b34
1 changed files with 4 additions and 4 deletions

View File

@ -27,7 +27,7 @@ func createBulkInsertQuery(n int, start int) (query string, args []interface{})
return return
} }
func bukInsert(db *sql.DB, query string, args []interface{}) (err error) { func bulkInsert(db *sql.DB, query string, args []interface{}) (err error) {
stmt, err := db.Prepare(query) stmt, err := db.Prepare(query)
if err != nil { if err != nil {
return return
@ -76,7 +76,7 @@ func main() {
num := 400 num := 400
query, args := createBulkInsertQuery(num, 0) query, args := createBulkInsertQuery(num, 0)
err = bukInsert(db, query, args) err = bulkInsert(db, query, args)
if err != nil { if err != nil {
log.Fatal(err) log.Fatal(err)
} }
@ -88,7 +88,7 @@ func main() {
log.Printf("updated SQLITE_LIMIT_VARIABLE_NUMBER: %d", limitVariableNumber) log.Printf("updated SQLITE_LIMIT_VARIABLE_NUMBER: %d", limitVariableNumber)
query, args = createBulkInsertQuery(num, num) query, args = createBulkInsertQuery(num, num)
err = bukInsert(db, query, args) err = bulkInsert(db, query, args)
if err != nil { if err != nil {
if err != nil { if err != nil {
log.Printf("expect failed since SQLITE_LIMIT_VARIABLE_NUMBER is too small: %v", err) log.Printf("expect failed since SQLITE_LIMIT_VARIABLE_NUMBER is too small: %v", err)
@ -102,7 +102,7 @@ func main() {
log.Printf("updated SQLITE_LIMIT_VARIABLE_NUMBER: %d", limitVariableNumber) log.Printf("updated SQLITE_LIMIT_VARIABLE_NUMBER: %d", limitVariableNumber)
query, args = createBulkInsertQuery(500, num+num) query, args = createBulkInsertQuery(500, num+num)
err = bukInsert(db, query, args) err = bulkInsert(db, query, args)
if err != nil { if err != nil {
if err != nil { if err != nil {
log.Fatal(err) log.Fatal(err)