PutInsertStatement returns an InsertStatement to the pool
(stmt *InsertStatement)
| 549 | |
| 550 | // PutInsertStatement returns an InsertStatement to the pool |
| 551 | func PutInsertStatement(stmt *InsertStatement) { |
| 552 | if stmt == nil { |
| 553 | return |
| 554 | } |
| 555 | |
| 556 | // Clean up expressions |
| 557 | for i := range stmt.Columns { |
| 558 | PutExpression(stmt.Columns[i]) |
| 559 | stmt.Columns[i] = nil |
| 560 | } |
| 561 | // Clean up multi-row values |
| 562 | for i := range stmt.Values { |
| 563 | for j := range stmt.Values[i] { |
| 564 | PutExpression(stmt.Values[i][j]) |
| 565 | stmt.Values[i][j] = nil |
| 566 | } |
| 567 | stmt.Values[i] = stmt.Values[i][:0] |
| 568 | } |
| 569 | |
| 570 | // Reset slices but keep capacity |
| 571 | stmt.Columns = stmt.Columns[:0] |
| 572 | stmt.Values = stmt.Values[:0] |
| 573 | stmt.TableName = "" |
| 574 | |
| 575 | // Return to pool |
| 576 | insertStmtPool.Put(stmt) |
| 577 | } |
| 578 | |
| 579 | // GetUpdateStatement gets an UpdateStatement from the pool |
| 580 | func GetUpdateStatement() *UpdateStatement { |