[RFC] - mysql-native rewrite
simendsjo
simendsjo at gmail.com
Wed Oct 9 00:06:37 PDT 2013
On Tuesday, 8 October 2013 at 17:47:02 UTC, ollie wrote:
> On Sat, 28 Sep 2013 18:38:47 +0200, simendsjo wrote:
>
>> I've been working on a more or less complete rewrite of the
>> mysql-native module.
>>
>
> I think this is a great first step. Code is more readable,
> easier
> to follow (compared to the pointer stuff in the original).
I removed most of the pointer stuff in my initial cleanup, but
there has still
been plenty of room for improvements.
> Code has some distinctly 64bit parts because Length Encoded
> Integer
> can be as large as 48bits and consume functions use a mix of
> size_t
> and (u)long. Code doesn't compile as is on 32bit machine
> (windows).
> I have changed some (u)longs to size_t and put in some
> cast(size_t) on
> the assumption that on a 32bit machine those values won't
> overflow a
> uint and on 64bit machine the will be (u)long as written. It
> compiles
> and works for some basic queries that I use. This is a hack,
> not a
> solution to the problem.
I might have mixed up some of these I guess.. Using size_t in the
protocol
specific code is probably wrong. I'll have to go through this in
detail.
> Also, the socket reads are asserting because windows reads
> partial
> packets. I change it to read until a full packet is read or an
> error
> or disconnect is returned.
Auch.. Hope this fix solves it once and for all - otherwise there
will probably
be a lot of subtle breakage in the code.
> simendsjo, you have done a great job pushing this forward.
> Would you
> consider putting it on your github account to receive some
> patches?
>
> ollie
https://github.com/simendsjo/mysqln
I think the only thing I changed from the upload is bugfixes in
parameter
binding and added a couple of integration tests. I would have
hoped to solve
a lot of these things before uploading the code, but if you wish
to contribute,
I'm not going to stop you :)
There is still plenty to do though (some has been raised in this
thread):
o 32-bit support
o Windows support
(and OSX and FreeBSD)
o Documentation
o Examples
o Unittests
o More integration tests
o Implement stored procedures
(and replication..?)
o SSL
o Remove type special handling (TINYINT(1) -> bool and perhaps
others)
o Range interface for COM_QUERY and COM_STMT_EXECUTE that returns
results.
o .. Which means ResultSet also needs a range interface and some
way to
construct it by taking all raws eagerly. I'm thinking
"queryLazy" vs "query".
o COM_QUERY and COM_STMT_EXECUTE should be classes with close()
methods to stop
the execution. This will probably mean we need some data
purging or
something, and it has to be an error to start a new command
before a previous
has finished.
o Rewrite parameter binding code - it is very ugly and hard to
understand.
The old way was to store Variants and use typeid.toString to
find out how to
bind the parameter. I've rewritten this to store the parameter
in a packet
right away so it works with literals, const etc. The code is
very ugly
though. See packets.ComStmtPrepare
o There are stuff I haven't figured out in the prepared
statements yet.
Cursors and new_params_bound comes to mind.
o There might be unused functions in packet_helpers, but I'd like
full
integration-tests before removing anything.
o .. And probably many other stuff
More information about the Digitalmars-d
mailing list