Calling PeopleTools APIs 调用PeopleTools API

本文介绍了如何在应用程序引擎中调用PeopleToolsAPI,包括注意事项如数据保存时机、错误处理和性能优化策略,如使用CommitWork函数、PeopleCode示例以及避免SQL性能瓶颈的方法。
Calling PeopleTools APIs
调用PeopleTools API

You can call all of the PeopleTools APIs from an Application Engine program. When using APIs, remember that:

您可以从应用程序引擎程序调用所有PeopleTools API。使用API时,请记住:

  • All the PeopleTools APIs contain a Save method.
  • 所有PeopleTools API都包含一个Save方法。

However, when you call an API from your Application Engine program, regardless of the Save method of the API, the data is not saved until the Application Engine program issues a commit.

但是,当您从应用程序引擎程序调用API时,无论API的Save方法如何,数据都不会保存,直到应用程序引擎程序发出提交。

  • If you called a component interface from an Application Engine program, all the errors related to the API are logged in the PSMessage collection associated with the current session object.
  • 如果您从应用程序引擎程序调用组件接口,所有与API相关的错误都会记录在与当前会话对象关联的PSMessage集合中。
  • If you sent a message, errors are written to the message log and the Application Engine message log.
  • 如果您发送了消息,错误将写入消息日志和应用程序引擎消息日志。
  • If an Application Engine program called from a message subscription PeopleCode encounters errors and the program exits (with Exit (1)), the error is written to the message log and is marked as an error
  • 如果从消息订阅PeopleCode调用的应用程序引擎程序遇到错误并且程序退出(使用Exit(1)),则错误将写入消息日志并标记为错误
Using the CommitWork Function
使用CommitWork函数

This function commits pending changes (inserts, updates, and deletes) to the database. When using CommitWork, remember that:

此函数向数据库提交挂起的更改(插入、更新和删除)。使用Commit Work时,请记住:

  • This function can be used only in an Application Engine program that has restart disabled.
  • 此功能只能在已禁用重新启动的应用程序引擎程序中使用。
  • The CommitWork function is useful only when you are processing SQL one row at a time in a single PeopleCode program, and you need to commit without exiting the program.
  • CommitWork函数只有当您在单个PeopleCode程序中一次处理一行SQL,并且您需要在不退出程序的情况下提交时才有用。

In a typical Application Engine program, SQL commands are split between multiple Application Engine actions that fetch, insert, update, or delete application data. You use the section or step level commit settings to manage the commits.

在典型的应用程序引擎程序中,SQL命令在多个获取、插入、更新或删除应用程序数据的应用程序引擎操作之间拆分。使用节或步骤级别提交设置来管理提交。

Related Links

“CommitWork” (PeopleCode Language Reference)

相关链接"CommitWork"(PeopleCode语言参考)

Calling WINWORD Mail Merge

调用WINWORD邮件合并

If the Process Scheduler is booted using a shared drive on another machine and you intend to call a WINWORD mail merge process from Application Engine, then you must do one of the following to ensure successful completion:

如果进程计划程序是使用另一台计算机上的共享驱动器启动的,并且您打算从应用程序引擎调用WINWORD邮件合并进程,则必须执行以下操作之一以确保成功完成:

  1. Configure the Process Scheduler to run Application Engine programs using psae instead ofpsaesrv.

将进程调度程序配置为使用psae而不是psae srv运行应用程序引擎程序。

  1. Ensure the generated document is saved locally, not on a shared network drive.

确保生成的文档保存在本地,而不是共享的网络驱动器上。

Using PeopleCode Examples 使用PeopleCode示例

The following topics provide examples of common ways that you can use PeopleCode within Application Engine programs.

以下主题提供了在应用程序引擎程序中使用PeopleCode的常用方法的示例。

Do When Actions

Do When 操作

Instead of a Do When action that checks a %BIND value, you can use PeopleCode to perform the equivalent operation. For example, suppose the following SQL exists in your program:

与检查%BIND值的Do When操作不同,您可以使用PeopleCode执行等效的操作。例如,假设您的程序中存在以下SQL:

%SELECT(EXISTS) SELECT 'Y' FROM PS_INSTALLATION WHERE %BIND(TYPE) = 'X'),

