Is there a manner to add something like a where clause as a ‘global’ parameter for a mysql session.
For example an company has multiple user and you want to query for the user in this company, normally you would use a statement like:
SELECT * FROM users WHERE users.companyId = 2;
The issue is that adding the WHERE clauses would mean a huge impact on the code. Though, we defined the relations and thus I image (though, I don’t think it exists), that you could create a session with the “global” constrained that all queries in that session should comply to.
You can create a view
If slowness is your curse, there are a few things you can do:
wherefield(s) in this case companyid.memory table, and usehashindexes for=andINfields.See: http://dev.mysql.com/doc/refman/5.0/en/create-view.html
http://dev.mysql.com/doc/refman/5.5/en/index-btree-hash.html
http://dev.mysql.com/doc/refman/5.0/en/memory-storage-engine.html
http://dev.mysql.com/doc/refman/5.1/en/partitioning.html