indexer: Fix storing locale as NULL when empty

Perhaps it's better to get rid of NULL and make empty the default value.
But for now this'll do.
This commit is contained in:
Yorhel 2016-11-06 16:24:39 +01:00
parent cb81bedac1
commit 7d2abfb3a4

View file

@ -57,6 +57,7 @@ fn insert_pkg(tr: &postgres::transaction::Transaction, opt: &PkgOpt) -> Option<i
fn insert_man_row(tr: &postgres::GenericConnection, verid: i32, path: &str, enc: &str, hash: &[u8]) {
let (name, sect, locale) = man::parse_path(path).unwrap();
let locale = if locale == "" { None } else { Some(locale) };
if let Err(e) = tr.execute(
"INSERT INTO man (package, name, filename, locale, hash, section, encoding) VALUES ($1, $2, '/'||$3, $4, $5, $6, $7)",
&[&verid, &name, &path, &locale, &hash, &sect, &enc]