根据用户登录名自动过滤记录? [英] automatically filter records based on a userlogin name??

查看:54
本文介绍了根据用户登录名自动过滤记录?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,对MySQL来说还是个新手。我是

想知道是否有办法根据mysql用户登录名自动过滤

记录?


我有为了更有效地管理数据库,我想要组合几个数据库




- 我正在使用MySQL 4.1.12和我'我目前正在测试5.0.14

- 我有一个每个用户帐户的数据库。

- 每个数据库都有相同的模式和实体关系模型。

- 我必须通过各种连接提供对数据库的原始访问(odbc,mysql客户端)


例如,当用户登录时,通过任何应用程序/ odbc连接/

mysql utiltiy,MySQL服务器设置变量DatabaseAccount = $ loginusername,

其中DatabaseAccount是所有表中的表列。服务器

只返回与DatabaseAccount名称匹配的记录。


我认为这将是命名空间,但我确实搜索了mysql数据库命名空间<在谷歌的
和一堆.Net的东西回来了。


感谢您的时间,

Matt

解决方案

loginusername,

其中DatabaseAccount是所有表中的表列。服务器

只返回与DatabaseAccount名称匹配的记录。


我认为这将是命名空间,但我确实搜索了mysql数据库命名空间<在谷歌的
和一堆.Net的东西回来了。


感谢您的时间,

Matt


您好,


您可以使用存储过程执行此操作。使用''select user()'',您可以查询已登录用户的
。您可以例如设置一个参考表,用户

可以选择哪一组数据并用准备好的语句设置一个查询,

你在哪里组建部件。


也许这听起来有点复杂,如果你需要一些更详细的帮助 -

这可能是我在博客上写的一个很好的例子;-)。


Markus


Markus Popp写道:



您可以使用存储过程执行此操作。使用''select user()'',您可以查询已登录的用户。您可以例如设置一个参考表,用户可以选择哪一组数据并用准备好的语句设置查询,
你在哪里组建部件。

也许这听起来有点复杂,如果你需要一些更详细的帮助 -
这可能是一个很好的例子,我可以写在我的博客;-)。

Markus



我想我们必须设置一个触发器来检测SELECT,INSERT

UPDATE和DELETE语句并运行进一步过滤的存储过程

返回的结果(如果有的话)。如果在数据库核心中内置了这样一个功能,那将会很酷。


我期待着阅读你的博客Markus。我认为这将是一个整洁的

小写。


谢谢,

马特


Hi everyone, still pretty new to MySQL. I was
wondering if there is a way to automatically filter
records based on a mysql userlogin name??

I have serveral databases that I want to combine
in order to manage the databases more efficiently.

- I''m currently using MySQL 4.1.12 and I''m currently testing 5.0.14
- I have a databases for each user account.
- Each database has the same schema and entity relation model.
- I have to provide raw access to the database via various connections (odbc, mysql clients)

Example, when the user logs in, via any applicaition/odbc connection/
mysql utiltiy, MySQL server sets a variable DatabaseAccount=$loginusername,
where DatabaseAccount is a table column in all the tables. The server
only returns records that match the DatabaseAccount name.

I think this would be a namespace but I did search for "mysql database namespace"
in google and got a bunch of .Net stuff back.

Thanks for your time,
Matt

解决方案

loginusername,
where DatabaseAccount is a table column in all the tables. The server
only returns records that match the DatabaseAccount name.

I think this would be a namespace but I did search for "mysql database namespace"
in google and got a bunch of .Net stuff back.

Thanks for your time,
Matt


Hi,

you can do this with a stored procedure. With ''select user()'' you can query
the user who''s logged in. You can e.g. set up a reference table, which user
can select which set of data and set up a query with a prepared statement,
where you build the parts together.

Maybe this sounds a bit complicated, if you need some more detailed help -
this could be a nice example that I could write about in my weblog ;-).

Markus


Markus Popp wrote:

Hi,

you can do this with a stored procedure. With ''select user()'' you can query
the user who''s logged in. You can e.g. set up a reference table, which user
can select which set of data and set up a query with a prepared statement,
where you build the parts together.

Maybe this sounds a bit complicated, if you need some more detailed help -
this could be a nice example that I could write about in my weblog ;-).

Markus



I suppose we would have to setup a Trigger to detects SELECT, INSERT
UPDATE and DELETE statements and run the Stored Procedure that further filters
the returned results, if any. It would be cool if such a feature where
built into the database core.

I look forward to reading your blog Markus. I think it would be a neat
little write up.

Thanks,
Matt


这篇关于根据用户登录名自动过滤记录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