I agree that the application should do the locking, but if you're
going to remove all the auto locking, might it be better to just
remove the Mutex from Client altogether? (Also, in the example you've
given, the application will want to pull the full result off the wire
before unlocking.)
A few other comments on the interface:
It would be nice if there were a way to fetch the entire slice of rows
from a stored result. Right now if I want to iterate over the rows
more than once, I have to make my own slice and copy each result as I
fetch it.
Another complaint I have is that I don't know what errors I should be
looking at. There are functions that return an os.Error, but then
inside Client there's Errno and Error, which give the actual errors
from the server. I'd like some consistency here. Maybe there could be
some kind of mysql.ServerError type that represents an error from the
server and contains Error and Errno, and then Client's fields by the
same name can go away. Other ideas?
- Evan
- Evan
On Tue, Feb 8, 2011 at 4:03 PM, Phil Bayfield <ph...@bayfmail.com> wrote:I agree that the application should do the locking, but if you're
> - Removed mutex lock/unlocking, as it is now more appropriate that the
> application decides when thread safe functions are required and it's
> considerably safer to have a sequence such as Client.Lock(),
> Client.Query(...), Client.Unlock().
going to remove all the auto locking, might it be better to just
remove the Mutex from Client altogether? (Also, in the example you've
given, the application will want to pull the full result off the wire
before unlocking.)
A few other comments on the interface:
It would be nice if there were a way to fetch the entire slice of rows
from a stored result. Right now if I want to iterate over the rows
more than once, I have to make my own slice and copy each result as I
fetch it.
Another complaint I have is that I don't know what errors I should be
looking at. There are functions that return an os.Error, but then
inside Client there's Errno and Error, which give the actual errors
from the server. I'd like some consistency here. Maybe there could be
some kind of mysql.ServerError type that represents an error from the
server and contains Error and Errno, and then Client's fields by the
same name can go away. Other ideas?
- Evan
- Evan
--
You received this message because you are subscribed to the Google Groups "GoMySQL" group.
To post to this group, send email to gom...@googlegroups.com.
To unsubscribe from this group, send email to gomysql+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/gomysql?hl=en.
On Tue, Feb 8, 2011 at 10:16 PM, Phil Bayfield <ph...@bayfmail.com> wrote:
> This was a very last minute change, so not really thought a great deal about
> it yet. I realised that when using auto reconnect something like this was
> happening:
> ...
> Which is absolutely no good for thread safety, if we have another thread
> waiting for a lock, it would gain the lock while the current thread is in
> the middle of something.
Right, with the way querying works now building locking into Client is
just asking for trouble (IMO).
> With the previous client I ran into the problem that I had more errors than
> were provided in the MySQL error list, however in reality these errors are
> probably more useful to me for debugging than the average programmer using
> the library and I've been meaning to clean it up a bit. The public
> Errno/Error properties are inherited from the previous version, but the
> returned error from the client could be better and match it. There should
> probably be 2 error types, ClientError which contains error codes in the 2k
> range and ServerError which contains codes in the 1k range, this is the
> format used by MySQL.
Sounds good. This would help me for sure.
One more thing I meant to mention is all the exported constants that
applications don't need access to. Any problems with prefixing them
with an underscore or otherwise making them not exported?
- Evan
I just reread my email through the quotes and realized it could come
off as a little obnoxious, so I apologize if it did. I didn't mean it
to.
> ...
On Tue, Feb 8, 2011 at 10:16 PM, Phil Bayfield <ph...@bayfmail.com> wrote:
> This was a very last minute change, so not really thought a great deal about
> it yet. I realised that when using auto reconnect something like this was
> happening:
> Which is absolutely no good for thread safety, if we have another threadRight, with the way querying works now building locking into Client is
> waiting for a lock, it would gain the lock while the current thread is in
> the middle of something.
just asking for trouble (IMO).
Sounds good. This would help me for sure.
> With the previous client I ran into the problem that I had more errors than
> were provided in the MySQL error list, however in reality these errors are
> probably more useful to me for debugging than the average programmer using
> the library and I've been meaning to clean it up a bit. The public
> Errno/Error properties are inherited from the previous version, but the
> returned error from the client could be better and match it. There should
> probably be 2 error types, ClientError which contains error codes in the 2k
> range and ServerError which contains codes in the 1k range, this is the
> format used by MySQL.
One more thing I meant to mention is all the exported constants that
applications don't need access to. Any problems with prefixing them
with an underscore or otherwise making them not exported?