Skip to content

Update#2

Merged
manuel-rubio merged 97 commits intoaltenwald:masterfrom
Eonblast:master
Apr 14, 2015
Merged

Update#2
manuel-rubio merged 97 commits intoaltenwald:masterfrom
Eonblast:master

Conversation

@manuel-rubio
Copy link
Copy Markdown
Member

No description provided.

choptastic and others added 30 commits September 13, 2013 20:31
In a handful of places in emysql_util, there were a few calls to
emysql_util:do_something(), I just removed the extraneous emysql_util:
prefixes.
All in the name of not requiring the programmer to include the
emysql.hrl file.
This is just done to make the calls more consistent. Previously, in some
places, it was is_record(result_packet), and in others it was
Res = #result_packet. This just makes all calls in util consistent.

Also, I fixed the ordering of the previously introduced functions
insert_id/1 and affected_rows/1, which were originally put in the
-export without being alphabetical. So I made them alphabetical.
This is a more straightforward way for a user to determine the packet
type, rather than having to do element(1, Packet).
Perhaps there was a performance reason for doing
array:to_list(array:new(length(FieldNames))), but in my non-scientific
benchmarks, it appeared to mostly (but only marginally) faster to use
lists:duplicate, and frankly, I think it's a little clearer what's going
on with lists:duplicate, since it's a single function call rather than
having to know that a new empty array of size X will return a list of X
undefined atoms from array:to_list.
Improve performance when retrieving large blobs
Relevant changes:

.gitignore: Made so the autogenerated crypto_compat.hrl file is not
included in source control. It should be ignored because of its
autogenerated nature

Makefile: Add `make crypto_compat` rule, and make sure it runs before
compiling the modules.

rebar.config: Added so that apps that use rebar for dependencies can
take advantage of Rebar's pre_hooks capability

emysql_auth: Modified the password generation to use the generated
Macros instead of straight calls.

support/crypto_compat.escript: The script that generates the
include/crypto_compat.hrl file.

Also fix "can never match" error found by dialyzer.

emysql_tcp:response returns {Packet, Status, Buff}, whereas line 61 of
emysql_auth was trying to match against {{Packet}, _}, Buff}, an
incompatible match.

In this case, Packet was an #error_packet{} record.
There are two changes here:

1. Associate a connect timeout for a pool

2. Add add_pool/2, which uses the arg + options API convention in Erlang

== Connect timeout

To reasonably support connect problems, the module must support a configurable
connect timeout, which is used in gen_tcp:connect/3. This can now be
specified using add_pool/2. add_pool/8, and add_pool/9 use the atom infinity,
which results in the original connect behvior -- i.e. this is a backward
compatible change.

== add_pool/2

The eight+ argument add_pool function is a complete PITA to use and is not
easily enhanced - it should have been done away with a long time ago in
favor of add_pool/2, which uses required arg + options list to manage the
complexity of the API. add_pool/2 requires the pool ID, but uses sensible
defaults for all other values.

To stop the madness, I'm not exporting add_pool/10 (which does the work in
this implementation). If someone needs a connect timeout, he/she should use
add_pool/2. I'd like to see the doc updated to use add_pool/2, but won't
presume to do this. We could export add_pool/10, but really, does the world
need another add_pool arity?
jkingsbery and others added 28 commits March 9, 2014 22:32
Fix formatting, code errors and indentation in README
Adding type specs to emysql.hrl
Add collation support for connection
Added types for the other records in emysql.hrl
Adds an option to fetch and log warnings
Fix a typespec error for Erlang 17 of dict() becoming dict:dict()
manuel-rubio added a commit that referenced this pull request Apr 14, 2015
@manuel-rubio manuel-rubio merged commit 3385281 into altenwald:master Apr 14, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants