DEV-16: ABL Database Objects Updated David Olson Director, Enterprise Solutions Mary Szekely Just Mary
© 2007 Progress Software Corporation 2 DEV-16: ABL Database Objects Updated Agenda ProDataSets in perspective What’s new for DB objects in 10.1C Getting more out of your DB objects
© 2007 Progress Software Corporation 3 DEV-16: ABL Database Objects Updated The data relation Order to Order-Lines can be represented as composite rows or “tuples”: Order 3 01/02/07 Order-line 1 95 Order 3 01/02/07 Order-line 2 44 The same data relation can be represented in nested fashion as: Order 3 01/02/07 –Order-line 1 95 –Order-line 2 44 ProDataSets in Perspective ProDataSets are about data relations between tables.
© 2007 Progress Software Corporation 4 DEV-16: ABL Database Objects Updated ProDataSets in Perspective The “tuple” form of data: The Result Set Order-numOrderedCust-numCust-nameLine-numQtyItem-numItem-namePrice 301/02/0766First Down Football19545Golf Shoes /02/0766First Down Football24454Shin Pads /02/0766First Down Football3714Cycle Helmet /02/0766First Down Football49030Windbreaker /02/0766First Down Football5982Tennis Racquet /02/0766First Down Football66732Tennis Shorts /15/0783Fallen Arch Running1782Tennis Racquet /15/0783Fallen Arch Running23830Windbreaker /15/0783Fallen Arch Running3443Frisbee /15/0783Fallen Arch Running47240Ice Skates /15/0783Fallen Arch Running5218Runner’s Vest /15/0783Fallen Arch Running69753Swimming Trunks /15/0783Fallen Arch Running77819Ski Wax - Red2.75
© 2007 Progress Software Corporation 5 DEV-16: ABL Database Objects Updated Wide SQL tuple has extra copies of higher levels Each row is independent of all other data Updating can be difficult Ideal for streaming large amounts of data where processing cannot wait for a completed set The Trouble with Result Sets Distributing data: SQL “tuples” versus datasets
© 2007 Progress Software Corporation 6 DEV-16: ABL Database Objects Updated ProDataSets in Perspective Typical XML format of the same data. Foreign keys deduced by context, still with some redundancy First Down Football - 83 Fallen Arch Running
© 2007 Progress Software Corporation 7 DEV-16: ABL Database Objects Updated CUSTOMER Cust-numCust-name 66First Down Football 83Fallen Arch Running etc. ProDataSets in Perspective ORDER Cust-numOrder-numOrdered 66301/02/ /15/07 Normalized data: The Business View of Data ORDER-LINE Order-numItem-numLine-numQty ITEM Item-numItem-namePrice 4Tennis Racket Cycle Helmet Runner’s Vest Duffel Bag Windbreaker Tennis Shorts Ice Skates Frisbee Golf Shoes Swimming Trunks Shin Pads4.86
© 2007 Progress Software Corporation 8 DEV-16: ABL Database Objects Updated Dataset format has no extra copies One row in a table is dependent on rows in other tables, so no processing can occur until the entire set has been read Ideal for caching moderate amounts of data Ideal for loosely-coupled operations Updating is safe and easy– Browsing easy DataSets are Fun Distributing data: SQL “tuples” versus datasets
© 2007 Progress Software Corporation 9 DEV-16: ABL Database Objects Updated Deliver related data as tables of logical records, not as tuples in a matrix Guarantee updating can be safe and effective, including before images for optimistic locking Minimize data transmission Can be transformed to and from XML easily Do not assume all data comes from one data source May be defined dynamically DataSet Principles ProDataSets, ABL SDOs, Java™ SDOs,.NET™ Datasets
© 2007 Progress Software Corporation 10 DEV-16: ABL Database Objects Updated Agenda ProDataSets in perspective What’s new for DB objects in 10.1C Getting more out of your DB objects
© 2007 Progress Software Corporation 11 DEV-16: ABL Database Objects Updated D I S C L A I M E R Under Development This talk includes information about potential future products and/or product enhancements. What we are going to say reflects our current thinking, but the information contained herein is preliminary and subject to change. Any future products we ultimately deliver may be materially different from what is described here. D I S C L A I M E R
© 2007 Progress Software Corporation 12 DEV-16: ABL Database Objects Updated Buffer handle method MARK-ROW-STATE Allows you to create a before-table record for any after-table record with a row-state and before-table buffer of your choice Buffer handle method MARK-NEW Allows you to create before-table records and mark them as ROW-CREATED for an entire temp- table Adventures in Buffer Methods Ability to create dataset Before-Table records on the Server side for uniform update with SAVE-ROW-CHANGES Useful for WebSpeed and data coming from XML
© 2007 Progress Software Corporation 13 DEV-16: ABL Database Objects Updated Recursive Relationships PARTS part-numpart-locationmcost 66London Hong Kong Billerica Santa Cruz Nashua Springfield Newark4.95 PRODUCT-STRUCTURE comp-numassy-numqty part-num to assy-num comp-num to part-num
© 2007 Progress Software Corporation 14 DEV-16: ABL Database Objects Updated DEFINE TEMP-TABLE ttpart FIELD part-num AS CHAR FIELD mcost AS DECIMAL INDEX part-num AS UNIQUE part-num. DEFINE TEMP-TABLE ttps FIELD comp-num AS CHAR FIELD assy-num AS CHAR FIELD qty AS INT INDEX ixcomp AS UNIQUE comp-num assy-num. INDEX ixassy AS UNIQUE assy-num comp-num. DEFINE DATASET mfg FOR ttpart, ttps DATA-RELATION FOR ttpart, ttps RELATION-FIELDS(part-num, assy-num) DATA-RELATION FOR ttps, ttpart RELATION-FIELDS(comp-num, part-num) RECURSIVE. Dataset Recursion FILL a Dataset through a Recursive Relation RECURSIVE property for DATA-RELATIONS – manufacturing example
© 2007 Progress Software Corporation 15 DEV-16: ABL Database Objects Updated Recursive Relationships Single Table Recursion The Trouble with Management
© 2007 Progress Software Corporation 16 DEV-16: ABL Database Objects Updated Recursive Relationships EMPLOYEE emp-namemanager Niel DavidNiel KenNiel PeterNiel MarthaPeter EvanMartha RobinEvan RichEvan MaryKen AlexRobert Martha The Trouble with Management Managers are employees Navigation through self-recursion can be difficult Relationship tables: EMPLOYEE and EMPLOYEE Relationship fields: emp-name and manager Single Table Recursion Niel DavidKen Mary Peter Martha Robert Alex Evan RobinRich
© 2007 Progress Software Corporation 17 DEV-16: ABL Database Objects Updated RECURSIVE property for DATA-RELATIONS Single Table model Dataset Recursion FILL a Dataset through a Recursive Relation DEFINE TEMP-TABLE ttemp FIELD emp-name AS CHAR FIELD manager AS CHAR FIELD age as int INDEX emp-name AS UNIQUE emp-name. DEFINE DATASET myorg FOR ttemp DATA-RELATION r1 FOR ttemp,ttemp RELATION-FIELDS(emp-name, manager)RECURSIVE.
© 2007 Progress Software Corporation 18 DEV-16: ABL Database Objects Updated Works for both dynamic and static QUERY OPEN Working with Groups in Queries BREAK BY, LAST-OF FIRST-OF for a QUERY DEFINE QUERY q FOR Customer,Order, Order-line, Item SCROLLING. OPEN QUERY q FOR EACH Customer WHERE Customer.Cust- num < 10, EACH Order OF Customer, EACH Order-line OF Order, EACH Item OF Order-line BREAK BY Customer.Sales-rep BY Order.Order-num. REPEAT: GET NEXT q. IF QUERY q:LAST-OF(2) THEN …. Done with this order IF QUERY q:LAST-OF(1) THEN … Done with this sales-rep etc etc. END.
© 2007 Progress Software Corporation 19 DEV-16: ABL Database Objects Updated REPEAT: GET NEXT q. IF QUERY-OFF-END(“q”) THEN LEAVE. tot-by-order = tot-by-order + qty * price. tot-by-rep = tot-by-rep + qty * price. IF QUERY q:LAST-OF(2) THEN /*Done with this order*/ DO: DISPLAY cust.sales-rep order.order-num tot-by-order. tot-by-order = 0. IF QUERY q:LAST-OF(1) THEN /*Done with this sales-rep*/ DO: DISPLAY tot-by-rep. tot-by-rep = 0. END. Working with Groups in Queries Accumulating Totals
© 2007 Progress Software Corporation 20 DEV-16: ABL Database Objects Updated TEMP-TABLE and DATASET WRITE-XML, WRITE-XMLSCHEMA TEMP-TABLE and DATASET READ-XML, READ-XMLSCHEMA If receiving table or dataset is dynamic, we can infer the schema! Around since 10.1A but not talked about enough! Handy features in DB objects ProDataSet and Temp-table READ and WRITE XML & Schema
© 2007 Progress Software Corporation 21 DEV-16: ABL Database Objects Updated ProDataSets for consuming Web Services ProDataSets can be a parameter for the web service incoming call Already available for Temp-Tables Dataset parameters used to be done by serializing to XML DB Object Enhancements Other new features…
© 2007 Progress Software Corporation 22 DEV-16: ABL Database Objects Updated NOT-ACTIVE keyword for DATA-RELATION DB Object Enhancements Other new features… def temp-table ttcust like customer. def temp-table ttord like order. def dataset dset for ttcust,ttord data-relation r1 for ttcust,ttord relation-fields(cust-num,cust-num) data-relation r2 for ttord,ttcust relation-fields(cust-num,cust-num) not-active. dataset dset:get-relation("r1"):active = false. dataset dset:get-relation("r2"):active = true. Note that ttcust, ttorder is suitable for FILL ttord, ttcust, is suitable for NAVIGATION or sending to.NET
© 2007 Progress Software Corporation 23 DEV-16: ABL Database Objects Updated TOP-NAV-QUERY for datasets READ/WRITE attribute for dataset members that are not children of any relation: DB Object Enhancements Other new features… dataset d:top-nav-query:set-callback-procedure ("off-end“,"fetchcusts"). browse b:query = dataset d:top-nav-query.
© 2007 Progress Software Corporation 24 DEV-16: ABL Database Objects Updated DEFAULT-VALUE for BUFFER-FIELDS Similar to INITIAL and DEFAULT–STRING, but is in the NATIVE format, not CHARACTER. For assigning values to a newly created record, but not for use as MetaData since TODAY and NOW are captured as the current internal native datatype date and time DB Object Enhancements Other new features…
© 2007 Progress Software Corporation 25 DEV-16: ABL Database Objects Updated Agenda ProDataSets in perspective What’s new for DB objects in 10.1C Getting more out of your DB objects
© 2007 Progress Software Corporation 26 DEV-16: ABL Database Objects Updated FILL-WHERE-STRING is BOTH read/write and easier to use than creating your own query Or The query is automatically handled by the FILL and you do not have to worry about creating/deleting it yourself Handy features in db objects Filtering a ProDataset FILL query with FILL-WHERE-STRING DATA-SOURCE dord-line:FILL-WHERE-STRING = DATA-SOURCE dord-line:FILL-WHERE-STRING + “ AND Line-Num < 3”. DATA-SOURCE dsDept:FILL-WHERE-STRING = “where deptcode = ‘400’”.
© 2007 Progress Software Corporation 27 DEV-16: ABL Database Objects Updated If loose-copy-mode is TRUE: The target and source member tables do not have to have columns matching by position. They are matched by name, or by any previous ATTACH-DATA-SOURCE mapping between the target and source. Handy features in db objects Loose-copy-mode dataset and temp-table copy target-dataset-handle:COPY-DATASET( src-dataset-handle [, append-mode [, replace-mode [, loose-copy-mode [, pairs-list [, current-only ] ] ] ] ] )
© 2007 Progress Software Corporation 28 DEV-16: ABL Database Objects Updated TEMP-TABLE and DATASET WRITE-XML, WRITE-XMLSCHEMA TEMP-TABLE and DATASET READ-XML, READ-XMLSCHEMA If receiving table or dataset is dynamic, we can infer the schema! Around since 10.1A but not talked about enough! Handy features in DB objects ProDataSet and Temp-table READ and WRITE XML & Schema
© 2007 Progress Software Corporation 29 DEV-16: ABL Database Objects Updated In Summary REAL ProDataSets model REAL business data Complex relationships and recursion are easily managed New features make ProDataSets more flexible FILL-WHERE and loosemode are examples ProDataSets keep getting better We can do things other datasets cannot
© 2007 Progress Software Corporation 30 DEV-16: ABL Database Objects Updated For More Information, go to… PSDN Library B ProDataSets by John Sadd 10.1B ABL Handbook by John Sadd Education Courses: Using ProDataSets Documentation: 10.1B ABL Reference
© 2007 Progress Software Corporation 31 DEV-16: ABL Database Objects Updated Relevant Exchange Sessions DEV-5: Using ProDataSets in OpenEdge® 10 Monday, June 12, 2:00pm DEV-14: Using ProDataSets and WebClient for Robust B2B Applications Tuesday, June 13, 8:00am DEV-13: Development Tools and ABL Roadmap Info Exchange Tuesday, June 13, 8:00am
© 2007 Progress Software Corporation 32 DEV-16: ABL Database Objects Updated Questions?
© 2007 Progress Software Corporation 33 DEV-16: ABL Database Objects Updated Thank you for your time
© 2007 Progress Software Corporation 34 DEV-16: ABL Database Objects Updated