Skip to content

Commit 22ac03a

Browse files
committed
Final fixups to get it to pass tests.
1 parent 29b4168 commit 22ac03a

File tree

10 files changed

+17
-15
lines changed

10 files changed

+17
-15
lines changed

dub.sdl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ copyright "Copyright (c) 2011-2019 Steve Teale, James W. Oliphant, Simen Endsj
55
authors "Steve Teale" "James W. Oliphant" "Simen Endsjø" "Sönke Ludwig" "Sergey Shamov" "Nick Sabalausky"
66

77
dependency "vibe-core" version="~>1.7.0" optional=true
8-
dependency "taggedalgebraic" version="~>0.11.7"
8+
dependency "taggedalgebraic" version="~>0.11.8"
99

1010
sourcePaths "source/"
1111
importPaths "source/"
@@ -53,7 +53,7 @@ configuration "unittest-vibe-ut" {
5353
buildOptions "unittests"
5454

5555
dependency "vibe-core" version="~>1.7.0" optional=false
56-
56+
5757
dependency "unit-threaded" version="~>0.7.45"
5858

5959
debugVersions "MYSQLN_TESTS"

dub.selections.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"memutils": "0.4.13",
99
"openssl": "1.1.4+1.0.1g",
1010
"stdx-allocator": "2.77.5",
11-
"taggedalgebraic": "0.11.7",
11+
"taggedalgebraic": "0.11.8",
1212
"unit-threaded": "0.7.55",
1313
"vibe-core": "1.7.0"
1414
}

dub.selections.vibecore-1.0.0.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"eventcore": "0.8.48",
55
"libasync": "0.8.4",
66
"memutils": "0.4.13",
7-
"taggedalgebraic": "0.11.6",
7+
"taggedalgebraic": "0.11.8",
88
"unit-threaded": "0.7.45",
99
"vibe-core": "1.0.0"
1010
}

examples/homePage/dub.selections.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"memutils": "0.4.13",
99
"openssl": "1.1.4+1.0.1g",
1010
"stdx-allocator": "2.77.5",
11-
"taggedalgebraic": "0.11.6",
11+
"taggedalgebraic": "0.11.8",
1212
"unit-threaded": "0.7.45",
1313
"vibe-core": "1.7.0"
1414
}

examples/homePage/dub.selections.vibecore-1.0.0.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"eventcore": "0.8.48",
55
"libasync": "0.8.4",
66
"memutils": "0.4.13",
7-
"taggedalgebraic": "0.11.6",
7+
"taggedalgebraic": "0.11.8",
88
"unit-threaded": "0.7.45",
99
"vibe-core": "1.0.0"
1010
}

examples/homePage/example.d

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ void main(string[] args)
1818
// Query
1919
ResultRange range = conn.query("SELECT * FROM `tablename`");
2020
Row row = range.front;
21-
Variant id = row[0];
22-
Variant name = row[1];
21+
auto id = row[0];
22+
auto name = row[1];
2323
assert(id == 1);
2424
assert(name == "Ann");
2525

@@ -32,7 +32,7 @@ void main(string[] args)
3232
"SELECT * FROM `tablename` WHERE `name`=? OR `name`=?",
3333
"Bob", "Bobby");
3434
bobs.close(); // Skip them
35-
35+
3636
Row[] rs = conn.query( // Same SQL as above, but only prepared once and is reused!
3737
"SELECT * FROM `tablename` WHERE `name`=? OR `name`=?",
3838
"Bob", "Ann").array; // Get ALL the rows at once

source/mysql/protocol/comms.d

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -341,12 +341,13 @@ package struct ProtocolPrepared
341341
case BlobRef:
342342
isRef = true; goto case;
343343
case Blob:
344+
case CBlob:
344345
if (ext == SQLType.INFER_FROM_D_TYPE)
345346
types[ct++] = SQLType.TINYBLOB;
346347
else
347348
types[ct++] = cast(ubyte) ext;
348349
types[ct++] = SIGNED;
349-
const ubyte[] uba = isRef? *v.kget!BlobRef : v.kget!Blob;
350+
const ubyte[] uba = isRef? *v.kget!BlobRef : (ts == Blob ? v.kget!Blob : v.kget!CBlob);
350351
ubyte[] packed = packLCS(uba);
351352
reAlloc(packed.length);
352353
vals[vcl..vcl+packed.length] = packed[];

source/mysql/result.d

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public:
6868
Params: i = the zero based index of the column whose value is required.
6969
Returns: A Variant holding the column value.
7070
+/
71-
inout(MySQLVal) opIndex(size_t i) inout
71+
ref inout(MySQLVal) opIndex(size_t i) inout
7272
{
7373
enforce!MYX(_nulls.length > 0, format("Cannot get column index %d. There are no columns", i));
7474
enforce!MYX(i < _nulls.length, format("Cannot get column index %d. The last available index is %d", i, _nulls.length-1));
@@ -189,7 +189,7 @@ struct UnsafeRow
189189
Row safe;
190190
alias safe this;
191191
deprecated("Variant support is deprecated. Please switch to using MySQLVal")
192-
Variant opIndex(size_t idx) const {
192+
Variant opIndex(size_t idx) {
193193
return safe[idx].asVariant;
194194
}
195195
}

source/mysql/test/regression.d

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ unittest
101101
auto results = cn.query(stmt).array;
102102
assert(results.length == 1);
103103
auto pText = results[0][0].peek!string();
104-
auto pBlob = results[0][1].peek!(const(ubyte)[])();
104+
auto pBlob = results[0][1].peek!(ubyte[])();
105105
assert(pText);
106106
assert(pBlob);
107107
assert(*pText == "hello");

source/mysql/types.d

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ union _MYTYPE
3939
// blobs are const because of the indirection. In this case, it's not
4040
// important because nobody is going to use MySQLVal to maintain their
4141
// ubyte array.
42-
const(ubyte)[] Blob;
42+
ubyte[] Blob;
43+
const(ubyte)[] CBlob;
4344

4445
typeof(null) Null;
4546
bool Bit;
@@ -193,7 +194,7 @@ TypeInfo type(MySQLVal val) @safe pure nothrow
193194
}
194195

195196
/// ditto
196-
T *peek(T)(MySQLVal val)
197+
T *peek(T)(ref MySQLVal val)
197198
{
198199
// use exact type.
199200
import taggedalgebraic.taggedalgebraic : get;

0 commit comments

Comments
 (0)