有没有办法在sqlite3中找到当前登录操作系统的用户?

时间:2016-04-13 15:49:26

标签: sqlite

例如,在DB2中有一个“用户”,它将为您提供登录和执行查询的人员。不,没有“登录到DB2”我只登录一次以访问整个操作系统(IBM i 7.1)。

declare global temporary table XYZ ( DUMMY char(1)) Table XYZ created in QTEMP. insert into XYZ values('1') 1 rows inserted in XYZ in QTEMP. select user from XYZ

输出:

....+....1....+... USER "my-login-user-id-is-shown-here" ******** End of data ********

在sqlite3中:

SQLite version 3.11.1 2016-03-03 16:17:53
Enter ".help" for usage hints.
sqlite> create temporary table XYZ (DUMMY char(1));
sqlite> insert into XYZ values('1')
   ...> ;
sqlite> select user from XYZ;
Error: no such column: user
sqlite>

提前致谢!

2 个答案:

答案 0 :(得分:0)

SQLite是一个基于文件的数据库;它既不关心也不了解OS用户。

答案 1 :(得分:0)

I tried this (running sqlite from the unix shell) and found it to be an acceptable solution, but I will like to be able to do the same from within the sqlite command shell.

% sqlite3 test.db "select * from NADA where UZER='$USER';"
-- Loading resources from /home/<my-userid>/.sqliterc

UZER                DINERO    
----------              ----------
<my-userid>      117.41