MVP Summit Europa Data Language Datatypes Cursor Adapter



















- Slides: 19

MVP Summit: Europa Data Language, Datatypes, Cursor. Adapter & XMLAdapter

Overview: What’s New with Data? n SQL n n n n MORE! Enhanced sub-query support Enhanced correlation support Enhanced UNION support Performance Commands & Functions Datatypes n Remote Data n n Cursor. Adapter XMLAdapter SQL Pass-through (SPT) OLEDB Provider Enhancements

SQL - More! n n n Amount of JOINs and amount of subqueries in SQL statement. Amount of UNIONs in SQL SELECT statement. Amount of tables referenced by SQL statement. More than 24 items in IN list. Multiple sub-query nesting. * No hard coded limit!

SQL - Enhanced sub-query support n n n Sub-query in SELECT list (projection). Sub-query in FROM clause (derived). Sub-query in UPDATE SET list. ORDER BY in conjunction with TOP N inside of non-correlated sub-query Support for more complex expressions on the left side in comparison with sub-query

SQL - Enhanced correlation support n n n Correlated UPDATE … FROM Correlated DELETE … FROM GROUP BY in correlated sub-query SELECT FROM WHERE * ; foo 1 T 1 ; f 1 IN (SELECT FROM WHERE GROUP MAX(f 1); foo 2 T 2 ; T 2. f 2 = T 1. f 2; BY f 3)

SQL - Enhanced UNION support n n UNION in INSERT INTO. . . SELECT. . . FROM. . . ORDER BY <field name> when using UNION n Referenced fields must be present in SELECT list for the last SELECT in the UNION.

Performance n n n TOP N performance improvement MIN()/MAX() optimization Rushmore optimization changes n LIKE n INDEX ON DELETED() / NOT DELETED() INDEX ON…FOR DELETED() / NOT DELETED()

Rushmore Optimization n n INDEX ON !DELETED() will be used to optimize !DELETED() or DELETED() conditions when INDEX ON DELETED() is not present. INDEX ON <…> FOR !DELETED() will be used to optimize !DELETED() or DELETED() when neither INDEX ON DELETED() or INDEX ON !DELETED() is present.

Rushmore Optimization n n When ever it is possible to determine that a Query should filter on DELETED() or !DELETED() a filtered index FOR DELETED() or FOR !DELETED() will be used accordingly if no nonfiltered index exists. If only indexes filtered FOR !DELETED() were used for Rushmore optimization and SET DELETED is ON, additional !DELETED() optimization is not done as it is unnecessary.

Language Enhancements n BINARY index type n SET REFRESH changes n Cursor. Set. Prop("Refresh") n SYS(1104, [c. Alias | n. Workarea]) n FLUSH [{ IN<n. Work. Area>|<c. Table. Alias>}|<c. File. Spec>] [ FORCE ] n SYS(3092) output to a file n SET SQLBUFFERING / SELECT … WITH (Buffering = <lexpr>) n CAST() n ICASE()

New Datatypes Var. Char n n n Similar to char data type except filled value is not padded (or trimmed) with spaces if value is assigned explicitly or by means of default value. Fields from external sources that do not fit into Varchar limits will map to Memo. Var. Char has priority over Character Index has same structure as Character Uses: n n Reduce size of indexes With SQL Server Var. Char (when < 254 bytes)

New Datatypes Var. Binary n n n Similar to Var. Char except used to store binary data. NO CPTRANS Uses: Time. Stamp (native) n GUID n Map to Var. Binary in SQL Server n

New Datatypes BLOB n n n Similar to Memo data type except it’s treated as a true binary data type. NO CPTRANS MODI MEMO displays HEX dump SCATTER/GATHER MEMO Uses: Image. Picture. Val (Goodbye General!) n Map to BLOB in SQL Server n

New Datatypes SET EXACT & Binary Data n SET COLLATE TO MACHINE SET EXACT OFF expression -------"abc" = "abc" "abc " = "abc" = "abc " "abc" = "ABC" = "abc" n C=C --. T. . F. n Q=C --. T. . F. C=Q --. T. . F. Q=Q --. T. . F. SET COLLATE TO MACHINE SET EXACT ON expression -------"abc" = "abc" "abc " = "abc" = "abc " "abc" = "ABC" = "abc" n C=C --. T. . F. expression -------"abc" = "abc" "abc " = "abc" = "abc " "abc" = "ABC" = "abc" n Q=C --. T. . F. C=Q --. T. . F. SET COLLATE TO GENERAL SET EXACT OFF Q=C --. T. . F. C=Q --. T. . F. . T. Q=Q --. T. . F. C=Q --. T. Q=Q --. T. . F. SET COLLATE TO GENERAL SET EXACT ON Q=Q --. T. . F. expression -------"abc" = "abc" "abc " = "abc" = "abc " "abc" = "ABC" = "abc" Padding ----CHR(0) CHR(32) Case Sensitive -------Always SET COLLATE dependent Comparison rules Type on Left ------Binary Character C=C --. T. . F. . T. C=C --. T. Q=C --. T. . F.

Remote Data n Disconnect. Rollback n n Records. Fetched n n Determines whether pending transaction has to be rolled back when connection is being disconnected. default (. F. ) Returns amount of records currently fetched from the back end for ODBC/ADO based cursor. Fetch. Is. Complete n Returns. T. if fetch process for the ODBC/ADO based cursor is complete.

SPT n Ability to determine amount of records affected by an SPT execution. n Via additional parameter for SQLEXEC and SQLMORERESULTS functions: n n a. Count. Info – Provides name of the array to populate with row count information. Array contains two columns: 1 – Alias, 2 –Count. SQLIDLEDISCONNECT function n n Similar behavior to implicit disconnect based on Idle. Time. Out property, now it can be done explicitly. The function fails if statement handle is busy or connection is in manual commit mode.

OLEDB Provider n Return Rowset from a stored procedure. n n Set. Result. Set / Get. Result. Set / Clear. Result. Set When used in native VFP, return value is the alias of the returned rowset.

Cursor. Adapter n Support for TIMESTAMP fields n n n Auto-refresh support On demand record refresh n n Timestamp. Field. List ca. Record. Refresh([n. Records], [n. Record. Offset]) Delayed Memo fetch DEFAULT and CHECK constraints Map. Var. Char / Map. Binary

XMLAdapter n n n Support for hierarchical XML Support for XPath expressions. XML encoding/decoding enhancements