PowerBuilder:确定数据窗口主键

发布于 2024-08-09 16:14:34 字数 82 浏览 1 评论 0原文

我正在 PowerBuilder 中的基本对象(类)中创建一些事件,并且该基本数据窗口的后代需要知道该表(或行)的主键是什么。您如何确定代码中的主键?

I'm creating some events in a base object (class) in PowerBuilder, and the descendent's of this base datawindow need to know what the primary key of that table (or row) is. How would you determine the primary key in code?

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

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

发布评论

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

评论(3

勿忘初心 2024-08-16 16:14:34

您可以迭代数据窗口的列列表,并使用描述或点符号检查键属性:

<DW Control Name>.Describe("<Columnname>.Key")
or
<DW Control Name>.Object.<Columnname>.Key

这可以让您知道该列是否包含在数据窗口画家在菜单项“行”->“更新属性”下看到的突出显示列表中-> 唯一关键列:

以下是有关该属性的文档:

http://infocenter.sybase.com/help/topic/com.sybase.dc37783_1150/html/dwref/CAIBHFGF.htm

You can iterate through the Column list of the datawindow and check the Key property using describe or dot notation:

<DW Control Name>.Describe("<Columnname>.Key")
or
<DW Control Name>.Object.<Columnname>.Key

This lets you know whether the column is included in the highlighted list you see in the datawindow painter under the menu item Rows->Update Properties->Unique Key Columns(s):

Here are the docs on that property:

http://infocenter.sybase.com/help/topic/com.sybase.dc37783_1150/html/dwref/CAIBHFGF.htm

辞旧 2024-08-16 16:14:34

似乎没有一个属性可以通过点符号或隔离主键的描述函数来获取,至少我没有看到一个。我在这里可能是完全错误的,并且有更好的方法来做到这一点。

但我认为如果您尝试在 Powerscript 中执行此操作,则必须扫描数据窗口中的列并检查“columnname.key”属性以确定键中的列。

我希望这也取决于您在数据窗口更新属性中定义了主键列;通常,这些不是由开发人员为只读数据窗口定义的。

如果有人有更好的方法,请留言。

There doesn't appear to be a single property that you can grab via dot notation or the describe function that isolates the primary key, at least I didn't see one. I could be totally wrong here and there's a better way to do it.

But I think if you're trying to do this in Powerscript, you'll have to scan the columns in the datawindow and check the "columnname.key" property to determine the columns in the key.

I expect this is also dependent on you having defined the primary key columns in the datawindow update properties; typically these aren't defined by the developer for read-only datawindows.

If someone has a better way, please post.

瞄了个咪的 2024-08-16 16:14:34

您的对象或代码中有什么需要您知道表的主键是什么?我从 2.0 版本开始就一直使用 Powerbuilder,但我不记得有什么情况需要我知道。

What is there about your objects or code which would require you to know what a table's primary key is?? I have been using Powerbuilder since version 2.0 and I can't ever recall a situation where I would need to know.

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