Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Open Database Connectivity wikipedia , lookup
Oracle Database wikipedia , lookup
Extensible Storage Engine wikipedia , lookup
Entity–attribute–value model wikipedia , lookup
Concurrency control wikipedia , lookup
Microsoft Jet Database Engine wikipedia , lookup
Relational model wikipedia , lookup
ContactPoint wikipedia , lookup
Clusterpoint wikipedia , lookup
DEV-16: ABL Database Objects Updated David Olson Director, Enterprise Solutions Mary Szekely Just Mary Agenda ProDataSets in perspective What’s new for DB objects in 10.1C Getting more out of your DB objects 2 DEV-16: ABL Database Objects Updated © 2007 Progress Software Corporation ProDataSets in Perspective ProDataSets are about data relations between tables. 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 3 DEV-16: ABL Database Objects Updated © 2007 Progress Software Corporation ProDataSets in Perspective The “tuple” form of data: The Result Set 4 Order-num Ordered Cust-num Cust-name Line-num Qty Item-num Item-name Price 3 01/02/07 66 First Down Football 1 95 45 Golf Shoes 81.00 3 01/02/07 66 First Down Football 2 44 54 Shin Pads 4.86 3 01/02/07 66 First Down Football 3 71 4 Cycle Helmet 75.00 3 01/02/07 66 First Down Football 4 90 30 Windbreaker 42.75 3 01/02/07 66 First Down Football 5 98 2 Tennis Racquet 64.50 3 01/02/07 66 First Down Football 6 67 32 Tennis Shorts 19.99 4 02/15/07 83 Fallen Arch Running 1 78 2 Tennis Racquet 64.50 4 02/15/07 83 Fallen Arch Running 2 38 30 Windbreaker 42.75 4 02/15/07 83 Fallen Arch Running 3 4 43 Frisbee 13.97 4 02/15/07 83 Fallen Arch Running 4 72 40 Ice Skates 61.00 4 02/15/07 83 Fallen Arch Running 5 21 8 Runner’s Vest 9.85 4 02/15/07 83 Fallen Arch Running 6 97 53 Swimming Trunks 8.77 4 02/15/07 83 Fallen Arch Running 7 78 19 Ski Wax - Red 2.75 DEV-16: ABL Database Objects Updated © 2007 Progress Software Corporation The Trouble with Result Sets Distributing data: SQL “tuples” versus datasets 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 5 DEV-16: ABL Database Objects Updated © 2007 Progress Software Corporation ProDataSets in Perspective Typical XML format of the same data. Foreign keys deduced by context, still with some redundancy. <?xml version="1.0" ?> - <OrderDataSet xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> - <ttOrder> <CustNum>66</CustNum> <OrderNum>3</OrderNum> <OrderDate>1997-09-23</OrderDate> </ttOrder> - <ttOrder> <CustNum>83</CustNum> <OrderNum>4</OrderNum> <OrderDate>1998-01-17</OrderDate> </ttOrder> - <ttCust> <CustNum>66</CustNum> <NAME>First Down Football</NAME> </ttCust> - <ttCust> <CustNum>83</CustNum> <NAME>Fallen Arch Running</NAME> </ttCust> - <ttOrderLine> <OrderNum>3</OrderNum> <LineNum>1</LineNum> <ItemNum>45</ItemNum> <Qty>95</Qty> </ttOrderLine> 6 DEV-16: ABL Database Objects Updated © 2007 Progress Software Corporation ProDataSets in Perspective Normalized data: The Business View of Data CUSTOMER ORDER Cust-num Cust-name 66 First Down Football 83 Fallen Arch Running etc. Cust-num Order-num Ordered 66 3 01/02/07 83 4 02/15/07 ORDER-LINE 7 Order-num Item-num Line-num Qty 3 45 1 95 3 54 2 44 3 4 3 71 3 30 4 90 3 2 5 98 3 32 6 67 4 2 1 78 4 30 2 38 4 43 3 4 4 40 4 72 4 8 5 21 4 53 6 97 4 19 7 78 DEV-16: ABL Database Objects Updated ITEM Item-num Item-name Price 4 Tennis Racket 64.50 2 Cycle Helmet 75.00 8 Runner’s Vest 9.85 19 Duffel Bag 50.00 30 Windbreaker 42.75 32 Tennis Shorts 19.99 40 Ice Skates 61.00 43 Frisbee 13.97 45 Golf Shoes 81.00 53 Swimming Trunks 8.77 54 Shin Pads 4.86 © 2007 Progress Software Corporation DataSets are Fun Distributing data: SQL “tuples” versus datasets 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 8 DEV-16: ABL Database Objects Updated © 2007 Progress Software Corporation DataSet Principles ProDataSets, ABL SDOs, Java™ SDOs, .NET™ Datasets 9 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 DEV-16: ABL Database Objects Updated © 2007 Progress Software Corporation Agenda ProDataSets in perspective What’s new for DB objects in 10.1C Getting more out of your DB objects 10 DEV-16: ABL Database Objects Updated © 2007 Progress Software Corporation Under Development D I S C L A I M E R 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 11 DEV-16: ABL Database Objects Updated S C L A I M E R © 2007 Progress Software Corporation Adventures in Buffer Methods Ability to create dataset Before-Table records on the Server side for uniform update with SAVE-ROW-CHANGES 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 temptable Useful for WebSpeed and data coming from XML 12 DEV-16: ABL Database Objects Updated © 2007 Progress Software Corporation Recursive Relationships PARTS part-num part-location mcost 66 London 12.95 83 Hong Kong 22.50 46 Billerica 15.25 21 Santa Cruz 46 Nashua 41.95 25 Springfield 16.75 19 Newark 143.88 4.95 part-num to assy-num comp-num to part-num PRODUCT-STRUCTURE 13 DEV-16: ABL Database Objects Updated comp-num assy-num qty 66 3 2 83 4 5 46 8 15 21 2 3 46 5 19 25 12 9 19 7 2 © 2007 Progress Software Corporation Dataset Recursion FILL a Dataset through a Recursive Relation RECURSIVE property for DATA-RELATIONS – manufacturing example 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. 14 DEV-16: ABL Database Objects Updated © 2007 Progress Software Corporation Recursive Relationships Single Table Recursion Niel David Ken Peter Mary Martha The Trouble with Management Evan Robert Alex 15 DEV-16: ABL Database Objects Updated Robin Rich © 2007 Progress Software Corporation Recursive Relationships Single Table Recursion EMPLOYEE emp-name manager Niel David Niel Ken Niel Peter Niel Martha Peter Evan Martha Robin Evan Rich Evan Mary Ken Alex Robert Robert Martha The Trouble with Management • Managers are employees • Navigation through self-recursion can be difficult Niel David Ken Peter Mary Martha Evan Robert Relationship tables: EMPLOYEE and EMPLOYEE Relationship fields: emp-name and manager 16 DEV-16: ABL Database Objects Updated Alex Robin Rich © 2007 Progress Software Corporation Dataset Recursion FILL a Dataset through a Recursive Relation RECURSIVE property for DATA-RELATIONS Single Table model 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. 17 DEV-16: ABL Database Objects Updated © 2007 Progress Software Corporation 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.Custnum < 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. Works for both dynamic and static QUERY OPEN 18 DEV-16: ABL Database Objects Updated © 2007 Progress Software Corporation Working with Groups in Queries Accumulating Totals 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. END. END. 19 DEV-16: ABL Database Objects Updated © 2007 Progress Software Corporation Handy features in DB objects ProDataSet and Temp-table READ and WRITE XML & Schema 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! 20 DEV-16: ABL Database Objects Updated © 2007 Progress Software Corporation DB Object Enhancements Other new features… 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 21 DEV-16: ABL Database Objects Updated © 2007 Progress Software Corporation DB Object Enhancements Other new features… NOT-ACTIVE keyword for DATA-RELATION 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 22 DEV-16: ABL Database Objects Updated © 2007 Progress Software Corporation DB Object Enhancements Other new features… TOP-NAV-QUERY for datasets dataset d:top-nav-query:set-callback-procedure ("off-end“ ,"fetchcusts"). browse b:query = dataset d:top-nav-query. READ/WRITE attribute for dataset members that are not children of any relation: 23 DEV-16: ABL Database Objects Updated © 2007 Progress Software Corporation DB Object Enhancements Other new features… 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 24 DEV-16: ABL Database Objects Updated © 2007 Progress Software Corporation Agenda ProDataSets in perspective What’s new for DB objects in 10.1C Getting more out of your DB objects 25 DEV-16: ABL Database Objects Updated © 2007 Progress Software Corporation Handy features in db objects Filtering a ProDataset FILL query with FILL-WHERE-STRING FILL-WHERE-STRING is BOTH read/write and easier to use than creating your own query DATA-SOURCE dord-line:FILL-WHERE-STRING = DATA-SOURCE dord-line:FILL-WHERE-STRING + “ AND Line-Num < 3”. Or DATA-SOURCE dsDept:FILL-WHERE-STRING = “where deptcode = ‘400’”. The query is automatically handled by the FILL and you do not have to worry about creating/deleting it yourself 26 DEV-16: ABL Database Objects Updated © 2007 Progress Software Corporation Handy features in db objects Loose-copy-mode dataset and temp-table copy 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. target-dataset-handle:COPY-DATASET( src-dataset-handle [, append-mode [, replace-mode [, loose-copy-mode [, pairs-list [, current-only ] ] ] ] ] ) 27 DEV-16: ABL Database Objects Updated © 2007 Progress Software Corporation Handy features in DB objects ProDataSet and Temp-table READ and WRITE XML & Schema 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! 28 DEV-16: ABL Database Objects Updated © 2007 Progress Software Corporation In Summary 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 29 DEV-16: ABL Database Objects Updated © 2007 Progress Software Corporation For More Information, go to… PSDN Library - http://www.psdn.com/library/index.jspa • 10.1B ProDataSets by John Sadd • 10.1B ABL Handbook by John Sadd Education Courses: • Using ProDataSets Documentation: • 10.1B ABL Reference 30 DEV-16: ABL Database Objects Updated © 2007 Progress Software Corporation 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 31 DEV-16: ABL Database Objects Updated © 2007 Progress Software Corporation Questions? 32 DEV-16: ABL Database Objects Updated © 2007 Progress Software Corporation Thank you for your time 33 DEV-16: ABL Database Objects Updated © 2007 Progress Software Corporation 34 DEV-16: ABL Database Objects Updated © 2007 Progress Software Corporation