On 12/04/2016 11:48 PM, Suliman wrote:

I am still trying to get work any of PostgreSQL drivers. For last few
day I had test all of drivers. All of them are _very_ buggy!
Just few of them have support of `bytea` data type, that use for binary
blobs. But support does not mean that it's work.

Now I am trying to get https://github.com/IrenejMarc/dpq work.

```
import std.stdio;
import dpq.connection;
import dpq.query;
import dpq.attributes;
import dpq.result;
import dpq.value;

void main()
{

     auto conn = Connection("host=localhost dbname=test01 user=postgres
password='Infinity8'");

     string myq = `SELECT userblob FROM "USERS"`;
     auto q = Query(myq);
     Result r = q.run();

     ubyte [] x;

     foreach(row; r)
     {
         //x = row[0];
         writeln(row[0]); // need as!binary or so.
         readln;
     }
}
````

By docs binary data type should work, but I can't find way to set it's
type. For examples for strings its doing like: .as!string

But what about binary? I have read sources and found place that can be
sutable for it, but I do not know how to use it.
https://github.com/IrenejMarc/dpq/blob/6a5acc805a891b5cdab3f333fbae692aca042f5a/source/dpq/value.d#L237


But I have not ideas how to use it.

Have you tried .as!(ubyte[]); ?

Reply via email to