catching up on random stuff

This commit is contained in:
Adam D. Ruppe 2013-02-16 11:18:15 -05:00
parent 4ff49846d4
commit 79b2a25b92
8 changed files with 334 additions and 39 deletions

10
mysql.d
View file

@ -699,16 +699,22 @@ Ret queryOneRow(Ret = Row, DB, string file = __FILE__, size_t line = __LINE__, T
static if(is(Ret : DataObject) && is(DB == MySql)) {
auto res = db.queryDataObject!Ret(sql, t);
if(res.empty)
throw new Exception("result was empty", file, line);
throw new EmptyResultException("result was empty", file, line);
return res.front;
} else static if(is(Ret == Row)) {
auto res = db.query(sql, t);
if(res.empty)
throw new Exception("result was empty", file, line);
throw new EmptyResultException("result was empty", file, line);
return res.front;
} else static assert(0, "Unsupported single row query return value, " ~ Ret.stringof);
}
class EmptyResultException : Exception {
this(string message, string file = __FILE__, size_t line = __LINE__) {
super(message, file, line);
}
}
/*
void main() {