📄 get_started.htm
字号:
<HTML>
<HEAD>
<TITLE>PL/Generator Getting Started</TITLE>
</HEAD>
<BODY bgcolor="white" background="bar_products.gif">
<table border=0 cellspacing=0 cellpadding=0 valign=top width=750>
<tr><td width="51" valign=top>
<br>
<td valign="top" width="699">
<IMG SRC="generator.gif" WIDTH=285 HEIGHT=48>
<br>
<hr>
<P>
<B><FONT SIZE=4>Part 3. Getting Started with PL/Generator</FONT>
</B><P><b><font size="4">NOTE: This page needs to be updated. You do NOT have
access to the PL/Generator interface in the free version. You WILL on the other
hand want to set many of the same characteristics listed below; you will simply
need to do so through the <a href="Generator_API.htm">API</a>. </font></b>
<P>
<A HREF="#Required"><FONT SIZE=2>Required Settings for Success</FONT></A><BR>
<A HREF="#Browsing"><FONT SIZE=2>Browsing Schemas</FONT></A><BR>
<A HREF="#Setting"><FONT SIZE=2>Setting Code Characteristics</FONT></A>
<P>
<HR>
<P>
You can now start using PL/Generator. To access the screen interface, click on the Start button on the bottom right of your screen, then select Program, Quest Software, PLGenerator and, finally, the PLGenerator Interface menu item.
<P>
You will then be prompted to log in to Oracle. Log in to the account from which you want to generate code. You can connect to a local database or to a remote database (in which case you will need to specify the database connection information.
<P>
You will then see the startup screen for PL/Generator, as shown in Figure 1.
<P>
<I><FONT SIZE=2><A HREF="Image2.jpg">Figure 1. Start-up screen for PL/Generator</A></I></FONT>
<P>
For detailed help on using this interface, click on the toolbar <IMG SRC="Image4.gif">to view the on-line help system.
</FONT><P>
<P>
<B><I><FONT SIZE=4><A NAME="Browsing">Browsing Schemas</A> </B></I></FONT>
<P>
Of course, you will want to be setting the code characteristics for schemas and tables or views within schemasAfter starting up PL/Generator, you will see a list of the schemas in the database instance to which you are connected. Notice that there are no plus signs next to them. In order to improve the performance of the screen interface, PL/Generator only queries the data dictionary for schemas in which you are interested.
<P>
So double-click on the schema in which you want to work, and in a few seconds a plus sign will appear next to that schema name. This is shown in figure 2.
<P>
<A HREF="Image6.jpg"><I>Figure 2. List of schemas, with the SCOTT schema populated</I></A>
<P>
If you then click on the plus sign, you will see the list of different screens available for that schema. Double-click on any item in the browser to bring up that screen. And if you click on the plus sign next to Tables or Views, you will see the list of those database objects. If you click on the plus sign next to a table, you will see the different screens available for that object. Again, a double click will display the screen and any settings defined for or active at that level.
<P>Figure 3 shows the coding standards that will be applied to code generated from the employee table.
<BR>
<BR>
<A HREF="Image7.jpg"> <I>Figure 3. The Coding Standards screen for the Employee table in the Scott schema</I></A>
<B><BR>
<P>
<I><FONT SIZE=4><A NAME="Setting">Setting Code Characteristics</A> </B></I></FONT>
<P>
You will be using the PL/Generator screen interface for two main purposes:
<P>
1. Configure the characteristics of the code to be generated.
<P>
2. Generate the code based on those characteristics.
<P>
To set the code characteristics, you double-click on the name of the characteristic in which you are interested. A window then appears on the right-hand side of the screen. You enter new values or make changes. To approve these changes, you then click OK. To cancel these changes, you click on Cancel. In both cases, this window is then closed.
<P>
Note that while you have approved these changes for your current generation session, they will not be saved for <I>future</I> generation requests unless you commit those changes. You can do this by clicking on the commit icon (<IMG SRC="Image8.gif" WIDTH=17 HEIGHT=14> ) or by selecting Session-Commit from the menu.
<P>You can set code characteristics at one of four levels, as shown in the table below: </FONT>
<TABLE BORDER=1 CELLSPACING=1 BORDERCOLOR="#000000" CELLPADDING=7 WIDTH=577>
<TR><TD WIDTH="45%" VALIGN="TOP" BGCOLOR="#ffffff">
<P><B><FONT >LevelScreen Interface Action</B></FONT></TD>
<TD WIDTH="55%" VALIGN="MIDDLE">
<P> </TD>
</TR>
<TR><TD WIDTH="45%" VALIGN="TOP">
<FONT ><P>Global across schemas (for a specific driver)</FONT></TD>
<TD WIDTH="55%" VALIGN="TOP">
<FONT ><P>You open a window under the name of the driver.</FONT></TD>
</TR>
<TR><TD WIDTH="45%" VALIGN="TOP">
<FONT ><P>Global within a schema</FONT></TD>
<TD WIDTH="55%" VALIGN="TOP">
<FONT ><P>You open a window under the name of the schema, but not under a table or view.</FONT></TD>
</TR>
<TR><TD WIDTH="45%" VALIGN="TOP">
<FONT ><P>For a specific table or view (or other database object)</FONT></TD>
<TD WIDTH="55%" VALIGN="TOP">
<FONT ><P>You open a window under the table or view in which you are interested.</FONT></TD>
</TR>
<TR><TD WIDTH="45%" VALIGN="TOP">
<FONT ><P>For a column in a table</FONT></TD>
<TD WIDTH="55%" VALIGN="TOP">
<FONT ><P>You open the Columns window under the table or view in which you are interested.</FONT></TD>
</TR>
</TABLE>
<P>
Generally, you will want to work your way down through the levels, setting the standard at each level and then modifying that standard for any exceptions in the lower levels.
<P>
For example, you might want to set as the default exception handling technique for your application "Standard PL/SQL", which means that exceptions are raised and propagated back through nested blocks. Your application is defined in the SCOTT schema. So you open the Error Handling screen under SCOTT and click on the first element in the radio group, as shown in Figure 4.
<P>
<A HREF="Image9.jpg"><I>Figure 4. Choosing Standard PL/SQL Exception Handling for the SCOTT schema</I></A>
<P>
Having approved that setting by clicking OK, you consider the many ways that data structures in your application will be used. You realize that while PL/SQL error handling is the right default, the employee table in particular needs to be referenced from both a Java and Powerbuilder front-end. These interfaces do not know how to handle PL/SQL exceptions, so you will override the default for that table only and choose Return Code exception handling.
<P>To do this, you open up the Tables list under SCOTT and then open up the browser under Employee. Then double-click on the Error handling screen and click on the third element in the radio group, as shown in Figure 5.
<P>
<A HREF="Image10.jpg"> <I>Figure 5. Error Handling Screen</I></A>
<P>
You click OK to approve those changes and then you remember that when calling stored code from Java, you are not allowed to rely on %ROWTYPE declarations. Instead, you must use cursor variables.
<P>So you double-click on the Performance/Tracing for the Employee table and click the checkbox labeled "Use cursor variables" so that a check appears there. You click OK and then you can generate just the right kind of encapsulation package for the Employee table by right mouse-clicking on Employee and selecting Generate.
<P>You will then see the Generate window, as shown in Figure 6.
<P>
<BR>
<A HREF="Image11.jpg"> <I>Figure 6. The Generate Window for the Employee Table</I></A>
<P>
You can click on OK immediately to start the generation process. You could also select a "target schema" by clicking on the drop list next to the field with that label. If the Target Schema field is not empty, that schema will be added to the generated code so that when compiled, the code with be stored in <I>that</I> schema and not the currently connected schema.
<P>
Of course, you many want to generate a package for more than just the Employee table. You can do that by right mouse-clicking on the schema name, SCOTT. You will then see the Generate window and, in it, a list of all the tables and views in the SCOTT schema. Highlight all the objects for which you want generation to occur, select the Target Schema, if desired, and click OK. This option is shown in Figure 7.
<P>
<A HREF="Image12.jpg"> <I>Figure 7. Generating Code for Multiple Tables in the SCOTT Schema</I></A>
<P>
Now, it might take a few minutes to generate all that code, especially if you selected a large number of tables and/or views. But wait till you see the volume and quality of the code generated! You will have saved yourselves days and maybe even <I>weeks</I> of development time!
<B><I><FONT SIZE=4><P><A NAME="Required">Required Settings for Successful Generation</A> </B></I></FONT>
<P>
At a minimum, you should immediately set the file locations for the driver files for table encapsulation and the directory to which generated code is written. These values are set in the Properties screen. You will probably want to set these two PL/Generator parameters at the global level, at least until you get more comfortable with the various features of PL/Generator. To do this, double-click on the Properties screen at the Table Encapsulator level (shown in the previous figure). You will then see the screen shown in Figure 8.
<P>
<I><FONT SIZE=2><A HREF="Image5.jpg">Figure 8. The Properties Screen for the Table Encapsulation Driver</A>
</I></FONT>
<P>
You can then enter values in the first two fields and click on OK. You can also immediately save your settings in the OIR by clicking on the commit button of the toolbar or selecting Session-Commit on the menu.
<P>
In the above screen, I have specified that the drivers are located in /plgen/drivers and that I want code generated to /oeapp/gencode (indicating that I have moved my files from the Windows client system to a Unix backend).
<P>
This "quick tour" should give you a strong sense of how to get started and how to use the PL/Generator screen interface.
<P>
If you have a problem or a question, don't hesitate to contact Quest Software Support or log your issue on the PL/SQL Pipeline's Pipetalk conference center, under the PL/Generator conference.
<P>
<P>
<hr>
<font size="2">
<p align="center"><a href="User_Guide.htm"> Main </a> |
<a href="Introduction.htm"> Introduction </a> |
<a href="Installation.htm"> Installation </a> |
Getting Started |
<a href="Generator_API.htm"> PL/Generator API </a>
</font>
<p>
<hr>
<p align="center"><font size="1">Copyright
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -