On Saturday, 28 September 2013 at 16:39:27 UTC, simendsjo wrote:
I've been working on a more or less complete rewrite of the
mysql-native module.
The main focus has been on making the source better decoupled
and more maintainable.
In the process, I've changed the API too...
The existing production code can be found here:
https://github.com/rejectedsoftware/mysql-native
New code:
http://simendsjo.me/files/simendsjo/mysqln-rewrite/mysqln-rewrite.7z
Documentation:
http://simendsjo.me/files/simendsjo/mysqln-rewrite/docs/
The files:
* adhoc.d - Execute simple queries. This is meant to be the new
high-level public API
* commands.d - Lower level public API
* result.d - Common interface for both Text and Binary MySQL
results
* connection.d - Phobos/Vibe.d connection
* db.d - Vibe.d connection pool
The rest are just internal files.
Todo:
* Implement all MySQL types
* Prepared statement release/purge
* Lazily fetch data
* Fix bugs in prepared statement binding
* Implement SEND_LONG_DATA
* More integrationtests and unittests
Most of the above would be pretty simple to implement.
I'm very uncertain about several aspects of my design:
* Class vs. struct
* Returned values from MySQL - e.g. should SELECT TRUE return
long as it does in MySQL, or should we interpret it as bool
* Probably a lot I don't remember right now :)
Any comments would be very helpful.
..Or in D terms: DESTROY!
It would be nice, if someone with experience wrote a short
article / tutorial about when to use structs and when to use
classes, where the pitfalls are etc. It is not always easy to
decide and a rough guide would be great. As of now I'm using
structs and ranges only for reformatting input. I'm not sure,
however, if it is a good idea to go beyond this (cf. different
reference semantics, polymorphism etc.)