https://bitbucket.org/vadimtsushko/mongo-dart
It would be possible to write a similar library at this point for sql
databases that provide a socket API. Additionally, we are providing
native-extension support that will allow you to wrap native libraries
in nice dart APIs. We will be posting an article on how to do that in
the near future. That will provide an additional way of providing
access to databases using their C APIs.
Cheers, -- Mads
I initially wrote a synchronous transport as well, but since I think I
was misusing the sockets API it didn't work on Windows, and
continually looping to read data seemed like a bad idea, so I removed
it. It takes some getting used to using chained Futures when accessing
a database, but, except for the stacktrace problem, it isn't too bad
really.
James Ots
I quickly browsed the code and it is looking good. On a quick reading,
the one thing I noticed was that the writing to sockets is a bit
optimistic:
https://github.com/jamesots/sqljocky/blob/master/lib/buffer.dart#L57
https://github.com/jamesots/sqljocky/blob/master/lib/transport/transport_impl.dart#L68
This will most likely break at some point when you cannot write all
the data in one write operation. Maybe add 'assert(written ==
expected)' after each use so you catch it when it breaks? There are a
couple of ways of dealing with this: either use the socket output
stream which will deal with this for you or buffer up data yourself
and hook up an onWrite handler that writes more data when the socket
is ready to deal with more again. The output stream is probably the
simplest.
Thanks again for doing this. It is very nice to see projects like this!
Cheers, -- Mads
James