11.07.2015 Views

in PowerBuilder - sys-con.com's archive of magazines - SYS-CON ...

in PowerBuilder - sys-con.com's archive of magazines - SYS-CON ...

in PowerBuilder - sys-con.com's archive of magazines - SYS-CON ...

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

ment data <strong>in</strong> the “<strong>sys</strong>tem table” area (see Figure 1). The <strong>sys</strong>tem tablearea is normally where you (or your DBA) place the database schemathat def<strong>in</strong>es the metadata (<strong>in</strong>formation about your data). This area isalso available to the <strong>PowerBuilder</strong> and PocketBuilder developmenttools along with Sybase’s InfoMaker report writer. All these Sybasedevelopment tools make use <strong>of</strong> the <strong>sys</strong>tem table area (would youbelieve designed and available s<strong>in</strong>ce <strong>PowerBuilder</strong> release 1.0) tostore “metadata” about your database. The first developer who <strong>con</strong>nectsto a new database area us<strong>in</strong>g InfoMaker, PocketBuilder, or<strong>PowerBuilder</strong> with DBA privileges (i.e., “Create Table”) has the developmenttool automatically add five new tables to the <strong>sys</strong>tem tablearea. These five tables are PBCatCol, PBCatEdt, PBCatFmt, PBCatTbl,and PBCatVld. To view these new System Tables, open the databasepa<strong>in</strong>ter and <strong>con</strong>nect to your favorite database, then select the“Tables” item <strong>in</strong> the TreeView <strong>of</strong> the database Pa<strong>in</strong>ter and use the“alternate” (aka politically <strong>in</strong>correct “right-hand”) mouse button toproduce a pop-up menu. From the pop-up menu, select the “ShowSystem Tables” option. Once selected, this will force InfoMaker, PocketBuilder,or <strong>PowerBuilder</strong> to show you all the <strong>sys</strong>tem table area –notice the PBCatxxx tables <strong>in</strong> the list.The PBCatxxx tables are where the Sybase IDE tools store extensionsto the database schema tables and columns that perta<strong>in</strong> to thedeveloper’s delivery <strong>of</strong> <strong>in</strong>formation to the GUI user. The DBMS doesnot care about the GUI world and, <strong>in</strong> fact, it detaches itself from it. Inthe graphic environment, however, we are <strong>con</strong>cerned about propertiessuch as font, height, units <strong>of</strong> measure, formatt<strong>in</strong>g, and validat<strong>in</strong>g. ThePBCatxxx tables supply this exact <strong>in</strong>formation to the Sybase developmenttools. It should be noted here that this applies only to databasedesigners who use tools like PowerDesigner or System Architect andknow how to also load this GUI <strong>in</strong>formation <strong>in</strong>to the Sybase PBCatxxxtables. Another alternative, before any development team starts itsproject work, is to have one developer take the time to use the DatabasePa<strong>in</strong>ter to <strong>in</strong>clude this extra “metadata.” Do<strong>in</strong>g so can improvethe development time <strong>of</strong> a project from 3 to 15 times.Assum<strong>in</strong>g that your manager is too naive or cheap to purchase adesign/model<strong>in</strong>g tool like PowerDesigner, fear not, you can still use theInfoMaker, PocketBuilder, or <strong>PowerBuilder</strong>’s DataBase pa<strong>in</strong>ter toachieve this tremendous productivity ga<strong>in</strong>; as you will see shortly, thiswill tie <strong>in</strong>to the need and delivery <strong>of</strong> the “Context Sensitive” help.Load<strong>in</strong>g Your MetadataTo beg<strong>in</strong> load<strong>in</strong>g your PBCatxxx System Tables us<strong>in</strong>g the InfoMaker,PocketBuilder, or <strong>PowerBuilder</strong> database pa<strong>in</strong>ter, open the databasepa<strong>in</strong>ter and carefully note the “extended” properties <strong>of</strong> either a “table”or a “column” entity. For a table, the extended property categories are<strong>in</strong> the General tab’s “Comments,” all <strong>of</strong> the Data Font, Head<strong>in</strong>g Fontand Label Font tab pages (see Figure 2). For the column entity, theextended properties are “Comments” <strong>in</strong> the General Tab, all <strong>of</strong> theHeaders, Display, Validation, and Edit Style tab pages (see Figure 3).Any property that you fill out <strong>in</strong> the areas listed above are automaticallysaved to the PBCatTbl <strong>sys</strong>tem table (for a table) and the PBCatCols<strong>sys</strong>tem table for any column properties that are beyond the vendor’sANSI implementation.I should also take the time to mention that the database pa<strong>in</strong>ter is<strong>in</strong>cluded <strong>in</strong> the current DataW<strong>in</strong>dow.NET product and will be present<strong>in</strong> the new DataW<strong>in</strong>dow.NET plug-<strong>in</strong> for Visual Studio 2005. So the tipsI am referr<strong>in</strong>g to <strong>in</strong> this article focus ma<strong>in</strong>ly on the <strong>PowerBuilder</strong> andPocketBuilder development tools but will also work for this new environmentas well. The PBCatxxx tables are always present after the first<strong>con</strong>nection to your Oracle, Sybase, Micros<strong>of</strong>t, IBM, or other DBMS. Ifthere are security implications for creat<strong>in</strong>g these five new <strong>sys</strong>temtables, Sybase provides DBA scripts to populate these table structuresmanually by us<strong>in</strong>g your favorite DBA utility.The next three PBCatxxx tables are for Edit Styles, Validation Rules,and Display Formats (see Figure 4). These extended properties can beadded to the System Table area us<strong>in</strong>g the “Extended Attributes” panel<strong>of</strong> the database pa<strong>in</strong>ter. This allows the developer to <strong>in</strong>put theseextended properties, which I would imag<strong>in</strong>e most seasoned Power-Builder developers would recognize also appears <strong>in</strong> the DataW<strong>in</strong>dowpa<strong>in</strong>ter. Tak<strong>in</strong>g the time to add this metadata <strong>in</strong> the DBMS will allowthis extra <strong>in</strong>formation to be available to the DataW<strong>in</strong>dow pa<strong>in</strong>ter dur<strong>in</strong>gthe creation <strong>of</strong> the DataW<strong>in</strong>dow object. Take note <strong>of</strong> this last statementas this also applies to the Table and Column extended propertiesas well.Remember though that the PBCatxxx <strong>sys</strong>tem tables are just standardDBMS tables that can be read by your development tool. While <strong>in</strong>the database pa<strong>in</strong>ter, you can locate the ISQL pane and select <strong>in</strong>formationfrom any <strong>of</strong> the PBCatxxx tables. For example, <strong>in</strong> the Employeetable – if I attach a “Display Format” <strong>of</strong> '$#,##0;($#,##0)' to the Salarycolumn, then, us<strong>in</strong>g the follow<strong>in</strong>g query:SELECT "pbcatfmt"."pbf_frmt","pbcatcol"."pbc_cnam","pbcatcol"."pbc_tnam"FROM "pbcatcol","pbcatfmt"WHERE ( "pbcatfmt"."pbf_name" = "pbcatcol"."pbc_mask" );FIGURE 1 | FIGURE 2FIGURE 3FIGURE 4FIGURE 5we can see if there is a correlationbetween the Display Format andany column – <strong>in</strong> particular, theSalary column. Runn<strong>in</strong>g theabove query resulted <strong>in</strong> the follow<strong>in</strong>gresult set <strong>in</strong> my development environment and <strong>in</strong>dicated thatthe display format I just created was <strong>in</strong>deed <strong>con</strong>nected to the salarycolumn with<strong>in</strong> the Employee table.Us<strong>in</strong>g the above <strong>in</strong>formation and test we can also extend thisbehavior to the “Comments” part <strong>of</strong> the PBCatCols <strong>sys</strong>tem table. Thereason I might be <strong>in</strong>terested <strong>in</strong> this would be to automate the Help filegeneration. Then I could use the ShowPopUp ( ) command <strong>in</strong> Power-Builder to dynamically support this feature. An SQL query for this<strong>in</strong>formation might look like this:pbdj.<strong>sys</strong>-<strong>con</strong>.comPBDJ volume12 issue1117

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!