Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Relational databases not planned? #15

Closed
simendsjo opened this issue Apr 28, 2012 · 15 comments
Closed

Relational databases not planned? #15

simendsjo opened this issue Apr 28, 2012 · 15 comments
Assignees

Comments

@simendsjo
Copy link
Contributor

I don't see any notes it todo.txt to support MySQL, SQLite or PostgreSQL. Given these are well known, and still widely popular, I think it makes sense to include them. At least MySQL and SQLite.

@s-ludwig
Copy link
Member

It's nothing that shouldn't be included. The drivers just have to be reimplemented using TcpConnection/FileStream. I looked into it but realized that I don't have enough time to do it myself and thus didn't add it to the todo list. But I would integrate an implementation if someone writes it. Alternatively, for more uncommon databases than those standard SQL ones, I think a separate library available as a VPM module would be a good idea.

@ghost ghost assigned s-ludwig Apr 28, 2012
@simendsjo
Copy link
Contributor Author

adamdruppe has given permission to use his mysql binding and under MIT license (It's boost now): https://github.com/adamdruppe/misc-stuff-including-D-programming-language-web-stuff/blob/master/mysql.d

It relies on his database interface: https://github.com/adamdruppe/misc-stuff-including-D-programming-language-web-stuff/blob/master/database.d

The MySQL library it's linking against is GPL.. Not sure about the implications, but I guess many sites is using the client library without opening the source code, so I don't think it should be a problem.

Is this something that could be added if someone took the time to integrate it?

@s-ludwig
Copy link
Member

The problem with the MySQL library is that it doesn't mix well with the asynchronous I/O and would block the event loop for every transaction. The MySQL protocol doesn't seem extremely complicated (http://forge.mysql.com/wiki/MySQL_Internals_ClientServer_Protocol), so it would be possible to write a native driver from scratch without too much effort - at least a useful subset of the protocol. This would also remove the GPL implication.

@simendsjo
Copy link
Contributor Author

Steve Teale has written a native MySQL driver already. It haven't been updated in 6 months (doesn't compile), but I'll take a look:
https://github.com/britseye/mysqln

@tomash
Copy link

tomash commented Apr 29, 2012

i'm +1 on this one and would love to contribute. with one note: linking against libs written in C will make it hard for linux users, as it'd require compiling with GDC, whereas vibe.d at the moment supports DMD only. so a native mysql driver would be most welcome.

@simendsjo
Copy link
Contributor Author

I updated the native driver to support x64 and dmd-trunk: https://github.com/simendsjo/mysqln/tree/compile-on-recent-dmd
I don't know the protocol at all, so it's quite possible I did something wrong. I'm ablo to connect to a database at least. I'll test some more later.

@dnadlinger
Copy link
Contributor

@tomash: Huh? Isn't it usually the other way round? Except for the x86_64 struct ABI issue, linking DMD code against C libraries on *nix is quite painless (after all, we also use glibc, …), while on Windows, the external library has to be compiled using DMC to be accessible from DMD, which doesn't always work.

Dynamic loading is of course always an alternative.

@simendsjo
Copy link
Contributor Author

Ehm... Seems the MySQL protocol is GPL.. If you use the protocol documentation to build a native library, you must license it under GPL...

Because this is a GPL protocol, any product which uses it to connect to a MySQL server, or to emulate a MySQL server, or to interpose between any client and server which uses the protocol, or for any similar purpose, is also bound by the GPL. Therefore if you use this description to write a program, you must release your program as GPL. Contact MySQL AB if you need clarification of these terms or if you need to ask about alternative arrangements.

http://forge.mysql.com/w/index.php?title=MySQL_Internals_ClientServer_Protocol&diff=5078&oldid=4374

@s-ludwig
Copy link
Member

Wasn't it the case that Microsoft tried the other way around and sued the samba project for implementing their proprietary protocol but failed? I think it was ruled that application interfaces cannot be protected. Hmm.. and if it must indeed be GPL licensed, isn't any website that is implemented using such a GPL driver also bound to the GPL, just like any other application using GPL libraries? And by that logic, wouldn't any GPL application implementing any protocol make that protocol GPL'ed? Doesn't seem sound to me.

Anyway, if this is really true, it can just be a GPL'ed VPM package and everyone can decide to use it on his/her own.

@simendsjo
Copy link
Contributor Author

Ah.. I see now that this restriction was removed in a revision september 2007. Guess it should be safe to use then.
I don't really have time work on this due to exams, so I hope someone steps up and integrate it to vibe.

@tomash
Copy link

tomash commented Apr 29, 2012

How about mysql drivers for python or ruby? They have it figured out for
sure, and they don't enforce gpl.

Tomash
sent from my htc desire
29-04-2012 18:57, "Sönke Ludwig" <
[email protected]>
napisał(a):

Wasn't it the case that Microsoft tried the other way around and sued the
samba project for implementing their proprietary protocol but failed? I
think it was ruled that application interfaces cannot be protected. Hmm..
and if it must indeed be GPL licensed, isn't any website that is
implemented using such a GPL driver also bound to the GPL, just like any
other application using GPL libraries? And by that logic, wouldn't any GPL
application implementing any protocol make that protocol GPL'ed? Doesn't
seem sound to me.

Anyway, if this is really true, it can just be a GPL'ed VPM package and
everyone can decide to use it on his/her own.


Reply to this email directly or view it on GitHub:
#15 (comment)

@simendsjo
Copy link
Contributor Author

I remember Steve Teale working on a database interface. Guess the native mysql driver was a part of that.
Piotr Szturmaj has also created a native driver for PostgreSQL: https://github.com/pszturmaj/ddb
Would probably be good to take advantage of some tried and true designs.

Perhaps someone should ping Steve Teale to see if he would be motivated to continue his work?

@s-ludwig
Copy link
Member

I have created a fork using vibe primitives as mysql-native. If anyone with a running MySQL server wants to try it out, it's there. It should also be usable per VPM by adding the following line the dependencies section of package.json: "mysql-native": ">=0.0.1"

@tomash
Copy link

tomash commented Apr 29, 2012

i'm pretty much sure ruby mysql drivers are NOT gpl-licensed:
https://github.com/brianmario/mysql2
also from the official documentation, see this one:
http://www.mysql.com/about/legal/licensing/foss-exception/

@s-ludwig
Copy link
Member

s-ludwig commented May 4, 2012

I'll close this one with https://github.com/rejectedsoftware/mysql-native as its outcome. GPL doesn't seem like an issue after all.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants