Re: mysql binding/wrapper?
On Saturday, 28 April 2012 at 17:42:42 UTC, Adam D. Ruppe wrote: On Saturday, 28 April 2012 at 16:19:37 UTC, simendsjo wrote: As it resides in this big misc repository, does it have many dependecies? It depends on the database.d module in there too. (database.d provides the base interface and some common functions with other db providers.) That's it though, D wise. It also uses the mysql C library so you'll need libmysql on your system for it to link too. Would you mind if the module was added to vibe, and thus relicensed to MIT? No idea if the vibe folks would actually want that though :) My stuff is all free to take as far as I'm concerned, but since this uses libmysql it might technically be GPL. I don't really know. But if you're ok with that, you can have it. There is one small compilation error on the postgres driver line 44. I'm not sure it's the right thing to do but changing the offending type to size_t seems to do the trick.
Re: mysql binding/wrapper?
On Mon, 30 Apr 2012 16:18:16 +0200, simendsjo wrote: On Mon, 30 Apr 2012 16:08:34 +0200, Steven Schveighoffer schvei...@yahoo.com wrote: On Sat, 28 Apr 2012 13:42:41 -0400, Adam D. Ruppe destructiona...@gmail.com wrote: On Saturday, 28 April 2012 at 16:19:37 UTC, simendsjo wrote: Would you mind if the module was added to vibe, and thus relicensed to MIT? No idea if the vibe folks would actually want that though :) My stuff is all free to take as far as I'm concerned, but since this uses libmysql it might technically be GPL. If that's the case, using this lib will make your entire project GPL. I think the britseyeview version was an attempt by Steve Teale to write a non-GPL lib that used the protocol spec from MySQL for inclusion in Phobos. Not sure where it stands. -Steve I wrote a reply yesterday that obviously didn't make it. Sönke Ludwig integrated Steve Teales native mysql library: https://github.com/rejectedsoftware/mysql-native Haven't had the time to test it yet, but at least it compiles and is able to get metadata from mysql. Actually, it looks like the vibe folks are using my fork of Steve Teales mysqln. I had hoped to contact Steve first, so that these changes existed in one place. https://github.com/JollieRoger All of the changes exist in individual branches off the master branch. Git will merge these into one file fuzzily. What they are is as follows: seperatemain - split main() into its own file (app.d in vibe). seperatemainwithport - main() using branch addporttoconnection. addporttoconnection - add no standard port selection to Connection. fixfordmd2058 - cosmetic changes to work with dmd-2.058. fixresultset - allow the return of an empty resultset. When iterating schema, test had no tables and would crash. fixconnection - would only connect to localhost in Steve's code. I have other changes that I haven't pushed up yet relating to NUMERIC and null variants with a more detailed main.d. Vibe.d looks interesting, I hope these fixes help.
Re: mysql binding/wrapper?
On Mon, 30 Apr 2012 18:57:57 +0200, simendsjo wrote: Yes, your patches has been merged. Of course it would be best to have everything database complete already, but I'm glad it's been merged as-is for now - it might take a long time (and has already) before a generic database interface is completed. Hi simendsjo, I now see your repository at: https://github.com/simendsjo/mysqln Is there a way that we can have one central repository that people can pull from. I would like it to be Steve's since that is the one everybody knows, but I am not sure he wants to manage pull requests and such (If your are listening Steve, please weigh in). He seems to be enjoying Adventures in Woodworking and may not have any fingers left when he finishes his latest project (just joking, read your blog). Otherwise, maybe we could use your repository listed above. My goal is not a generic database interface discussed previously in these groups. I just want an interface for mysql/mariadb and less so for postgresql at this point.
Re: mysql binding/wrapper?
On 4/30/12 11:57 PM, simendsjo wrote: On 4/29/12 11:48 PM, dnewbie wrote: On Saturday, 28 April 2012 at 15:30:13 UTC, simendsjo wrote: stuff/blob/master/mysql.d http://my.opera.com/run3/blog/2012/03/13/d-mysql I use it in a bank account application. It works. On Mon, 30 Apr 2012 18:19:29 +0200, James Oliphant jollie.ro...@gmail.com wrote: Actually, it looks like the vibe folks are using my fork of Steve Teales mysqln. I had hoped to contact Steve first, so that these changes existed in one place. https://github.com/JollieRoger All of the changes exist in individual branches off the master branch. Git will merge these into one file fuzzily. What they are is as follows: seperatemain - split main() into its own file (app.d in vibe). seperatemainwithport - main() using branch addporttoconnection. addporttoconnection - add no standard port selection to Connection. fixfordmd2058 - cosmetic changes to work with dmd-2.058. fixresultset - allow the return of an empty resultset. When iterating schema, test had no tables and would crash. fixconnection - would only connect to localhost in Steve's code. I have other changes that I haven't pushed up yet relating to NUMERIC and null variants with a more detailed main.d. Vibe.d looks interesting, I hope these fixes help. Yes, your patches has been merged. Of course it would be best to have everything database complete already, but I'm glad it's been merged as-is for now - it might take a long time (and has already) before a generic database interface is completed. Looking at the code of mysql.d I see a big switch with many cases like case 0x01: // TINYINT. But then there's the SQLType enum with those constants. Why the enum values are not used in the cases? (and also in other parts of the code?)
Re: mysql binding/wrapper?
On Mon, 30 Apr 2012 20:53:02 +0200, James Oliphant jollie.ro...@gmail.com wrote: On Mon, 30 Apr 2012 18:57:57 +0200, simendsjo wrote: Yes, your patches has been merged. Of course it would be best to have everything database complete already, but I'm glad it's been merged as-is for now - it might take a long time (and has already) before a generic database interface is completed. Hi simendsjo, I now see your repository at: https://github.com/simendsjo/mysqln Is there a way that we can have one central repository that people can pull from. I would like it to be Steve's since that is the one everybody knows, but I am not sure he wants to manage pull requests and such (If your are listening Steve, please weigh in). He seems to be enjoying Adventures in Woodworking and may not have any fingers left when he finishes his latest project (just joking, read your blog). Otherwise, maybe we could use your repository listed above. My goal is not a generic database interface discussed previously in these groups. I just want an interface for mysql/mariadb and less so for postgresql at this point. I did a small patch for it to compile for x64. Vibe.d has patches to use it's internal stream library, so that would probably be hard to patch back to Steve. I was thinking of deleting my project and forking from vibe.d to do pull requests against that as I thought that would be the most used repository Not sure how we should go about this, but I agree fragmentation is bad. Hope Steve can chip in as it's his code and he has plans for a generic interface.
Re: mysql binding/wrapper?
On Mon, 30 Apr 2012 20:55:45 +0200, Ary Manzana a...@esperanto.org.ar wrote: Looking at the code of mysql.d I see a big switch with many cases like case 0x01: // TINYINT. But then there's the SQLType enum with those constants. Why the enum values are not used in the cases? (and also in other parts of the code?) It's not finished: http://www.britseyeview.com/software/mysqln/
Re: mysql binding/wrapper?
On Saturday, 28 April 2012 at 15:30:13 UTC, simendsjo wrote: stuff/blob/master/mysql.d http://my.opera.com/run3/blog/2012/03/13/d-mysql I use it in a bank account application. It works.
Re: mysql binding/wrapper?
On Sat, 28 Apr 2012 17:54:49 +0200, Adam D. Ruppe destructiona...@gmail.com wrote: On Saturday, 28 April 2012 at 15:30:13 UTC, simendsjo wrote: https://github.com/adamdruppe/misc-stuff-including-D-programming-language-web-stuff/blob/master/mysql.d That's mine. I use it all the time; nothing super fancy, but it gets the job done for me. I didn't really document it... but the basic usage is simple: auto mysql = new MySql(hostname, username, password, database_name); int userId = getMyUserId(); foreach(line; mysql.query(SELECT id, name FROM something WHERE user_id = ?, userId)) { line[id] == line[0] line[name] == line[1] } The columns are returned as strings. The query returns a simple range, so you can also check .empty, get .front, etc. Hmm.. Seems my previous message was lost in the void. As it resides in this big misc repository, does it have many dependecies? Would you mind if the module was added to vibe, and thus relicensed to MIT? No idea if the vibe folks would actually want that though :)
Re: mysql binding/wrapper?
On Saturday, 28 April 2012 at 16:19:37 UTC, simendsjo wrote: As it resides in this big misc repository, does it have many dependecies? It depends on the database.d module in there too. (database.d provides the base interface and some common functions with other db providers.) That's it though, D wise. It also uses the mysql C library so you'll need libmysql on your system for it to link too. Would you mind if the module was added to vibe, and thus relicensed to MIT? No idea if the vibe folks would actually want that though :) My stuff is all free to take as far as I'm concerned, but since this uses libmysql it might technically be GPL. I don't really know. But if you're ok with that, you can have it.