View mode: basic / threaded / horizontal-split · Log in · Help
August 03, 2011
Re: What library functionality would you most like to see in D?
"Andrej Mitrovic" <andrej.mitrovich@gmail.com> wrote in message 
news:mailman.2068.1312316161.14074.digitalmars-d@puremagic.com...
> There's a win32 curses-like library around afaik. It uses escape codes
> instead of WinAPI calls.
>

Hmm, see that's the problem, the ANSI escape codes don't really exist in 
Win2K+:

http://en.wikipedia.org/wiki/ANSI_escape_code#Windows_and_DOS

Granted, that doesn't cite any sources, unfortunately. But my experience 
porting the download progress bar in DVM to Windows supports what that 
Wikipedia article says. I had to rip out the escape codes and just use 
carriage-return (without line-feed).

Although I suppose it's possible there are non-ANSI escape codes that I'm 
not aware of.

> Btw I've tried using WinAPI for console coloring, it's so damn clumsy
> to use. -_-

I've never used it, but I don't doubt that. The WinAPI can be pretty clumsy 
in general (due in no small part to being so C-centric).
August 03, 2011
Re: What library functionality would you most like to see in D?
On 8/2/2011 7:39 PM, Adam Ruppe wrote:
> Johann MacDonagh wrote:
>> Perhaps we should start taking a look at it,
>> making it "Phobos-like", and create bindings for a set of databases.
>
> In my collection, I have (kinda crappy) implementations of my
> interface for mysql, postgres, sqlite and most recently ODBC.
>
> Since they all use C libs though, I'm not really completely sure
> on if they are license compatible with phobos. And, of course, I'm
> happy with a minimal set of features; I'm happy enough with strings
> since it's better than PHP, so mission accomplished.
>
> (I also have a lot of other code. Check out the readme in my github
> for a listing of many of them.)

Sounds like a good starting point. I've also written some code for 
allowing "LINQ" style queries in D. You'd be able to do something like:

auto x = new SqliteConnection("mydata.db");

foreach(y; x.MyTable.where("someField > 10"))
{
    // y is a wrapper around Variant[string] with some opDispatch magic
    writeln(to!string(y.MyField));
    writeln(to!int(y.SomeOtherField));
}

There were other things you could chain, such as:

x.MyTable.startAt(20).limit(10).where("blah").select("somefield", 
"sometingElse");

You'd also be able to do something like

x.MyTable.select!MyStruct();

which would pull field names out of struct fields, and return a range of 
structs rather than something that has to go through the Variant[string] 
stuff.

It's just a prototype for now, I have a working POC for sqlite3 (however 
it doesn't support the where clause ;) ), but it might be something 
useful for quickly prototyping code that deals with databases.

Would you mind if I take some of your ideas and come up with a proposal 
for the D community to talk about? Then we can discuss licensing issues 
with various databases systems.
August 03, 2011
Re: What library functionality would you most like to see in D?
Johann MacDonagh wrote:
> On 8/2/2011 7:39 PM, Adam Ruppe wrote:
>> Johann MacDonagh wrote:
>>> Perhaps we should start taking a look at it,
>>> making it "Phobos-like", and create bindings for a set of databases.
>>
>> In my collection, I have (kinda crappy) implementations of my
>> interface for mysql, postgres, sqlite and most recently ODBC.
>>
>> Since they all use C libs though, I'm not really completely sure
>> on if they are license compatible with phobos. And, of course, I'm
>> happy with a minimal set of features; I'm happy enough with strings
>> since it's better than PHP, so mission accomplished.
>>
>> (I also have a lot of other code. Check out the readme in my github
>> for a listing of many of them.)
>
> Sounds like a good starting point. I've also written some code for
> allowing "LINQ" style queries in D. You'd be able to do something like:
>
> auto x = new SqliteConnection("mydata.db");
>
> foreach(y; x.MyTable.where("someField > 10"))
> {
> // y is a wrapper around Variant[string] with some opDispatch magic
> writeln(to!string(y.MyField));
> writeln(to!int(y.SomeOtherField));
> }
>
> There were other things you could chain, such as:
>
> x.MyTable.startAt(20).limit(10).where("blah").select("somefield",
> "sometingElse");
>
> You'd also be able to do something like
>
> x.MyTable.select!MyStruct();
>
> which would pull field names out of struct fields, and return a range of
> structs rather than something that has to go through the Variant[string]
> stuff.
>
> It's just a prototype for now, I have a working POC for sqlite3 (however
> it doesn't support the where clause ;) ), but it might be something
> useful for quickly prototyping code that deals with databases.
>
> Would you mind if I take some of your ideas and come up with a proposal
> for the D community to talk about? Then we can discuss licensing issues
> with various databases systems.

