New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
separate connection string parsing from connection #494
Conversation
lib/Connection.php
Outdated
throw new DatabaseException("Empty connection string"); | ||
{ | ||
$connection_info = new ConnectionInfo($connection_info_or_name); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not add in a block that checks if the $connection_info_or_name
is an instance of the ConnectionInfo
class? That way you can pass around the value object directly and it doesn't have to be re-built each time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I'm still not happy with the if/else
logic in this function anyways.
0ffaef0
to
db0009b
Compare
@Rican7 I've updated a lot. In need of some doc-block updates here and there but I think this should be alright. |
{ | ||
return new ConnectionInfo($connection); | ||
} | ||
}, $connections); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oo, nice. Good call on building them here too.
@jpfuentes2 any word on this? |
33a23bb
to
d5cd8ee
Compare
494d55e
to
352e1b6
Compare
parse_str is about 60% faster than custom parsing using foreach loop
sscanf is about 40% faster than using a regex
code formatting
d5cd8ee
to
4507f7f
Compare
add support for connection details as array
Solution for #315
NB this is a pull request to the 1.1-dev branch