mirror of https://github.com/adamdruppe/arsd.git
fix varargs code in database and a few errors in mssql + x64
This commit is contained in:
parent
4a57064709
commit
9d027eb3f6
32
database.d
32
database.d
|
@ -25,35 +25,19 @@ interface Database {
|
|||
Variant[] args;
|
||||
foreach(arg; _arguments) {
|
||||
string a;
|
||||
if(arg == typeid(string)) {
|
||||
a = va_arg!(string)(_argptr);
|
||||
} else if(arg == typeid(immutable(string))) {
|
||||
a = va_arg!(immutable(string))(_argptr);
|
||||
} else if(arg == typeid(const(immutable(char)[]))) {
|
||||
a = va_arg!(const(immutable(char)[]))(_argptr);
|
||||
} else if (arg == typeid(int)) {
|
||||
auto e = va_arg!(int)(_argptr);
|
||||
a = to!string(e);
|
||||
} else if (arg == typeid(immutable(int))) {
|
||||
auto e = va_arg!(immutable(int))(_argptr);
|
||||
a = to!string(e);
|
||||
} else if (arg == typeid(const(int))) {
|
||||
auto e = va_arg!(const(int))(_argptr);
|
||||
if(arg == typeid(string) || arg == typeid(immutable(string)) || arg == typeid(const(string)))
|
||||
a = va_arg!string(_argptr);
|
||||
else if (arg == typeid(int) || arg == typeid(immutable(int)) || arg == typeid(const(int))) {
|
||||
int e = va_arg!int(_argptr);
|
||||
a = to!string(e);
|
||||
} else if (arg == typeid(immutable(char))) {
|
||||
auto e = va_arg!(immutable(char))(_argptr);
|
||||
char e = va_arg!char(_argptr);
|
||||
a = to!string(e);
|
||||
} else if (arg == typeid(long)) {
|
||||
auto e = va_arg!(long)(_argptr);
|
||||
a = to!string(e);
|
||||
} else if (arg == typeid(const(long))) {
|
||||
auto e = va_arg!(const(long))(_argptr);
|
||||
a = to!string(e);
|
||||
} else if (arg == typeid(immutable(long))) {
|
||||
auto e = va_arg!(immutable(long))(_argptr);
|
||||
} else if (arg == typeid(long) || arg == typeid(const(long)) || arg == typeid(immutable(long))) {
|
||||
long e = va_arg!long(_argptr);
|
||||
a = to!string(e);
|
||||
} else if (arg == typeid(void*)) {
|
||||
auto e = va_arg!(void*)(_argptr);
|
||||
void* e = va_arg!(void*)(_argptr);
|
||||
assert(e is null, "can only pass null pointer");
|
||||
a = null;
|
||||
} else assert(0, "invalid type " ~ arg.toString );
|
||||
|
|
8
dom.d
8
dom.d
|
@ -2172,7 +2172,7 @@ class Table : Element {
|
|||
return position;
|
||||
}
|
||||
|
||||
foreach(i, rowElement; rows) {
|
||||
foreach(int i, rowElement; rows) {
|
||||
auto row = cast(TableRow) rowElement;
|
||||
assert(row !is null);
|
||||
assert(i < ret.length);
|
||||
|
@ -2186,8 +2186,8 @@ class Table : Element {
|
|||
// FIXME: colspan == 0 or rowspan == 0
|
||||
// is supposed to mean fill in the rest of
|
||||
// the table, not skip it
|
||||
foreach(j; 0 .. cell.colspan) {
|
||||
foreach(k; 0 .. cell.rowspan)
|
||||
foreach(int j; 0 .. cell.colspan) {
|
||||
foreach(int k; 0 .. cell.rowspan)
|
||||
// if the first row, always append.
|
||||
insertCell(k + i, k == 0 ? -1 : position, cell);
|
||||
position++;
|
||||
|
@ -2195,7 +2195,7 @@ class Table : Element {
|
|||
}
|
||||
|
||||
if(ret[i].length > maxLength)
|
||||
maxLength = ret[i].length;
|
||||
maxLength = cast(int) ret[i].length;
|
||||
}
|
||||
|
||||
// want to ensure it's rectangular
|
||||
|
|
7
mssql.d
7
mssql.d
|
@ -19,7 +19,7 @@ class MsSql : Database {
|
|||
enforce(env !is null);
|
||||
scope(failure)
|
||||
SQLFreeHandle(SQL_HANDLE_ENV, env);
|
||||
SQLSetEnvAttr(env, SQL_ATTR_ODBC_VERSION, (void *) SQL_OV_ODBC3, 0);
|
||||
SQLSetEnvAttr(env, SQL_ATTR_ODBC_VERSION, cast(void *) SQL_OV_ODBC3, 0);
|
||||
SQLAllocHandle(SQL_HANDLE_DBC, env, &conn);
|
||||
scope(failure)
|
||||
SQLFreeHandle(SQL_HANDLE_DBC, conn);
|
||||
|
@ -50,8 +50,7 @@ class MsSql : Database {
|
|||
|
||||
// this is passed to MsSqlResult to control
|
||||
SQLHSTMT statement;
|
||||
auto returned = SQLAllocHandle(SQL_HANDLE_STMT, conn,
|
||||
&statement)
|
||||
auto returned = SQLAllocHandle(SQL_HANDLE_STMT, conn, &statement);
|
||||
|
||||
enforce(returned == SQL_SUCCESS);
|
||||
|
||||
|
@ -157,7 +156,7 @@ class MsSqlResult : ResultSet {
|
|||
if(ptr)
|
||||
goto more;
|
||||
}
|
||||
}
|
||||
}
|
||||
row ~= a;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue