ch04 02


[Chapter 4] 4.2 PL/Vision Package Bundles Chapter 4Getting Started with PL/Vision 4.2 PL/Vision Package BundlesPL/Vision Lite consists of 32 PL/SQL packages. From a conceptual standpoint, the various packages are grouped into three bundles: building blocks, developer utilities, and plug-and-play components. These packages in each of these bundles are summarized in the following sections. Chapter 5, PL/Vision Package Specifications, contains a full summary of all package specifications.NOTE: Some of the packages listed in the following tables are not described in detail in this book. In cases in which neither the package conception nor its implementation offered any additional insights that would help you build your own packages, I elected to omit the discussion from the book. For more details about these packages (indicated by * in the tables), see the PL/Vision Online Reference on the companion disk.4.2.1 Building BlocksThe building block packages provide low-level functionality upon which other packages in PL/Vision are built. You can, of course, also use these building blocks to construct your own applications. Examples of building block packages include an interface to PL/SQL tables, string parsers, a file I/O manager, and a message handling mechanism.Table 4.1: PL/Vision Building Block Packages PackageDescriptionpOffers a feature-rich and minimal-typing substitute for the DBMS_OUTPUT package. PLVTop-level package for PL/Vision. Contains constants and generic utilities for use throughout the library.PLVchrProvides information about single characters in a string. You can display the ASCII codes for characters in a string and perform other operations relating to individual characters.*PLVfileManages operating system file I/O. PLVfile provides a layer of code around the UTL_FILE builtin package and offers some very high-level capabilities, such as a file copy. Use this package only if you are using Oracle Server Release 7.3 and above.PLVioGeneralized input/output package used to both read from and write to repositories for PL/SQL source code. For example, you can use PLVio, via the PLVcase package, to read a program from its operating system file, convert keywords to upper-case, and then store it in the database.PLVlexLexical analysis and parsing package. Recognizes lexical elements of the PL/SQL language and can be used to read one PL/SQL identifier at a time.*PLVlstGeneric list manager for PL/SQL that's built on PL/SQL tables. Following the specification of the LIST package of Oracle Developer/2000, this package provides a comprehensive interface to lists in PL/SQL.*PLVmsgStores standard messages for use in an application. Use this package to consolidate all different kinds of message text with which you can associate a number (such as error number). You can also use PLVmsg to override standard Oracle error messages with your, more application-specific information.PLVobjProgrammatic interface to the ALL_OBJECTS data dictionary view. This package encapsulates logic for specifying and reading source code for a given object. It provides an excellent model for building a package around a view or cursor. PLVobj even implements a kind of dynamic cursor FOR loop through a procedure with the loopexec program.PLVprsPerforms string parsing actions. This is the most generic of the string manipulation packages of PL/Vision.PLVprspsParses PL/SQL source code. You can parse a single string or an entire program unit. The parsed tokens are placed in a PL/SQL table, which can then be used as the basis for further analysis or conversion of the code.PLVstkGeneric stack manager package, built on PLVlst. Provides a full set of operations for both FIFO (first-in-first-out) queues and LIFO (last-in-first-out) stacks.*PLVtabProvides an interface to predefined PL/SQL table structures. Also allows you to easily and flexibly display the contents of PL/SQL tables.PLVtknPackage interface to the PLV_token table, which contains information about tokens, particularly keywords, in the PL/SQL language. Use PLVtkn to determine if an identifier is a keyword or a reserved word, and even the type of keyword (syntax, builtin, symbol, etc.).4.2.2 Developer UtilitiesThe developer utilities of PL/Vision are self-contained utilities that you can use to improve your development environment. Examples of building block packages include a PL/SQL code generator and an online help delivery mechanism for PL/SQL programs.Table 4.2: PL/Vision Developer Utility Packages PackageDescriptionPLVcaseConverts the case of PL/SQL code to the UPPER-lower method. You can convert a single token, a line, a program, or a set of programs.PLVcatCatalogues the contents of PL/SQL code, placing the results in one of two database tables. You can either catalogue the list of elements referenced by a particular program (the PLVrfrnc table) or the list of elements defined in the specification of a package (the PLVctlg table).PLVdddDumps Data Definition Language (DDL) syntax from a particular schema. Allows you to recreate database objects easily in other schemas. You can also use output from PLVddd to compare data structures between schemas or analyze changes over time.*PLVgenGenerates PL/SQL program units and SQL*Plus scripts. This package can greatly improve developer productivity, adherence to coding standards and best practices, and the overall quality of code produced. PLVhlpProvides an architecture by which developers can provide online help for their PL/SQL programs to their (developer) users. Using this package, you can make comment text in your source code available in a structured way to users of your code. PLVtmrAllows you to measure elapsed time of PL/SQL code down to the hundredth of a second. This package offers a programmatic layer around the GET_TIME function of the builtin DBMS_UTILITY package.PLVvuMultifaceted view package. Shows you the errors in a stored object compile, or specified lines of source code from the data dictionary, etc. Offers a convenient substitute for the SHOW ERRORS command of SQL*Plus.4.2.3 Plug-and-Play ComponentsThe most advanced packages in PL/Vision are the plug-and-play components. These packages allow developers to replace whole sections of code with programs from PL/Vision packages. In essence, you plug in PL/Vision code and immediately gain benefits in your application, employing a declarative style of programming in a procedural language. The best example of a PL/Vision plug-and-play component is PLVexc, which provides very high-level exception handling programs.Table 4.3: PL/Vision's Plug-and-Play Packages PackageDescriptionPLVcmtOffers a programmatic interface to the execution of commits, rollbacks, and the setting of savepoints. Gives you more flexibility than calling the corresponding builtins. You can, for example, opt to turn off commits in your application without changing any of your code.PLVdynOffers a high-level interface to the DBMS_SQL builtin package. You can perform many complex operations with a call to a single PLVdyn program. This package is strongly recommended over direct use of the DBMS_SQL builtin packages. PLVdyn1Built upon PLVdyn, this package encapsulates dynamic SQL operations that require single bind variables (PLVdyn does not work with any bind variables). PLVexcGeneric exception-handling package. Instead of writing your own exception handlers, just call one of the PLVexc prebuilt, high-level handlers. Your errors will be displayed or written to the PL/Vision log, as you specify.PLVfkProvides foreign key management, including a single function to perform lookups of foreign keys for any table and any structure. This package can greatly reduce the volume of code you have to write to manage foreign keys. The dynamic SQL in PLVfk works surprisingly quickly.PLVlogThis package provides a generic logging facility for PL/Vision-based applications. With PLVlog, you can write information to a database table, PL/SQL table, operating system file (for PL/SQL Release 2.3 and above), or standard output.PLVrbProvides a programmatic interface to rollback and savepoint processing. Allows you to specify savepoints by variable, instead of hard-coding identifiers in your code. You can also opt to turn off rollbacks in your application without changing any of your code.PLVtrcProvides an execution trace for PL/SQL programs. Mirrors the overloading of the p package to allow you to show different kinds of data. Offers startup and terminate procedures that allows PLVtrc to maintain its own execution call stack.4.1 What Is PL/Vision?4.3 Installation Instructions Copyright (c) 2000 O'Reilly & Associates. All rights reserved.

Wyszukiwarka

Podobne podstrony:
ch04
ch04 (13)
ch04 (2)
ch04
ch04
ch04
ch04
ch04
ch04
ch04 (4)
ch04
ch04
CH04 (11)
ch04
ch04
ch04
ch04
ch04

więcej podobnych podstron