mirror of https://github.com/adamdruppe/arsd.git
some fixes for my writeln and now that phobos is fixed in opend that other hack obsolete
This commit is contained in:
parent
4be980ff79
commit
c284a5c857
3
core.d
3
core.d
|
|
@ -9224,8 +9224,7 @@ private string actuallyWriteToStdHandle(int whichOne, scope char[] buffer) @trus
|
||||||
}
|
}
|
||||||
|
|
||||||
if(GetFileType(hStdOut) == FILE_TYPE_CHAR) {
|
if(GetFileType(hStdOut) == FILE_TYPE_CHAR) {
|
||||||
wchar[256] wbuffer;
|
WCharzBuffer toWrite = WCharzBuffer(buffer, WindowsStringConversionFlags.convertNewLines);
|
||||||
auto toWrite = makeWindowsString(buffer, wbuffer, WindowsStringConversionFlags.convertNewLines);
|
|
||||||
|
|
||||||
DWORD written;
|
DWORD written;
|
||||||
WriteConsoleW(hStdOut, toWrite.ptr, cast(DWORD) toWrite.length, &written, null);
|
WriteConsoleW(hStdOut, toWrite.ptr, cast(DWORD) toWrite.length, &written, null);
|
||||||
|
|
|
||||||
|
|
@ -207,6 +207,7 @@ struct DatabaseDatum {
|
||||||
string toString() {
|
string toString() {
|
||||||
if(isNull())
|
if(isNull())
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
return storage.toString();
|
return storage.toString();
|
||||||
}
|
}
|
||||||
/++
|
/++
|
||||||
|
|
@ -217,7 +218,6 @@ struct DatabaseDatum {
|
||||||
alias toString this;
|
alias toString this;
|
||||||
|
|
||||||
/// ditto
|
/// ditto
|
||||||
version(D_OpenD) {} else // opend enables -preview=rvaluerefparam which makes this conflict with the rvalue toString in matching to!T stuff
|
|
||||||
T opCast(T)() {
|
T opCast(T)() {
|
||||||
import std.conv;
|
import std.conv;
|
||||||
return to!T(this.toString);
|
return to!T(this.toString);
|
||||||
|
|
@ -227,6 +227,12 @@ struct DatabaseDatum {
|
||||||
string toArsdJsVar() { return this.toString; }
|
string toArsdJsVar() { return this.toString; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unittest {
|
||||||
|
// tbh this is more of a phobos test but rvaluerefparam has messed it up before
|
||||||
|
auto db = DatabaseDatum("1234567");
|
||||||
|
assert(to!int(db) == 1234567);
|
||||||
|
}
|
||||||
|
|
||||||
/++
|
/++
|
||||||
A row in a result set from a query.
|
A row in a result set from a query.
|
||||||
|
|
||||||
|
|
|
||||||
3
sqlite.d
3
sqlite.d
|
|
@ -241,8 +241,9 @@ class SqliteResult : ResultSet {
|
||||||
else if (auto d = c.peek!double)
|
else if (auto d = c.peek!double)
|
||||||
// 17 significant decimal digits are enough to not lose precision (IEEE 754 section 5.12.2)
|
// 17 significant decimal digits are enough to not lose precision (IEEE 754 section 5.12.2)
|
||||||
r.row ~= DatabaseDatum(format!"%.17s"(*d));
|
r.row ~= DatabaseDatum(format!"%.17s"(*d));
|
||||||
else
|
else {
|
||||||
r.row ~= DatabaseDatum(c.coerce!(string));
|
r.row ~= DatabaseDatum(c.coerce!(string));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return r;
|
return r;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue