D and MySQL

2011-07-19 Thread New2D
I do quite a bit of work with MySQL. I can't seem to find any information on how to use D with MySQL. Is there a tutorial or example around that someone can point me to?

Re: D and MySQL

2011-07-19 Thread Trass3r
http://prowiki.org/wiki4d/wiki.cgi?DatabaseBindings There is some information, but it's probably outdated. Please update that wiki once you know more :) Apart from that I only know of this binding: http://dsource.org/projects/ddbi

Re: D and MySQL

2011-07-19 Thread Adam Ruppe
I wrapped the libmysql C library in D and use it in a lot of my apps. https://github.com/adamdruppe/misc-stuff-including-D-programming-language-web-stuff Grab database.d and mysql.d from there. To use it: === import arsd.mysql; void main() { auto mysql = new MySql("localhost", "username", "

Re: D and MySQL

2011-07-19 Thread Trass3r
Am 19.07.2011, 20:49 Uhr, schrieb Adam Ruppe : foreach(line; mysql.query("select id, name from users where id > ?", 5)) { // access to columns by name writefln("%s: %s", line["id"], line["name"]); // alternatively, you can write: writefln("%s: %s",

Re: D and MySQL

2011-07-19 Thread Adam Ruppe
Trass3r wrote: > I guess access via opDispatch would also be nice to have?! Use mysql.queryDataObject() for that. foreach(line; mysql.queryDataObject(...rest is the same...) { writeln(line.id, line.name); //line["id"] //line["name"] } all work. But with the DataObject, you don't hav

Re: D and MySQL

2011-07-19 Thread Trass3r
The DataObject is found in database.d - it is meant to work generically with any database backend. Damn, we should really have a common project for database stuff.

Re: D and MySQL

2011-07-20 Thread Mandeep
On 07/20/2011 12:04 AM, New2D wrote: I do quite a bit of work with MySQL. I can't seem to find any information on how to use D with MySQL. Is there a tutorial or example around that someone can point me to? I had tried writing a library similar to JDBC. http://dsource.org/projects/ddbc. It d