digitalmars.D - [GSOC] Database API
- Christian Manning (14/14) Mar 24 2011 Hi,
- Trass3r (2/5) Mar 24 2011 You could also have a look at http://dsource.org/projects/ddbi
- Christian Manning (11/16) Mar 25 2011 This can be of some inspiration and also brings up a point about how
- Jonathan M Davis (12/25) Mar 25 2011 What I would expect to be the case would be that it would be implemented...
- Christian Manning (6/31) Mar 25 2011 Understood.
- Trass3r (2/5) Mar 25 2011 You always have to apply via the google site.
- Bruno Medeiros (10/15) Mar 26 2011 Yeah, exactly. Technically you don't strictly need to contact the
- Andrei Alexandrescu (6/21) Mar 27 2011 You'll submit via Google's interface. See
- Piotr Szturmaj (38/52) Mar 25 2011 I'm at finishing stage of my PostgreSQL client, written entirely in D. I...
- Christian Manning (2/4) Mar 25 2011 For now, couldn't this just be included with the database module?
- Piotr Szturmaj (2/6) Mar 26 2011 Yes. I think, currently this is the only option.
- Masahiro Nakagawa (13/26) Mar 25 2011 Currently, many databases exist.
- Christian Manning (7/16) Mar 26 2011 Now that's an interesting way of going about things. Although, its
- David Nadlinger (6/11) Mar 26 2011 I don't think this is the way to go, as there is a huge conceptional
-
Masahiro Nakagawa
(13/25)
Mar 28 2011
On Sun, 27 Mar 2011 07:11:01 +0900, David Nadlinger
... - Daniel Gibson (10/30) Mar 29 2011 I think proper support for relational databases with SQL is more
- Kagamin (2/7) Mar 26 2011 Why not just use Variant? It should be able to hold anything, so Nullabl...
- Piotr Szturmaj (28/35) Mar 26 2011 I think it should, for the same reason. Many times you want more
- Andrei Alexandrescu (4/10) Mar 26 2011 Should be Algebraic!(T, void). If that doesn't currently compile, we
- Robert Jacques (4/15) Mar 26 2011 For what it's worth, both Algebraic!(T, void*) and Algebraic!(T, void)
- Kagamin (8/15) Mar 26 2011 can't assign null
- Piotr Szturmaj (7/22) Mar 26 2011 Yes, compiler qualifies null as void*.
- Kagamin (10/29) Mar 26 2011 Ahh, there's a workaround:
- Andrei Alexandrescu (4/21) Mar 26 2011 Great. I'd prefer the one using void because storing a void* can be a
- KennyTM~ (4/12) Mar 26 2011 template Nullable(T) if (!__traits(compiles, {T a=null;}) { ... }
- Kagamin (10/42) Mar 26 2011 this also works without allowing void!
- Andrei Alexandrescu (3/45) Mar 26 2011 Awesome. Talk about forgetting my own code :o).
Hi, I'm a second year student at De Montfort University studying Computer Science. I am very much interested in working on the database API idea that is proposed at http://prowiki.org/wiki4d/wiki.cgi?GSOC_2011_Ideas#DatabaseAPI (I was also quite interested in the containers idea, but it looks like someone else wants to do that) I have limited experience with database libraries but have begun to study the JDBC API (in my small amount of spare time only as term doesn't finish for another 2 weeks for me and I still have assignments). Has this idea/project been assigned a mentor? I'd like to ask them and the list, what's the best thing for me to do right now to prepare for this? Thanks Chris
Mar 24 2011
Has this idea/project been assigned a mentor? I'd like to ask them and the list, what's the best thing for me to do right now to prepare for this?You could also have a look at http://dsource.org/projects/ddbi This shows some past efforts to create database interfaces.
Mar 24 2011
On 24/03/2011 17:58, Trass3r wrote:This can be of some inspiration and also brings up a point about how this project would be executed, ie. is this to be part of phobos or a totally separate project? I'm guessing to be Digital Mars supported it's more likely wanted to be a part of phobos, but could someone clarify on this? Another question about Digital Mars' GSOC involvement: when it's application time do I submit a proposal to someone directly, to this list, or to the GSOC site at http://www.google-melange.com ? Thanks ChrisHas this idea/project been assigned a mentor? I'd like to ask them and the list, what's the best thing for me to do right now to prepare for this?You could also have a look at http://dsource.org/projects/ddbi This shows some past efforts to create database interfaces.
Mar 25 2011
On 24/03/2011 17:58, Trass3r wrote:What I would expect to be the case would be that it would be implemented with the idea that it would ideally be put into Phobos but that it wouldn't necessarily make it into Phobos. Any major new functionality that gets added to Phobos at this point needs to be reviewed by the folks on this newsgroup and get voted in. So, it's possible that a fairly solid solution could be created which would not be acceptable in Phobos for one reason or another, at which point it would have to either be fixed so that it would be acceptable in Phobos or be left as a 3rd party library. So, ideally stuff like a good database solution for D would make it into Phobos, but whether it actually makes it in depends a great deal on the actual solution. - Jonathan M DavisThis can be of some inspiration and also brings up a point about how this project would be executed, ie. is this to be part of phobos or a totally separate project? I'm guessing to be Digital Mars supported it's more likely wanted to be a part of phobos, but could someone clarify on this?Has this idea/project been assigned a mentor? I'd like to ask them and the list, what's the best thing for me to do right now to prepare for this?You could also have a look at http://dsource.org/projects/ddbi This shows some past efforts to create database interfaces.
Mar 25 2011
On 25/03/2011 18:45, Jonathan M Davis wrote:Understood. My last deadline is Monday, so after that I should have much more time to concentrate on this to plan out what I'd like to do and submit a proper proposal. ChrisOn 24/03/2011 17:58, Trass3r wrote:What I would expect to be the case would be that it would be implemented with the idea that it would ideally be put into Phobos but that it wouldn't necessarily make it into Phobos. Any major new functionality that gets added to Phobos at this point needs to be reviewed by the folks on this newsgroup and get voted in. So, it's possible that a fairly solid solution could be created which would not be acceptable in Phobos for one reason or another, at which point it would have to either be fixed so that it would be acceptable in Phobos or be left as a 3rd party library. So, ideally stuff like a good database solution for D would make it into Phobos, but whether it actually makes it in depends a great deal on the actual solution. - Jonathan M DavisThis can be of some inspiration and also brings up a point about how this project would be executed, ie. is this to be part of phobos or a totally separate project? I'm guessing to be Digital Mars supported it's more likely wanted to be a part of phobos, but could someone clarify on this?Has this idea/project been assigned a mentor? I'd like to ask them and the list, what's the best thing for me to do right now to prepare for this?You could also have a look at http://dsource.org/projects/ddbi This shows some past efforts to create database interfaces.
Mar 25 2011
Another question about Digital Mars' GSOC involvement: when it's application time do I submit a proposal to someone directly, to this list, or to the GSOC site at http://www.google-melange.com ?You always have to apply via the google site. I'm sure I read that somewhere in the FAQs.
Mar 25 2011
On 26/03/2011 00:04, Trass3r wrote:Yeah, exactly. Technically you don't strictly need to contact the organization before hand to submit the proposal, nor does the proposal have to be related to the ideas presented by the organization, the student can bring forth his own ideas. But later the organization will rank each student proposal to eventually decide which ones get accepted, so of course it helps that the student has discussed the proposal before hand. -- Bruno Medeiros - Software EngineerAnother question about Digital Mars' GSOC involvement: when it's application time do I submit a proposal to someone directly, to this list, or to the GSOC site at http://www.google-melange.com ?You always have to apply via the google site. I'm sure I read that somewhere in the FAQs.
Mar 26 2011
On 03/25/2011 09:02 AM, Christian Manning wrote:On 24/03/2011 17:58, Trass3r wrote:Either way would be acceptable.This can be of some inspiration and also brings up a point about how this project would be executed, ie. is this to be part of phobos or a totally separate project? I'm guessing to be Digital Mars supported it's more likely wanted to be a part of phobos, but could someone clarify on this?Has this idea/project been assigned a mentor? I'd like to ask them and the list, what's the best thing for me to do right now to prepare for this?You could also have a look at http://dsource.org/projects/ddbi This shows some past efforts to create database interfaces.Another question about Digital Mars' GSOC involvement: when it's application time do I submit a proposal to someone directly, to this list, or to the GSOC site at http://www.google-melange.com ?You'll submit via Google's interface. See http://d-programming-language.org/gsoc2011.html for details. Submission opens tomorrow. Andrei
Mar 27 2011
Christian Manning wrote:Hi, I'm a second year student at De Montfort University studying Computer Science. I am very much interested in working on the database API idea that is proposed at http://prowiki.org/wiki4d/wiki.cgi?GSOC_2011_Ideas#DatabaseAPI (I was also quite interested in the containers idea, but it looks like someone else wants to do that) I have limited experience with database libraries but have begun to study the JDBC API (in my small amount of spare time only as term doesn't finish for another 2 weeks for me and I still have assignments). Has this idea/project been assigned a mentor? I'd like to ask them and the list, what's the best thing for me to do right now to prepare for this? Thanks ChrisI'm at finishing stage of my PostgreSQL client, written entirely in D. I will post sources in few days. Before adding database support to Phobos, there are few important issues which obviously need further discussion. One of this issues are handling NULL values - essential thing in relational databases. Although, there were some efforts to introduce standard Nullable or Optional type, they were aborted. Currently I'm using this simple definition: struct Nullable(T) { Algebraic!(T, void*) Nullable; alias Nullable this; bool hasValue() { return cast(bool)Nullable.peek!(T); } bool isNull() { return cast(bool)!Nullable.peek!(T); } string toString() { T* t = Nullable.peek!T; return t ? to!string(*t) : "null"; } } It flawlessy cooperates with Variant, which - I think - should officially support nulls as well. I would propose that standard Nullable type, should be a subtype of Algebraic union as above. During writing my PostgreSQL interface, I also had some problems with Variant and std.conv.to functions. Currently std.conv doesn't support Variants, f.i. when using to!Variant(5), there are more than one toImpl match. In case of DB api, Variants are also essential, because field types returned by database server aren't known at compile time. To sum up, Phobos need some additional changes for database support, mainly addition of Nullable.
Mar 25 2011
On 25/03/2011 14:56, Piotr Szturmaj wrote:To sum up, Phobos need some additional changes for database support, mainly addition of Nullable.For now, couldn't this just be included with the database module?
Mar 25 2011
Christian Manning wrote:On 25/03/2011 14:56, Piotr Szturmaj wrote:Yes. I think, currently this is the only option.To sum up, Phobos need some additional changes for database support, mainly addition of Nullable.For now, couldn't this just be included with the database module?
Mar 26 2011
On Fri, 25 Mar 2011 02:48:14 +0900, Christian Manning <cmanning999 gmail.com> wrote:Hi, I'm a second year student at De Montfort University studying Computer Science. I am very much interested in working on the database API idea that is proposed at http://prowiki.org/wiki4d/wiki.cgi?GSOC_2011_Ideas#DatabaseAPI (I was also quite interested in the containers idea, but it looks like someone else wants to do that) I have limited experience with database libraries but have begun to study the JDBC API (in my small amount of spare time only as term doesn't finish for another 2 weeks for me and I still have assignments). Has this idea/project been assigned a mentor? I'd like to ask them and the list, what's the best thing for me to do right now to prepare for this?Currently, many databases exist. * SQL based: MySQL, PostgresSQL, SQLite, etc.. * KVS: Cassandra, HBase, Kumofs, Redis, etc... * Document Oriented: MongoDB, CouchDB, etc... I think next Database API should support these types. AFAIK, DDBI supports only SQL based interface. In Ruby, Rails 3 has Arel. Arel seems to be a good query abstraction. https://github.com/rails/arel Arel's concept may help you :) Masahiro
Mar 25 2011
On 25/03/2011 23:44, Masahiro Nakagawa wrote:In Ruby, Rails 3 has Arel. Arel seems to be a good query abstraction. https://github.com/rails/arel Arel's concept may help you :) MasahiroNow that's an interesting way of going about things. Although, its description suggests that it's a framework for building frameworks which isn't really what I'm after as the database API should be able to be used by anybody easily. I don't know Ruby at all but in some of those examples, the syntax is quite neat. Chris
Mar 26 2011
On 3/26/11 12:44 AM, Masahiro Nakagawa wrote:Currently, many databases exist. * SQL based: MySQL, PostgresSQL, SQLite, etc.. * KVS: Cassandra, HBase, Kumofs, Redis, etc... * Document Oriented: MongoDB, CouchDB, etc... I think next Database API should support these types.I don't think this is the way to go, as there is a huge conceptional difference between relational database systems and »NoSQL« systems such as, say, CouchDB or Cassandra. How would such a unified API look like? David
Mar 26 2011
On Sun, 27 Mar 2011 07:11:01 +0900, David Nadlinger <see klickverbot.at>= = wrote:On 3/26/11 12:44 AM, Masahiro Nakagawa wrote:Currently, many databases exist. * SQL based: MySQL, PostgresSQL, SQLite, etc.. * KVS: Cassandra, HBase, Kumofs, Redis, etc... * Document Oriented: MongoDB, CouchDB, etc... I think next Database API should support these types.I don't think this is the way to go, as there is a huge conceptional =difference between relational database systems and =C2=BBNoSQL=C2=AB s=ystems such =as, say, CouchDB or Cassandra.It's an open question. Ruby / Rails has Arel (note that Arel is data access abstraction, not database access abstraction. But Database access is a part of data = access). Haskell has Database.Persistent. I think other languages will support similar library in the future.How would such a unified API look like?I don't have a detail. I already implemented it if I had a detailed design. In my D tasks, database related task is low priority...
Mar 28 2011
Am 29.03.2011 01:18, schrieb Masahiro Nakagawa:On Sun, 27 Mar 2011 07:11:01 +0900, David Nadlinger <see klickverbot.at> wrote:I think proper support for relational databases with SQL is more important right now. Once it is done some abstraction for generic data access can be developed, using the relational database support for these databases and something else (probably more specific to each NoSQL-Database, because AFAIK they are even less compatible to each other than relational DBs) for NoSQL-DBs. Cheers, - DanielOn 3/26/11 12:44 AM, Masahiro Nakagawa wrote:It's an open question. Ruby / Rails has Arel (note that Arel is data access abstraction, not database access abstraction. But Database access is a part of data access). Haskell has Database.Persistent. I think other languages will support similar library in the future.Currently, many databases exist. * SQL based: MySQL, PostgresSQL, SQLite, etc.. * KVS: Cassandra, HBase, Kumofs, Redis, etc... * Document Oriented: MongoDB, CouchDB, etc... I think next Database API should support these types.I don't think this is the way to go, as there is a huge conceptional difference between relational database systems and »NoSQL« systems such as, say, CouchDB or Cassandra.
Mar 29 2011
Christian Manning Wrote:On 25/03/2011 14:56, Piotr Szturmaj wrote:Why not just use Variant? It should be able to hold anything, so Nullable should be not needed.To sum up, Phobos need some additional changes for database support, mainly addition of Nullable.For now, couldn't this just be included with the database module?
Mar 26 2011
Kagamin wrote:Christian Manning Wrote:I think it should, for the same reason. Many times you want more constrained data type than Variant. Say, some interface expect int or null. Nullable!int is perfect for it. But if you use Variant, you may end up having some struct inside or maybe some string, like 'abc' :) In other words, base type of Nullable (for example int) is enforceable at compile time, unlike Variant. Anyway my probosal is compatible with Variant. Variant is an alias for backend type VariantN. Quote from std.variant: "VariantN is a back-end type seldom used directly by user code. Two commonly-used types using VariantN as back-end are: Algebraic: A closed discriminated union with a limited type universe (e.g., Algebraic!(int, double, string) only accepts these three types and rejects anything else). Variant: An open discriminated union allowing an unbounded set of types. The restriction is that the size of the stored type cannot be larger than the largest built-in type. This means that Variant can accommodate all primitive types and all user-defined types except for large structs. Both Algebraic and Variant share VariantN's interface. (See their respective documentations below.)" I propose that, Nullable should be an alias (or subtype) of Algebraic, for example: template Nullable(T) { alias Algebraic!(T, void*) Nullable; } This way it will share the same backend as Variant, so both types will be compatible.On 25/03/2011 14:56, Piotr Szturmaj wrote:Why not just use Variant? It should be able to hold anything, so Nullable should be not needed.To sum up, Phobos need some additional changes for database support, mainly addition of Nullable.For now, couldn't this just be included with the database module?
Mar 26 2011
On 3/26/11 2:11 PM, Piotr Szturmaj wrote:I propose that, Nullable should be an alias (or subtype) of Algebraic, for example: template Nullable(T) { alias Algebraic!(T, void*) Nullable; }Should be Algebraic!(T, void). If that doesn't currently compile, we should make it compile. Andrei
Mar 26 2011
On Sat, 26 Mar 2011 15:58:18 -0400, Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> wrote:On 3/26/11 2:11 PM, Piotr Szturmaj wrote:For what it's worth, both Algebraic!(T, void*) and Algebraic!(T, void) compile on my branch of std.variant.I propose that, Nullable should be an alias (or subtype) of Algebraic, for example: template Nullable(T) { alias Algebraic!(T, void*) Nullable; }Should be Algebraic!(T, void). If that doesn't currently compile, we should make it compile. Andrei
Mar 26 2011
Robert Jacques Wrote:can't assign null alias Algebraic!(int,void) nint; nint n1=5; assert(n1==5); n1=null; \std\variant.d:497: Error: static assert "Cannot store a void* in a VariantN!(maxSize,int,void). Valid types are (int, void)" test.d:45: instantiated from here: opAssign!(void*)Should be Algebraic!(T, void). If that doesn't currently compile, we should make it compile. AndreiFor what it's worth, both Algebraic!(T, void*) and Algebraic!(T, void) compile on my branch of std.variant.
Mar 26 2011
Kagamin wrote:Robert Jacques Wrote:Yes, compiler qualifies null as void*. I was playing with void* version few weeks ago and I can confirm that both assignment and equality testing works for nulls. One thing I missed was lack of conversion to string "null". For example array of Algebraic!(int, void*) was printed as [0, 0, 2], when element 1 was null. I think it should rather be [0, null, 2].can't assign null alias Algebraic!(int,void) nint; nint n1=5; assert(n1==5); n1=null; \std\variant.d:497: Error: static assert "Cannot store a void* in a VariantN!(maxSize,int,void). Valid types are (int, void)" test.d:45: instantiated from here: opAssign!(void*)Should be Algebraic!(T, void). If that doesn't currently compile, we should make it compile. AndreiFor what it's worth, both Algebraic!(T, void*) and Algebraic!(T, void) compile on my branch of std.variant.
Mar 26 2011
Kagamin Wrote:Robert Jacques Wrote:Ahh, there's a workaround: alias Algebraic!(int,void) nint; nint n1=5; assert(n1.get!(int)==5); n1=nint(); //uninitialized Variant, sort of null assert(!n1.hasValue); assert(n1.peek!(int)==null); writeln("error here:"); assert(n1.get!(int)==0);can't assign null alias Algebraic!(int,void) nint; nint n1=5; assert(n1==5); n1=null; \std\variant.d:497: Error: static assert "Cannot store a void* in a VariantN!(maxSize,int,void). Valid types are (int, void)" test.d:45: instantiated from here: opAssign!(void*)Should be Algebraic!(T, void). If that doesn't currently compile, we should make it compile. AndreiFor what it's worth, both Algebraic!(T, void*) and Algebraic!(T, void) compile on my branch of std.variant.
Mar 26 2011
On 3/26/11 4:20 PM, Robert Jacques wrote:On Sat, 26 Mar 2011 15:58:18 -0400, Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> wrote:Great. I'd prefer the one using void because storing a void* can be a legitimate need. AndreiOn 3/26/11 2:11 PM, Piotr Szturmaj wrote:For what it's worth, both Algebraic!(T, void*) and Algebraic!(T, void) compile on my branch of std.variant.I propose that, Nullable should be an alias (or subtype) of Algebraic, for example: template Nullable(T) { alias Algebraic!(T, void*) Nullable; }Should be Algebraic!(T, void). If that doesn't currently compile, we should make it compile. Andrei
Mar 26 2011
On Mar 27, 11 03:11, Piotr Szturmaj wrote:I propose that, Nullable should be an alias (or subtype) of Algebraic, for example: template Nullable(T) { alias Algebraic!(T, void*) Nullable; } This way it will share the same backend as Variant, so both types will be compatible.template Nullable(T) if (!__traits(compiles, {T a=null;}) { ... } I don't think it makes sense to Nullable something that can already take null.
Mar 26 2011
Kagamin Wrote:Kagamin Wrote:this also works without allowing void! alias Algebraic!(int) nint; nint n1=5; assert(n1.get!(int)==5); n1=nint(); //still null assert(!n1.hasValue); assert(n1.peek!(int)==null); writeln("error:"); assert(n1.get!(int)==0);Robert Jacques Wrote:Ahh, there's a workaround: alias Algebraic!(int,void) nint; nint n1=5; assert(n1.get!(int)==5); n1=nint(); //uninitialized Variant, sort of null assert(!n1.hasValue); assert(n1.peek!(int)==null); writeln("error here:"); assert(n1.get!(int)==0);can't assign null alias Algebraic!(int,void) nint; nint n1=5; assert(n1==5); n1=null; \std\variant.d:497: Error: static assert "Cannot store a void* in a VariantN!(maxSize,int,void). Valid types are (int, void)" test.d:45: instantiated from here: opAssign!(void*)Should be Algebraic!(T, void). If that doesn't currently compile, we should make it compile. AndreiFor what it's worth, both Algebraic!(T, void*) and Algebraic!(T, void) compile on my branch of std.variant.
Mar 26 2011
On 3/26/11 5:33 PM, Kagamin wrote:Kagamin Wrote:Awesome. Talk about forgetting my own code :o). AndreiKagamin Wrote:this also works without allowing void! alias Algebraic!(int) nint; nint n1=5; assert(n1.get!(int)==5); n1=nint(); //still null assert(!n1.hasValue); assert(n1.peek!(int)==null); writeln("error:"); assert(n1.get!(int)==0);Robert Jacques Wrote:Ahh, there's a workaround: alias Algebraic!(int,void) nint; nint n1=5; assert(n1.get!(int)==5); n1=nint(); //uninitialized Variant, sort of null assert(!n1.hasValue); assert(n1.peek!(int)==null); writeln("error here:"); assert(n1.get!(int)==0);can't assign null alias Algebraic!(int,void) nint; nint n1=5; assert(n1==5); n1=null; \std\variant.d:497: Error: static assert "Cannot store a void* in a VariantN!(maxSize,int,void). Valid types are (int, void)" test.d:45: instantiated from here: opAssign!(void*)Should be Algebraic!(T, void). If that doesn't currently compile, we should make it compile. AndreiFor what it's worth, both Algebraic!(T, void*) and Algebraic!(T, void) compile on my branch of std.variant.
Mar 26 2011