mirror of
https://github.com/adamdruppe/arsd.git
synced 2025-04-27 05:40:00 +03:00
dmd 2.061
This commit is contained in:
parent
b6cf1009c1
commit
86d1a3dcb1
10 changed files with 321 additions and 54 deletions
6
mysql.d
6
mysql.d
|
@ -691,7 +691,7 @@ string fromCstring(cstring c, int len = -1) {
|
|||
|
||||
|
||||
// FIXME: this should work generically with all database types and them moved to database.d
|
||||
Ret queryOneRow(Ret = Row, DB, T...)(DB db, string sql, T t) if(
|
||||
Ret queryOneRow(Ret = Row, DB, string file = __FILE__, size_t line = __LINE__, T...)(DB db, string sql, T t) if(
|
||||
(is(DB : Database))
|
||||
// && (is(Ret == Row) || is(Ret : DataObject)))
|
||||
)
|
||||
|
@ -699,12 +699,12 @@ Ret queryOneRow(Ret = Row, DB, T...)(DB db, string sql, T t) if(
|
|||
static if(is(Ret : DataObject) && is(DB == MySql)) {
|
||||
auto res = db.queryDataObject!Ret(sql, t);
|
||||
if(res.empty)
|
||||
throw new Exception("result was empty");
|
||||
throw new Exception("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");
|
||||
throw new Exception("result was empty", file, line);
|
||||
return res.front;
|
||||
} else static assert(0, "Unsupported single row query return value, " ~ Ret.stringof);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue