Error: no property 'select' for type 'ddbc.core.Statement'

Suliman via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun Jan 31 01:15:04 PST 2016


I hope that here I will get answer faster then on 
https://github.com/buggins/ddbc/issues/18

I am using ddbc diver for access to mysql. I need to return 
result of request to struct. My code is next:

import std.stdio;
import ddbc.all;
import std.stdio;
import std.conv;

void main()
{
	string[string] params;
	MySQLDriver driver = new MySQLDriver();
     string url = MySQLDriver.generateUrl("localhost", 3306, 
"test");
     params = MySQLDriver.setUserAndPassword("root", "pass");
	DataSource ds = new ConnectionPoolDataSourceImpl(driver, url, 
params);

	// creating Connection
	auto conn = ds.getConnection();
	scope(exit) conn.close();

	// creating Statement
	auto stmt = conn.createStatement();
	scope(exit) stmt.close();
	
	string sql = "select * from test.imgs";
	auto images = stmt.executeQuery(sql);
	
	struct myData
	{
	 int id;
	 string date;
	}
	
	foreach(ref e; stmt.select!myData)
	{
	
	}
	
	/* this code is work
	while(images.next())
	{
		string mydata = images.getString(4);
		writeln(mydata);
		readln;
	}
	*/
	
}

I am getting error: Error: no property 'select' for type 
'ddbc.core.Statement'

What I am doing wrong?



More information about the Digitalmars-d-learn mailing list