Skip to content

Commit f627b81

Browse files
committed
dub.json sourcePath adjustment, mysql fixes
1 parent ac8790a commit f627b81

2 files changed

Lines changed: 12 additions & 7 deletions

File tree

dub.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@
44
"copyright": "Copyright © 2015, Erik Smith",
55
"authors": ["Erik Smith"],
66
"license": "MIT",
7-
"sourcePaths": [".", "src"],
7+
"sourcePaths": ["src"]
88
}
99

src/std/database/mysql/database.d

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ private static bool isError()(int ret) {
5353

5454
private static T* check(T)(string msg, T* ptr) {
5555
info(msg);
56-
if (!ptr) throw new DatabaseException("mysql error: " ~ msg);
56+
if (!ptr) createError(msg);
5757
return ptr;
5858
}
5959

@@ -63,12 +63,17 @@ private static int check()(string msg, MYSQL_STMT* stmt, int ret) {
6363
return ret;
6464
}
6565

66+
private static void createError()(string msg) {
67+
throw new DatabaseException("mysql error: " ~ msg);
68+
}
69+
70+
private static void createError()(string msg, int ret) {
71+
throw new DatabaseException("mysql error: status: " ~ to!string(ret) ~ ":" ~ msg);
72+
}
73+
6674
private static void createError()(string msg, MYSQL_STMT* stmt, int ret) {
67-
info(msg, ":", ret);
68-
if (!isError(ret)) return;
6975
import core.stdc.string: strlen;
7076
const(char*) err = mysql_stmt_error(stmt);
71-
//info("error: ", err[0..strlen(err)]); //fix
7277
throw new DatabaseException("mysql error: " ~ msg);
7378
}
7479

@@ -368,10 +373,10 @@ struct Impl(Policy) {
368373
//rows_ = row_count_;
369374
return false;
370375
} else if (status == MYSQL_DATA_TRUNCATED) {
371-
throw new DatabaseException("fetch: database truncation");
376+
createError("mysql_stmt_fetch: truncation", status);
372377
}
373378

374-
createError("mysql_stmt_fetch",stmt.stmt,status);
379+
createError("mysql_stmt_fetch", stmt.stmt, status);
375380
return false;
376381
}
377382

0 commit comments

Comments
 (0)