Test cases for BINARY columns

Boris,

Database D016-1table1primarykey10columns3rowsSQLdatatypes contains a column declared as BINARY(20).

BINARY(20) is a fixed-length binary type, so shorter values get padded (with zero-value bytes IIRC) upon insertion.

The DM test case that exercises this database contains xsd:hex64binary encoded versions of the original, non-padded data.

This is incorrect, it should contain the padded version.

Perhaps more reasonably, the column declaration should be changed to VARBINARY(20).

This is similar to the issue we had earlier with CHAR/VARCHAR.

Note: It seems there's no test case for R2RML that uses a binary type. Please add one. The easiest thing is to just use a binary column in a column-valued object map with rr:column and without a rr:datatype declaration. When rr:datatype is *not* specified, then R2RML always uses the natural datatype mapping, hence the result will be the same hex64binary typed literal as in the DM.

Note: Juan requested weird corner cases, so here's one that's actually kind of cool. Let's use a VARBINARY column in a URI template to create data URIs [1]:

rr:template "data:image/png;base64,{\"Photo\"}";

This should produce something like this:

data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==

If everything works, you can actually open that URI in your browser (it produces a small round red dot).

Best,
Richard

[1] http://en.wikipedia.org/wiki/Data_URI_scheme

Received on Thursday, 1 March 2012 14:49:19 UTC