可以在 EGL 文件中声明库部件,EGL 源格式对该部件作了描述。
Library CustomerLib3 // Use declarations Use StatusLib; // Data Declarations exceptionId ExceptionId ; // Retrieve one customer for an email // In: customer, with emailAddress set // Out: customer, status Function getCustomerByEmail ( customer CustomerForEmail, status int ) status = StatusLib.success; try get customer ; onException exceptionId = "getCustomerByEmail" ; status = sqlCode ; end commit(); end // Retrieve one customer for a customer ID // In: customer, with customer ID set // Out: customer, status Function getCustomerByCustomerId ( customer Customer, status int ) status = StatusLib.success; try get customer ; onException exceptionId = "getCustomerByCusomerId" ; status = sqlCode ; end commit(); end // Retrieve multiple customers for an email // In: startId // Out: customers, status Function getCustomersByCustomerId ( startId CustomerId, customers Customer[], status int ) status = StatusLib.success; try get customers usingKeys startId ; onException exceptionId = "getCustomerForEmail" ; status = sqlCode ; end commit(); end end
库部件的图如下所示:
有关其它规则,请参阅命名约定。
在缺省情况下,该库的类型为 basicLibrary。
所有属性都是可选的:
Record aRecordPart type basicRecord 10 myItem01 CHAR(5); 10 myItem02 CHAR(5); end
myRecord aRecordPart;
myValue = myRecord.myItem01;
myValue = myItem01;
建议您接受缺省值,这样有助于实现最佳实践。通过指定容器名,可以减少对阅读代码的人以及对 EGL 造成的歧义。
EGL 使用一组规则来确定变量名或项名所引用的内存区域。有关详细信息,请参阅对变量和常量的引用。
现在对 callingConvention 可用的唯一值是 I4GL。有关其它详细信息,请参阅类型为 nativeLibrary 的库部件。
有关其它详细信息,请参阅类型为 nativeLibrary 的库部件。
有关其它详细信息,请参阅 VGVar.handleHardIOErrors 和异常处理。
如果该库正在使用不在库中的共享函数,则仅当将属性 includeReferencedFunctions 设置为 yes 时才有可能进行生成。
如果指定 no,则标识在整个运行单元中共享。在调用库中的 SQL 语句时创建的标识在调用该库的其它代码中是可用的,尽管其它代码可使用 localSQLScope = yes 来阻止访问这些标识。而且,该库可以引用在调用程序或 pageHandler 中创建的标识,但仅当与 SQL 有关的语句已经在其它代码中运行并且其它代码没有阻止访问时才会如此。
在任一情况下,在程序或 pageHandler 访问该库时可用的标识在同一程序或 pageHandler 访问同一个库中的同一函数或另一函数时也是可用的。
不能对类型为 nativeLibrary 的库中的函数指定 private。
该部件作为格式模型,如 Typedef 所述。
该部件作为格式模型,如 Typedef 所述。
基本记录不具有属性。