Works for me on allegro-5.0.10-mt.dll, produced 391kb lib file.
Could anybody provide any simple examples of usage DerelictPQ. I
do not have experience of C, and I can't understand how to use
this driver.
I need just basics like connect, select and insert.
http://code.dlang.org/packages/derelict-pq
thanks!
I know this is probably a theoretical exercise, but easier way
might be to execute tasklist and just grep the output.
I have done next:
string connString = psql -h localhost -p 5432 -U postgres -d
testdb;
package PGconn* conn;
@property bool nonBlocking(){ return PQisnonblocking(conn) == 1;
}
this(parseConfig parseconfig)
{
void connect()
{
Imagine there's a template that wraps arbitrary functions and may
throw exceptions depending on their returned values (see a
simplified example below). However, if an exception occurs, the
backtrace is pointing inside the template which is not helpful at
all (especially when many such
On Wed, 24 Dec 2014 13:38:59 +
aldanor via Digitalmars-d-learn digitalmars-d-learn@puremagic.com
wrote:
Imagine there's a template that wraps arbitrary functions and may
throw exceptions depending on their returned values (see a
simplified example below). However, if an exception occurs,
On Wednesday, 24 December 2014 at 13:48:26 UTC, ketmar via
Digitalmars-d-learn wrote:
the `object.Exception@wrap.d` is not a backtrace result, this
is the
result of Exception class constructor:
this (string msg, string file=__FILE__, usize line=__LINE__,
Throwable next=null)
it
On Wed, 24 Dec 2014 14:04:50 +
aldanor via Digitalmars-d-learn digitalmars-d-learn@puremagic.com
wrote:
On Wednesday, 24 December 2014 at 13:48:26 UTC, ketmar via
Digitalmars-d-learn wrote:
the `object.Exception@wrap.d` is not a backtrace result, this
is the
result of Exception
I haven't used the derelict version but I have used the C library
itself and wrapped it briefly in my postgres.d here:
https://github.com/adamdruppe/arsd/blob/master/postgres.d
(implements an interface from database.d in the same repo)
I used very, very little of the library, but it is
has to generate new parameterized function, of course. sorry.
signature.asc
Description: PGP signature
On Wednesday, 24 December 2014 at 13:39:00 UTC, aldanor wrote:
(especially when many such functions have been wrapped). Is it
somehow possible to throw an exception from the parent frame
so the backtrace would never drop into the template body?
Since this is just passed as arguments to the
On Wednesday, 24 December 2014 at 14:04:51 UTC, aldanor wrote:
auto check(string file = __FILE__, int line =
__LINE__)(int x) {
You can just do regular params (most the time), don't have to be
template params. My last email shows that too. Then it doesn't
make new templates on each
On Wednesday, 24 December 2014 at 14:11:37 UTC, Adam D. Ruppe
wrote:
auto check(alias func)(int x, string file = __FILE__, size_t
line = __LINE__) {
/* snip */
throw new Exception(%d 0.format(result), file,
line); // L10
Thanks! I guess that's what my confusion was partially
The code I currently have is as follows:
import std.stdio;
import std.traits;
import std.typecons;
struct EmbeddedTest
{
int bits;
}
struct Test
{
//Other stuff
EmbeddedTest embeddedTest;
enum isSet(alias bit) = `cast(bool)(embeddedTest.bits `
On Wed, 24 Dec 2014 17:05:45 +
Meta via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote:
So `if (isSet!bit1)` becomes `if (cast(bool)(embeddedTest.bits
bit1)`. That doesn't work, however. I get an error message saying
need 'this' for 'bits' of type 'int'. Is there a way to
The backtrace code has a parameter that lets you tell it how many
leading frames you want it to skip when generating the result.
This is to get out of the Throwable ctor code itself, but it
wouldn't be hard to bump this by one or two if you need it to.
On Wednesday, 24 December 2014 at 14:08:53 UTC, Adam D. Ruppe
wrote:
I haven't used the derelict version but I have used the C
library itself and wrapped it briefly in my postgres.d here:
https://github.com/adamdruppe/arsd/blob/master/postgres.d
Thanks! But few questions:
1. how to build it
On Wednesday, 24 December 2014 at 17:41:09 UTC, ketmar via
Digitalmars-d-learn wrote:
On Wed, 24 Dec 2014 17:05:45 +
Meta via Digitalmars-d-learn
digitalmars-d-learn@puremagic.com wrote:
So `if (isSet!bit1)` becomes `if (cast(bool)(embeddedTest.bits
bit1)`. That doesn't work, however. I
On Wed, 24 Dec 2014 19:52:31 +
Meta via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote:
Hmm, I confused myself over when the expression is interpreted. I
got it into my head that the template expansion would somehow
delay interpretation of the expression so it could be
I am curious, however, why changing `enum` to `auto` (or bool)
doesn't work. You said that the mixin tries to interpret the
expression `cast(bool)(embeddedTest.bits enumName)` at
compile time, but I don't understand why that would be so when
the storage is auto and not enum. I guess mixin
On Wednesday, 24 December 2014 at 19:26:11 UTC, Suliman wrote:
1. how to build it with dub?
I don't know, I don't use dub.
2. I tried to: dmd app.d database.d postgres.d but get message
that File Not Found pq.lib
Download the lib file from me here:
http://arsdnet.net/dcode/pq.lib
You'll
On Wednesday, 24 December 2014 at 20:08:07 UTC, Meta wrote:
I am curious, however, why changing `enum` to `auto` (or bool)
doesn't work. You said that the mixin tries to interpret the
expression `cast(bool)(embeddedTest.bits enumName)` at
compile time, but I don't understand why that would be
I'm wondering how to best implement the following pattern: the
constructor of a class has some required and some optional
arguments; and one of the (optional) arguments also controls if
any additional arguments should be passed.
A hypothetical/simplified example that I came up with: there's a
On 12/24/2014 8:56 PM, Suliman wrote:
Could anybody provide any simple examples of usage DerelictPQ. I do not
have experience of C, and I can't understand how to use this driver.
I need just basics like connect, select and insert.
http://code.dlang.org/packages/derelict-pq
thanks!
On Thu, 25 Dec 2014 02:07:51 +
aldanor via Digitalmars-d-learn digitalmars-d-learn@puremagic.com
wrote:
I'm wondering how to best implement the following pattern: the
constructor of a class has some required and some optional
arguments; and one of the (optional) arguments also controls
On 12/25/2014 11:23 AM, Mike Parker wrote:
On 12/24/2014 8:56 PM, Suliman wrote:
Could anybody provide any simple examples of usage DerelictPQ. I do not
have experience of C, and I can't understand how to use this driver.
I need just basics like connect, select and insert.
On Thursday, 25 December 2014 at 02:28:47 UTC, ketmar via
Digitalmars-d-learn wrote:
happy hacking! ;-)
Thanks once again! I think this mostly solves it. Would it be
possible to somehow do the same trick with this()? (I guess due
to having to write Type!() when default template arguments are
On Thu, 25 Dec 2014 03:07:55 +
aldanor via Digitalmars-d-learn digitalmars-d-learn@puremagic.com
wrote:
On Thursday, 25 December 2014 at 02:28:47 UTC, ketmar via
Digitalmars-d-learn wrote:
happy hacking! ;-)
Thanks once again! I think this mostly solves it. Would it be
possible to
DerelictPQ is only a binding to libpq. The only difference is
the
DerelictPQ.load method. Just follow the libpq documentation.
http://www.postgresql.org/docs/9.1/static/libpq.html
Actually, Derelict binds to version 9.3, so the proper link
should be
29 matches
Mail list logo