1
0
forked from MTSR/mapserver
mapserver/server/mapobjectdb/sqlite/settings.go
NatureFreshMilk 683c0456e5 settings type
2019-02-07 09:02:15 +01:00

31 lines
490 B
Go

package sqlite
func (db *Sqlite3Accessor) GetSetting(key string, defaultvalue string) (string, error) {
rows, err := db.db.Query(getSettingQuery, key)
if err != nil {
return "", err
}
defer rows.Close()
value := defaultvalue
if rows.Next() {
err = rows.Scan(&value)
if err != nil {
return "", err
}
}
return value, nil
}
func (db *Sqlite3Accessor) SetSetting(key string, value string) error {
_, err := db.db.Exec(setSettingQuery, key, value)
return err
}