RE: Is select_db necessary?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



[snip]
Jay Blanchard wrote:
> [snip]
> Is the database selection necessary, or is that implied with a SELECT
or
> other SQL command?
> [/snip]
> 
> It depends on the database (as you have seen in many of the
responses),
> but there is a way to keep from doing this if the database is ANSI
> compliant using proper SQL syntax;
> 
> SELECT a.foo, a.bar
> FROM myDatabase.myTable a
> WHERE you set other conditions here
> 
> All that is required is that you establish a connection to a server.

If I recall correctly, this will cause issues with replication in 
MySQL... insofar as you perform amodifying query.
[/snip]

You're correct with regards to queries that modify on replicated
systems. If all you're doing is gathering data then this will work just
fine, is somewhat self-documenting (especially in lengthier code
containers), and very flexible. It also leaves the selection in the
database's hands, and as we almost always say, "let the database do the
work when it can".

If you are not using replicated systems you can set up your modifying
queries the same way.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux