Go theorytheory 0/50 · 0%
Data · medium

29. Databases with database/sql

Pooling, scanning and transactions.

database/sql gives a connection pool over driver implementations. Always use parameter placeholders to avoid SQL injection, scan rows into typed variables, close rows, and check rows.Err(). Wrap multi-statement work in transactions with deferred rollback.

Check your understanding

  1. 1. SQL injection is avoided by…

  2. 2. sql.DB represents…