Example #1
0
// Close closes all prepared statements.
// Returns an error implemented in package "github.com/kless/goutil/merrors".
func (c *SQLCode) Close() error {
	var err error
	var listErr merrors.ListError

	for _, v := range c.Stmt {
		if err = v.Close(); err != nil {
			listErr.Add(err.Error())
		}
	}
	return listErr.Err()
}
Example #2
0
// Prepare prepares all SQL statements.
func (s *Store) Prepare(code ...*SQLCode) error {
	var err error
	var listErr merrors.ListError
	s.CodesSQL = make([]*SQLCode, len(code))

	for i, v := range code {
		if err = v.Prepare(s.db); err != nil {
			listErr.Add(err.Error())
		}
		s.CodesSQL[i] = v
	}
	return listErr.Err()
}
Example #3
0
// Close closes all prepared statements for each set, and closes the conection
// to the database.
//
// Returns an error implemented in package "github.com/kless/goutil/merrors".
func (s *Store) Close() error {
	var err error
	var listErr merrors.ListError

	for _, v := range s.CodesSQL {
		if err = v.Close(); err != nil {
			listErr.Add(err.Error())
		}
	}

	if err = s.db.Close(); err != nil {
		listErr.Add(err.Error())
	}
	return listErr.Err()
}