获取 Powerbuilder 数据库连接的 spid?

发布于 2024-08-03 06:31:22 字数 206 浏览 3 评论 0原文

我一直试图找到一些关于这方面的手册信息,但我的搜索没有结果。

我正在尝试查看是否有一种方法可以找到从 Powerbuilder 到数据库的连接的唯一 spid(来自 sp_who)。

例如,用户登录,我可以看到他们的 sp_who 记录,但我希望能够在应用程序本身中获取和操作这个 id。

(这可能很简单。免费代表,pb 专家!)

I've been trying to find some manual information on this, but my search is fruitless.

I'm trying to see if there is a way to find the unique spid (from sp_who) of a connection into a database from Powerbuilder.

As in, a user logs in, and I can see their sp_who record, but I want to be able to obtain and manipulate this id in the application itself.

(This is probably an easy one. Free rep, pb experts!)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

忘你却要生生世世 2024-08-10 06:31:22

好吧,今天早上再次尝试谷歌搜索(并得到这个问题作为第一个结果:p)后,我发现实际上有一个我可以调用的 @@SPID 变量。

我所做的是创建一个过程,

create procedure prc_get_spid
as
begin
return @@spid
end

然后在我的应用程序中我只需执行该过程

long ll_spid
ll_spid = sqlca.prc_get_spid()

即可为我提供 sqlca 连接的 spid。

^_^

Well, after trying to google this again this morning (and getting this question as the first result :p) I've found that there's actually a @@SPID variable that I can call.

What I've done is create a procedure

create procedure prc_get_spid
as
begin
return @@spid
end

then in my application I just go

long ll_spid
ll_spid = sqlca.prc_get_spid()

which gives me the spid for the sqlca connection.

^_^

燕归巢 2024-08-10 06:31:22

无需创建存储过程即可访问 SPID 的另一种方法是从派生表中访问它,如下所示。

SELECT ses.SPID
INTO :SPID
FROM (SELECT SPID = @@SPID) AS ses
USING SQLCA;

Another way of accessing the SPID without creating a stored procedure is access it from within a derived table as shown below.

SELECT ses.SPID
INTO :SPID
FROM (SELECT SPID = @@SPID) AS ses
USING SQLCA;
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文