Nice! Please also take a look on https://github.com/pszturmaj/ddb.
August 03, 2011
Re: What library functionality would you most like to see in D?
Johann MacDonagh wrote:
> Would you mind if I take some of your ideas and come up with a
> proposal for the D community to talk about?

Of course, go ahead! You might also want to look up Piotr Szturmaj's
database code. He has some nice Postgres code including a D struct ->
db table ORM thingy.
August 03, 2011
Re: What library functionality would you most like to see in D?
On 8/2/2011 8:02 PM, Nick Sabalausky wrote:
>
> I've never used it, but I don't doubt that. The WinAPI can be pretty clumsy
> in general (due in no small part to being so C-centric).
>
>

And backwards compatibility. Nothing like using the BlahExEx() functions ;)
August 03, 2011
Re: What library functionality would you most like to see in D?
On 8/2/2011 8:22 PM, Adam D. Ruppe wrote:
> Johann MacDonagh wrote:
>> Would you mind if I take some of your ideas and come up with a
>> proposal for the D community to talk about?
>
> Of course, go ahead! You might also want to look up Piotr Szturmaj's
> database code. He has some nice Postgres code including a D struct ->
> db table ORM thingy.

Yep, he posted above ;). Do you know of any other database interfaces 
people have been working on?

I'll make this my next priority after porting the D lexer.
August 03, 2011
Re: What library functionality would you most like to see in D?
Johann MacDonagh  wrote:
> Do you know of any other database interfaces people have been working on?

Not off the top of my head.
August 03, 2011
Re: What library functionality would you most like to see in D?
On 8/3/11, Nick Sabalausky <a@a.a> wrote:
> "Andrej Mitrovic" <andrej.mitrovich@gmail.com> wrote in message
> news:mailman.2068.1312316161.14074.digitalmars-d@puremagic.com...
>> There's a win32 curses-like library around afaik. It uses escape codes
>> instead of WinAPI calls.
>>
>
> Hmm, see that's the problem, the ANSI escape codes don't really exist in
> Win2K+:

Yes that's why I said there was a project that brought them back. I
can't recall the name though :/
August 03, 2011
Re: What library functionality would you most like to see in D?
"Andrej Mitrovic" <andrej.mitrovich@gmail.com> wrote in message 
news:mailman.2071.1312335864.14074.digitalmars-d@puremagic.com...
> On 8/3/11, Nick Sabalausky <a@a.a> wrote:
>> "Andrej Mitrovic" <andrej.mitrovich@gmail.com> wrote in message
>> news:mailman.2068.1312316161.14074.digitalmars-d@puremagic.com...
>>> There's a win32 curses-like library around afaik. It uses escape codes
>>> instead of WinAPI calls.
>>>
>>
>> Hmm, see that's the problem, the ANSI escape codes don't really exist in
>> Win2K+:
>
> Yes that's why I said there was a project that brought them back. I
> can't recall the name though :/

Oh, I thought you meant it used them internally.
August 03, 2011
Re: What library functionality would you most like to see in D?
I'll find the damn thing, gimme a day. :p
8 9 10 11 12 13 14 15 16
Top | Discussion index | About this forum | D home