On Tue, 17 Dec 2013 20:43:02 GMT, Luís Marques wrote:

I have ddb working, but I don't know how to pass parameters to queries (without concatenating strings, which is unsafe and awkward). That is, I'm looking for something like this:

PGCommand(conn, "SELECT * FROM foo WHERE bar = ?", barValue);

Suggestions?

I can't get ddb working. I get this error

object.Exception@../../../home/visus/.dub/packages/vibe-d-master/source/vibe/core/drivers/libevent2_tcp.d(348): Connection error while reading from TCPConnection.
Error: Program exited with code 1

here is my code

import postgres.db;

this()
{
	auto pdb = new PostgresDB([
		"host" : "localhost",
		"database" : "mydb",
		"user" : "postgres",
		"password" : "postgres"
	]);
	auto conn = pdb.lockConnection();
	
	auto cmd = new PGCommand(conn, "SELECT typname, typlen FROM pg_type");
	auto result = cmd.executeQuery;
	
	try
	{
		foreach (row; result)
		{
			writeln(row["typname"], ", ", row[1]);
		}
	}
	finally
	{
		result.close;
	}
}