(id int64, attr string)
| 2515 | } |
| 2516 | |
| 2517 | func (db *datastore) GetCollectionAttribute(id int64, attr string) string { |
| 2518 | var v string |
| 2519 | err := db.QueryRow("SELECT value FROM collectionattributes WHERE collection_id = ? AND attribute = ?", id, attr).Scan(&v) |
| 2520 | switch { |
| 2521 | case err == sql.ErrNoRows: |
| 2522 | return "" |
| 2523 | case err != nil: |
| 2524 | log.Error("Couldn't SELECT value in getCollectionAttribute for attribute '%s': %v", attr, err) |
| 2525 | return "" |
| 2526 | } |
| 2527 | return v |
| 2528 | } |
| 2529 | |
| 2530 | func (db *datastore) SetCollectionAttribute(id int64, attr, v string) error { |
| 2531 | _, err := db.Exec("INSERT INTO collectionattributes (collection_id, attribute, value) VALUES (?, ?, ?) "+db.upsert("collection_id", "attribute")+" value = ?", id, attr, v, v) |
no outgoing calls
no test coverage detected