Hi, I'm also working on postgresql client implementation and common DB interface (in my spare time between other projects). It's using native postgres protocol without using libpq. Tt also supports binary formatting of row fields - that should outperform textual libraries (no parsing/toString).

I already have working postgresql row querying. There are typed and untyped rows. Untyped row is DBRow!(Variant[]), typed rows are encapsulated using struct or tuple, for example:

PGConnection conn = new PGConnection;
conn.open([
        "host" : "localhost",
        "database": "test",
        "user" : "postgres",
        "password" : "postgres"
]);

auto cmd = new PGCommand(conn, "SELECT typname, typlen FROM pg_type");

struct S { string s; short l; }

auto result = cmd.executeQuery!(Tuple!(string, "s", short, "l"))();
auto result = cmd.executeQuery!S();

// those above two lines are equivalent
        
foreach (i, row; result)
{
        // row is DBRow!Tuple or DBRow!S
        writeln(i, " - ", row.s, ", ", row.l);
}

I've also written simple ORM mapping - creating and managing tables based on struct layout. I see your solution is in opposite - creating structs/classes based on SQL CREATE scripts.

Maybe we could join our efforts and create kind of hybrid DB library? :)

Reply via email to