mirror of https://github.com/adamdruppe/arsd.git
more descriptive error messages
This commit is contained in:
parent
025e7ee835
commit
5a9b0bfda9
|
@ -71,6 +71,8 @@ struct Row {
|
||||||
package ResultSet resultSet;
|
package ResultSet resultSet;
|
||||||
|
|
||||||
string opIndex(size_t idx) {
|
string opIndex(size_t idx) {
|
||||||
|
if(idx >= row.length)
|
||||||
|
throw new Exception(text("index ", idx, " is out of bounds on result"));
|
||||||
return row[idx];
|
return row[idx];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
2
mysql.d
2
mysql.d
|
@ -100,6 +100,8 @@ class MySqlResult : ResultSet {
|
||||||
private void fetchNext() {
|
private void fetchNext() {
|
||||||
assert(result);
|
assert(result);
|
||||||
auto r = mysql_fetch_row(result);
|
auto r = mysql_fetch_row(result);
|
||||||
|
if(r is null)
|
||||||
|
throw new Exception("there is no next row");
|
||||||
uint numFields = mysql_num_fields(result);
|
uint numFields = mysql_num_fields(result);
|
||||||
uint* lengths = mysql_fetch_lengths(result);
|
uint* lengths = mysql_fetch_lengths(result);
|
||||||
string[] row;
|
string[] row;
|
||||||
|
|
Loading…
Reference in New Issue