February 14, 2016
On Sun, 14 Feb 2016 12:48:49 +0100, Jacob Carlborg wrote:

> On 2016-02-14 00:32, Dicebot wrote:
> 
>> Ideally ddb should be built on top of ddbc wrapping it into fiber-friendly async API but I don't know if this is possible with ddbc design.
> 
> It looks like libpg has support for asynchronous calls [1] but ddbc does not use them. Also, although libpg provides asynchronous calls I'm not sure if that automatically means it will be compatible with the IO model used by vibe.

If you have asynchronous calls that you can poll, you can make it work with vibe.d, albeit awkwardly. (Start request, poll+yield, return when there's a result.) If you only have synchronous calls, you'd have to introduce IO threads and synchronization.

It's awkward to make things compatible with vibe.d and Phobos IO. The APIs are rather dissimilar, so you can't just, for instance, have different imports under a version() block.
February 15, 2016
On 2016-02-14 17:53, Piotr Szturmaj wrote:

> ddb was written with multiple databases in mind, mostly postgres, mysql
> and sqlite. db.d (DBRow definition) is database independent. postgres.d
> contains PGConnection, PGCommand, etc. Other backends should provide
> their own classes like MySqlConnection, MySqlCommand and so on. Then
> it's trivial to add an abstraction layer that chooses between different
> backends depending on the connection string for example.
>
> Regarding ddb maintainability, thank you for your interest, I can add
> you both (Jacob and Eugene) to my repository as collaborators, you will
> have full access to repo, pull requests and issues. If I will ever need
> ddb in some of my project I would still have access to my repo to make
> some changes. If the project will grow bigger than expected we could
> move it to the new repo later. Is that okay for you?

Fine by me.

-- 
/Jacob Carlborg
February 15, 2016
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.
April 12, 2016
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.




April 12, 2016
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[])


April 12, 2016
On Tuesday, 12 April 2016 at 08:47:43 UTC, Rory McGuire wrote:
> 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[])


I need to get binary blob. It's storage in PG as `bytea`. Could you show example how to get data from this field?
April 12, 2016
This code compile and run:

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:

core.exception.OutOfMemoryError@src\core\exception.d(679): Memory allocation failed

Is there any hack that can prevent this error?
April 12, 2016
On Tue, Apr 12, 2016 at 11:30 AM, Suliman via Digitalmars-d-announce < digitalmars-d-announce@puremagic.com> wrote:

> This code compile and run:
>
> 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:
>
> core.exception.OutOfMemoryError@src\core\exception.d(679): Memory
> allocation failed
>
> Is there any hack that can prevent this error?
>

Would need to see the full exception stack trace that was printed out.
Could you perhaps have an infinite recursion bug in there somewhere?
You should be able to see if you are getting the right type out of the
Variant by using something like:
writeln(row[1].type);


April 12, 2016
On Tuesday, 12 April 2016 at 09:52:53 UTC, Rory McGuire wrote:
> On Tue, Apr 12, 2016 at 11:30 AM, Suliman via Digitalmars-d-announce < digitalmars-d-announce@puremagic.com> wrote:
>
>> This code compile and run:
>>
>> 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:
>>
>> core.exception.OutOfMemoryError@src\core\exception.d(679): Memory
>> allocation failed
>>
>> Is there any hack that can prevent this error?
>>
>
> Would need to see the full exception stack trace that was printed out.
> Could you perhaps have an infinite recursion bug in there somewhere?
> You should be able to see if you are getting the right type out of the
> Variant by using something like:
> writeln(row[1].type);

I am getting Out of memory exception even on this code:
writeln(row[0].type);

writeln(row[0]); // -- works fine
April 12, 2016
On Tuesday, 12 April 2016 at 09:58:22 UTC, Suliman wrote:
> On Tuesday, 12 April 2016 at 09:52:53 UTC, Rory McGuire wrote:
>> On Tue, Apr 12, 2016 at 11:30 AM, Suliman via Digitalmars-d-announce < digitalmars-d-announce@puremagic.com> wrote:
>>
>>>[...]
>>
>> Would need to see the full exception stack trace that was printed out.
>> Could you perhaps have an infinite recursion bug in there somewhere?
>> You should be able to see if you are getting the right type out of the
>> Variant by using something like:
>> writeln(row[1].type);
>
> I am getting Out of memory exception even on this code:
> writeln(row[0].type);
>
> writeln(row[0]); // -- works fine

writeln(row[0]) is fine.

However, you need to close the result set and destroy the PGCommand.

result.close();
cmd.destroy();
1 2 3
Next ›   Last »