Using PeopleCode, you could insert this code:

使用PeopleCode,您可以插入以下代码:

If TYPE = 'X' Then

   Exit(0);

Else

   Exit(1);

End-if;

If you set the On Return parameter on the PeopleCode action properties to Skip Step, this code behaves the same as the Do When action. The advantage of using PeopleCode is that no trip to the database occurs.

如果将PeopleCode操作属性上的On Return参数设置为Skip Step,则此代码的行为与Do When操作相同。使用PeopleCode的优点是不会发生对数据库的访问。

Dynamic SQL

动态SQL

If you have a Select statement that populates a text field with dynamic SQL, such as the following:

如果您有一个Select语句,该语句使用动态SQL填充文本字段,如下所示:

%SELECT(AE_WHERE1)

SELECT 'AND ACCOUNTING_DT  <= %Bind(ASOF_DATE)'

You can use this PeopleCode:

您可以使用此PeopleCode:

AE_WHERE1 = "AND ACCOUNTING_DT  <= %Bind(ASOF_DATE)";

Sequence Numbering

序列编号

If you typically use Select statements to increment a sequence number inside of a Do Select, While, or Until loop, you can use the following PeopleCode instead:

如果您通常使用Select语句在Do Select、While或Until循环内递增序列号,则可以改为使用以下PeopleCode:

SEQ_NBR = SEQ_NBR + 1;

Using PeopleCode rather than SQL can affect performance significantly. Because the sequencing task occurs repeatedly inside a loop, the cost of using a SQL statement to increment the counter increases with the volume of transactions your program processes. When you are modifying a program to take advantage of PeopleCode, the areas of logic you should consider are those that start with steps that run inside a loop.

使用PeopleCode而不是SQL会显著影响性能。因为定序工作在循环内重复发生,所以使用SQL陈述式递增计数器的成本会随程式处理的交易量而增加。当您修改程序以利用PeopleCode时,您应该考虑的逻辑区域是那些以在循环中运行的步骤开始的逻辑区域。

Note: You can also use the meta-SQL constructs %Next and %Previous when performing sequence numbering. These constructs may improve performance in both PeopleCode and SQL calls.

附注:您还可以使用元SQL构造%执行序列编号时,选择Next和%Previous。这些构造可以提高PeopleCode和SQL调用的性能。

Rowsets

行集

You can use rowsets in Application Engine PeopleCode; however, using rowsets means you will be using PeopleCode to handle more complicated processing, which degrades performance.

您可以在应用程序引擎PeopleCode中使用行集;但是,使用行集意味着您将使用PeopleCode处理更复杂的处理,这会降低性能。

内容概要:本文档是一份关于交换路由配置的学习笔记,系统地介绍了网络设备的远程管理、交换机与路由器的核心配置技术。内容涵盖Telnet、SSH、Console三种远程控制方式的配置方法;详细讲解了VLAN划分原理及Access、Trunk、Hybrid端口的工作机制,以及端口镜像、端口汇聚、端口隔离等交换技术;深入解析了STP、MSTP、RSTP生成树协议的作用与配置步骤;在路由部分,涵盖了IP地址配置、DHCP服务部署(接口池与全局池)、NAT转换(静态与动态)、静态路由、RIP与OSPF动态路由协议的配置,并介绍了策略路由和ACL访问控制列表的应用;最后简要说明了华为防火墙的安全区域划分与基本安全策略配置。; 适合人群:具备一定网络基础知识,从事网络工程、运维或相关技术岗位1-3年的技术人员,以及准备参加HCIA/CCNA等认证考试的学习者。; 使用场景及目标:①掌握企业网络中常见的交换与路由配置技能,提升实际操作能力;②理解VLAN、STP、OSPF、NAT、ACL等核心技术原理并能独立完成中小型网络搭建与调试;③通过命令示例熟悉华为设备CLI配置逻辑,为项目实施和故障排查提供参考。; 阅读建议:此笔记以实用配置为主,建议结合模拟器(如eNSP或Packet Tracer)动手实践每一条命令,对照拓扑理解数据流向,重点关注VLAN间通信、路由选择机制、安全策略控制等关键环节,并注意不同设备型号间的命令差异。
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值