On Tue, Apr 12, 2016 at 10:31 AM, Suliman via Digitalmars-d-announce < digitalmars-d-announce@puremagic.com> wrote:
> On Monday, 15 February 2016 at 22:50:56 UTC, Piotr Szturmaj wrote: > >> On 2016-02-14 20:48, Eugene Wissner wrote: >> >>> I think may be we should discuss if we can/should change something in >>> ddb. I think there were some interesting and promising ideas in this >>> discussion. Maybe split the PostgreSQL driver and develop it seperately >>> and use an interface more similar to JDBC. Maybe some kind of coworking >>> with ddbc is possible to get more developers together; maybe Suliman has >>> some thoughts on it. >>> >> >> I added you and Jacob as collaborators. Please do what you think is >> right. Thanks. >> > > Could anybody help me to understand how to get data as ubyte? > > I found this places in sources. > > https://github.com/pszturmaj/ddb/commit/29070ef90ba8f8d658be50a5da4aa3c96d0cdd5a > > https://github.com/pszturmaj/ddb/commit/a66ff5a6aa7008235f28cce167d0ae42cc4f4df3 > > But I can't understand how to use it. > > My code is next: > > auto cmd = new PGCommand(conn); > > cmd.query = `SELECT name, userblob FROM "USERS" ;`; > > ubyte [] x; > > try { > auto result = cmd.executeQuery; > > foreach (row; result) > { > writeln(row[0]); > x = row[1].get!(ubyte); > } > > } > catch (ServerErrorException e) { > // Probably table does not exist - ignore > } > > > But I am getting error: > > source\app.d(28,13): Error: cannot implicitly convert expression (( > VariantN!20u __tmpfordtor3893 = row.opIndex(1u); > , __tmpfordtor3893).get()) of type ubyte to ubyte[] > dmd failed with exit code 1. > > > > > Hi, In your example x is a ubyte[] and you get!(ubyte). x should be a ubyte, however from your sql query I'd assume you actually mean to use .get!(ubyte[])