MySQL Forums
Forum List  »  General

Partial updates
Posted by: antonio
Date: September 19, 2006 09:58AM

I want to use views to fake user tables in several web applications. So I'd want to partial update just some fields of the view.

Imagine I have the following tables:

users
+----+-------+------+-----------------+
| id | login | name | organization_id |
+----+-------+------+-----------------+

organizations
+----+------+------------+
| id | name | maildomain |
+----+------+------------+

webapp_options
+---------+-----------------
| user_id | many_options...
+---------+-----------------

I create the following view, in order to fake the web application users table:

CREATE VIEW fake_users AS SELECT users.id AS id, users.name AS name, CONCAT(users.login, '@', organizations.maildomain) AS email, app_options.many_options AS many_options WHERE users.id = app_options.user_id AND users.organization_id = organizations.id;

An update on fake_users would work if `email` field is identical, changing app_options. But it would fail if the user tries to change his email, because it is fixed.

What do you think about this idea?

Options: ReplyQuote


Subject
Written By
Posted
Partial updates
September 19, 2006 09:58AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.