code: func (d *Accessor) InsertCertificate(cr certdb.CertificateRecord) error {
  	err := d.checkDB()
  	if err != nil {
  		return err
  	}
  
  	res, err := d.db.NamedExec(insertSQL, &certdb.CertificateRecord{
  		Serial:    cr.Serial,
  		AKI:       cr.AKI,
  		CALabel:   cr.CALabel,
  		Status:    cr.Status,
  		Reason:    cr.Reason,
  		Expiry:    cr.Expiry.UTC(),
  		RevokedAt: cr.RevokedAt.UTC(),
  		PEM:       cr.PEM,
  	})
  	if err != nil {
  		return wrapSQLError(err)
  	}
  
  	numRowsAffected, err := res.RowsAffected()
  
  	if numRowsAffected == 0 {
  		return cferr.Wrap(cferr.CertStoreError, cferr.InsertionFailed, fmt.Errorf("failed to insert the certificate record"))
  	}
  
  	if numRowsAffected != 1 {
  		return wrapSQLError(fmt.Errorf("%d rows are affected, should be 1 row", numRowsAffected))
  	}
  
  	return err
  }
docs: // InsertCertificate puts a certdb.CertificateRecord into db.