database icon indicating copy to clipboard operation
database copied to clipboard

A configuration parameter missing in the examples.

Open magnus-eriksson opened this issue 8 years ago • 4 comments

I just noticed that the configuration examples in the doc for MySQL are missing the database-parameter for creating a connection. :)

magnus-eriksson avatar Mar 15 '16 09:03 magnus-eriksson

That shouldn't be a problem - by design the component works across schemas.

Cheers Joe Green

On 15 Mar 2016, at 09:30, Magnus Eriksson [email protected] wrote:

I just noticed that the configuration examples for MySQL are missing the database-parameter when creating a connection. :)

— You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/mrjgreen/database/issues/3

mrjgreen avatar Mar 15 '16 18:03 mrjgreen

Well, it doesn't work for the MySqlConnector.

I was struggling with this issue for little while and didn't get it until I stepped through the code with my debugger. I think it would help a lot to mention it.

dotnetCarpenter avatar May 05 '17 12:05 dotnetCarpenter

You can add the schema in the table() call: $connection->table('databaseName.tableName') or like you usually do in the query: $connection->query('SELECT * FROM databaseName.tableName'). But I agree that this is not well documented, though.

magnus-eriksson avatar May 05 '17 13:05 magnus-eriksson

Makes sense, I'll update the docs. However, I do think its good practice to fully qualify table names to avoid ambiguity, and connecting to a "default" schema can sometimes cause confusion.

Its been a while since I've only been dealing with a single schema though, and I understand thats not necessarily the case for everyone.

mrjgreen avatar May 07 '17 15:05 mrjgreen