some fixes for my writeln and now that phobos is fixed in opend that other hack obsolete

This commit is contained in:
Adam D. Ruppe 2025-06-06 14:29:06 -04:00
parent 4be980ff79
commit c284a5c857
3 changed files with 10 additions and 4 deletions

3
core.d
View File

@ -9224,8 +9224,7 @@ private string actuallyWriteToStdHandle(int whichOne, scope char[] buffer) @trus
}
if(GetFileType(hStdOut) == FILE_TYPE_CHAR) {
wchar[256] wbuffer;
auto toWrite = makeWindowsString(buffer, wbuffer, WindowsStringConversionFlags.convertNewLines);
WCharzBuffer toWrite = WCharzBuffer(buffer, WindowsStringConversionFlags.convertNewLines);
DWORD written;
WriteConsoleW(hStdOut, toWrite.ptr, cast(DWORD) toWrite.length, &written, null);

View File

@ -207,6 +207,7 @@ struct DatabaseDatum {
string toString() {
if(isNull())
return null;
return storage.toString();
}
/++
@ -217,7 +218,6 @@ struct DatabaseDatum {
alias toString this;
/// 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)() {
import std.conv;
return to!T(this.toString);
@ -227,6 +227,12 @@ struct DatabaseDatum {
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.

View File

@ -241,8 +241,9 @@ class SqliteResult : ResultSet {
else if (auto d = c.peek!double)
// 17 significant decimal digits are enough to not lose precision (IEEE 754 section 5.12.2)
r.row ~= DatabaseDatum(format!"%.17s"(*d));
else
else {
r.row ~= DatabaseDatum(c.coerce!(string));
}
}
return r;