InterSystems’ New Dynamic SQL Features Louise Parberry – Senior Sales Engineer.

Slides:



Advertisements
Similar presentations
Microsoft Access Course 1. Introduction to the user interface.
Advertisements

Chapter 10 ADO. What is ADO? ADO is a Microsoft technology ADO stands for ActiveX Data Objects ADO is a programming interface to access data in a database.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 13 Introduction to SQL Programming Techniques.
Using Objects and Properties
A Guide to Oracle9i1 Advanced SQL And PL/SQL Topics Chapter 9.
JDBC. In This Class We Will Cover: What SQL is What ODBC is What JDBC is JDBC basics Introduction to advanced JDBC topics.
SiS Technical Training Development Track Technical Training(s) Day 1 – Day 2.
A tour of new features introducing LINQ. Agenda of LINQ Presentation We have features for every step of the way LINQ Fundamentals Anonymous Functions/Lambda.
Database Constraints. Database constraints are restrictions on the contents of the database or on database operations Database constraints provide a way.
Access Tutorial 10 Automating Tasks with Macros
Advance Computer Programming Java Database Connectivity (JDBC) – In order to connect a Java application to a database, you need to use a JDBC driver. –
8 Copyright © 2004, Oracle. All rights reserved. Creating LOVs and Editors.
Bordoloi and Bock CURSORS. Bordoloi and Bock CURSOR MANIPULATION To process an SQL statement, ORACLE needs to create an area of memory known as the context.
Database Design for DNN Developers Sebastian Leupold.
Chapter 10 Managing Data with ASP.NET. ASP.NET 2.0, Third Edition2.
4-1 INTERNET DATABASE CONNECTOR Colorado Technical University IT420 Tim Peterson.
Building a UI with Zen Pat McGibbon –Sales Engineer.
Entity Framework, a quickstart Florin−Tudor Cristea, Microsoft Student Partner.
1 PHP and MySQL. 2 Topics  Querying Data with PHP  User-Driven Querying  Writing Data with PHP and MySQL PHP and MySQL.
1 Lecture 4: Threads Operating System Fall Contents Overview: Processes & Threads Benefits of Threads Thread State and Operations User Thread.
ADO.NET A2 Teacher Up skilling LECTURE 3. What’s to come today? ADO.NET What is ADO.NET? ADO.NET Objects SqlConnection SqlCommand SqlDataReader DataSet.
By Lecturer / Aisha Dawood 1.  You can control the number of dispatcher processes in the instance. Unlike the number of shared servers, the number of.
Lecture Set 14 B new Introduction to Databases - Database Processing: The Connected Model (Using DataReaders)
Recall: Three I/O Methods Synchronous: Wait for I/O operation to complete. Asynchronous: Post I/O request and switch to other work. DMA (Direct Memory.
Module 9 Designing and Implementing Stored Procedures.
Mason Vail.  A data type definition – “blueprint for objects”  Includes properties and/or methods ◦ “instance” data / methods – specific to one object.
Treasures of Cache 2010 Ian Cargill Development Manager Dendrite Clinical Systems.
Oracle Data Integrator Procedures, Advanced Workflows.
Triggers and Stored Procedures in DB 1. Objectives Learn what triggers and stored procedures are Learn the benefits of using them Learn how DB2 implements.
Database Design and Management CPTG /23/2015Chapter 12 of 38 Functions of a Database Store data Store data School: student records, class schedules,
1 Chapter Overview Preparing to Upgrade Performing a Version Upgrade from Microsoft SQL Server 7.0 Performing an Online Database Upgrade from SQL Server.
What does C store? >>A = [1 2 3] >>B = [1 1] >>[C,D]=meshgrid(A,B) c) a) d) b)
Data Structures Using C++ 2E1 Inheritance An “is-a” relationship –Example: “every employee is a person” Allows new class creation from existing classes.
Lecture Set 14 B new Introduction to Databases - Database Processing: The Connected Model (Using DataReaders)
Caché SQL More than you think Ian Cargill Development Manager Dendrite Clinical Systems.
Database Systems Design, Implementation, and Management Coronel | Morris 11e ©2015 Cengage Learning. All Rights Reserved. May not be scanned, copied or.
Chapter 15 Introduction to PL/SQL. Chapter Objectives  Explain the benefits of using PL/SQL blocks versus several SQL statements  Identify the sections.
Chapter 3 Functions, Events, and Control Structures JavaScript, Third Edition.
C++ Programming Basic Learning Prepared By The Smartpath Information systems
PL/SQLPL/SQL Oracle10g Developer: PL/SQL Programming Chapter 9 Database Triggers.
DBT544. DB2/400 Advanced Features Level Check Considerations Database Constraints File Overrides Object and Record Locks Trigger Programs.
1 CS 430 Database Theory Winter 2005 Lecture 14: Additional SQL Topics.
Mauricio Featherman, Ph.D. Washington St. University
Chapter 4: SQL Complex Queries Complex Queries Views Views Modification of the Database Modification of the Database Joined Relations Joined Relations.
JavaScript, Fourth Edition
Chapter 4 An Introduction to SQL. Copyright © 2004 Pearson Addison-Wesley. All rights reserved.4-2 Topics in this Chapter SQL: History and Overview The.
Dynamic SQL. 2 home back first prev next last What Will I Learn? Recall the stages through which all SQL statements pass Describe the reasons for using.
IT Faculty Software Engineering Seniors UML for a simple DataBase Management System Prepared by: أنس الأسود بشير الفروان زهير الزعبي ياسر المحمد.
Introduction to Object-Oriented Programming Lesson 2.
8 Chapter Eight Server-side Scripts. 8 Chapter Objectives Create dynamic Web pages that retrieve and display database data using Active Server Pages Process.
Learningcomputer.com SQL Server 2008 –Views, Functions and Stored Procedures.
Java Programming, Second Edition Chapter Twelve Advanced Inheritance Concepts.
Chapter 11: Advanced Inheritance Concepts. Objectives Create and use abstract classes Use dynamic method binding Create arrays of subclass objects Use.
Module 11: Managing Transactions and Locks
Stored Procedures / Session 4/ 1 of 41 Session 4 Module 7: Introducing stored procedures Module 8: More about stored procedures.
10 1 Chapter 10 - A Transaction Management Database Systems: Design, Implementation, and Management, Rob and Coronel.
Chapter – 8 Software Tools.
Perfecto Mobile Automation
Oracle Business Intelligence Foundation - Commonly Used Features in Repository.
Copyright 2007, Information Builders. Slide 1 iWay Web Services and WebFOCUS Consumption Michael Florkowski Information Builders.
​ TdBench 7.2 – tdb.sh Utility Script. 2 Created for TdBench 7.x release to consolidate tools Open architecture – looks for scripts in the./tools directory.
SQL Triggers, Functions & Stored Procedures Programming Operations.
Copyright © 2016 Ramez Elmasri and Shamkant B. Navathe.
E Copyright © 2006, Oracle. All rights reserved. Using SQL Developer.
Views / Session 3/ 1 of 40 Session 3 Module 5: Implementing Views Module 6: Managing Views.
Portal v2.6 Service Pack 1 Update. 2 Portal v2.6 Service Pack 1 6/27/2016 ©2007 GE Fanuc Intelligent Platforms All Rights Reserved Portal v2.6 Service.
1 Middle East Users Group 2008 Self-Service Engine & Process Rules Engine Presented by: Ryan Flemming Friday 11th at 9am - 9:45 am.
Stored Procedures – Facts and Myths
Inheritance and Polymorphism
Chapter 10 ADO.
Presentation transcript:

InterSystems’ New Dynamic SQL Features Louise Parberry – Senior Sales Engineer

Agenda What is Dynamic SQL?What is Dynamic SQL? Why use Dynamic SQL?Why use Dynamic SQL? The Reason for the New interfaceThe Reason for the New interface %SQL.Statement with Examples%SQL.Statement with Examples %SQL.StatementResult with Examples%SQL.StatementResult with Examples Interactive SQL Shell with ExamplesInteractive SQL Shell with Examples What’s NextWhat’s Next

What is Dynamic SQL? From the Documentation:From the Documentation: –“ Dynamic SQL refers to SQL statements that are prepared and executed at runtime. Dynamic SQL lets you program within Caché in a manner similar to an ODBC or JDBC application (except that you are executing the SQL statement within the same process context as the database engine)”. (The Dynamic SQL Documentation is very good.)(The Dynamic SQL Documentation is very good.)

Why use Dynamic SQL? The ability to instantiate one or many statement objects, prepare statements once and execute them many times.The ability to instantiate one or many statement objects, prepare statements once and execute them many times. Results can be retained in local variables, arrays or any other structure available for immediate or later processing.Results can be retained in local variables, arrays or any other structure available for immediate or later processing. The ability to prepare once outside of a loop and to execute possibly many times inside a loop can be key to performance.The ability to prepare once outside of a loop and to execute possibly many times inside a loop can be key to performance.

Why use Dynamic SQL? Cont. Dynamic SQL is Dynamic. Changes to table/view definitions or data selectivity changes don’t require an application recompile.Dynamic SQL is Dynamic. Changes to table/view definitions or data selectivity changes don’t require an application recompile. The application can generate the statement to be executed. Generated statements can be prepared and executed using inputs from any source.The application can generate the statement to be executed. Generated statements can be prepared and executed using inputs from any source.

Why Create a New Interface? A consistent interface to the various dynamic SQL features InterSystems provides was needed, as well as a way to recommend “Best Practices”.A consistent interface to the various dynamic SQL features InterSystems provides was needed, as well as a way to recommend “Best Practices”. We already had %Library.ResultSet and %ResultSet.SQL, but both had limitations. %Library.ResultSet is restricted in the number of parameters and %ResultSet.SQL was restricted to select statements only. We also had a variety of %XSQL statement interfaces implemented to support SQL MigrationsWe already had %Library.ResultSet and %ResultSet.SQL, but both had limitations. %Library.ResultSet is restricted in the number of parameters and %ResultSet.SQL was restricted to select statements only. We also had a variety of %XSQL statement interfaces implemented to support SQL Migrations %SQL.Statement is a consolidation and provides a single consistent interface for all dynamic statements.%SQL.Statement is a consolidation and provides a single consistent interface for all dynamic statements.

The %SQL.Statement class The %SQL.Statement class implements an interface for managing dynamic SQL statements. The interface consists of the following methods and properties.The %SQL.Statement class implements an interface for managing dynamic SQL statements. The interface consists of the following methods and properties. –%Prepare – Prepare a SQL statement –%Execute – Execute the earlier prepared statement –%ExecDirect – Prepare and execute in one step –%Metadata – Returns Meta-data on prepared statement –%Selectmode – Set the select mode for the statement –%SchemaPath – Set the default Schema(s) –%ObjectSelectMode – Determine column types

The %ObjectSelectMode property The %ObjectSelectMode property - Allows you to swizzle objects, modify the object, and save it back, all without having to open anything. Example:The %ObjectSelectMode property - Allows you to swizzle objects, modify the object, and save it back, all without having to open anything. Example: –set result.Spouse.Name=“LastName,First” Avoid “underwriting” SQL applied updates to swizzled objects. Using Dynamic SQL with %ObjectSelectMode can help to avoid this issue.Avoid “underwriting” SQL applied updates to swizzled objects. Using Dynamic SQL with %ObjectSelectMode can help to avoid this issue. Polymorphic dispatch – objects swizzled through a result set are fully polymorphic.Polymorphic dispatch – objects swizzled through a result set are fully polymorphic. Let’s look at some examples:Let’s look at some examples:

Statement Results Executing a statement with either %Execute or %ExecDirect returns an object that implements the %SQL.StatementResult interface.Executing a statement with either %Execute or %ExecDirect returns an object that implements the %SQL.StatementResult interface. This object can be a unitary value, a result set, or a context object that is returned from a CALL statement.This object can be a unitary value, a result set, or a context object that is returned from a CALL statement. Serial binding of dynamic results. (2010.2)Serial binding of dynamic results. (2010.2) –A context object that holds multiple result sets can be used in the same way as a single result set object. What you get when doing this is the automatic binding of the first dynamic result set and invoking %Next() iteratively will move through the rows of that result set until it reaches the end. At any time during this process, the user can invoke %MoreResults and the currently bound result set is closed and the next result set is bound.

Interactive SQL Shell The interactive SQL shell allows the user to execute SQL statements dynamically.The interactive SQL shell allows the user to execute SQL statements dynamically. There are two execution modes - immediate and deferred.There are two execution modes - immediate and deferred. The execution mode can be set by executing a set executemode command with immediate or deferred as the executemode value. If the execution mode is immediate then SQL statements are prepared and executed immediately. If execute mode is deferred then a statement is only prepared and not executed until either a # or go command is entered.The execution mode can be set by executing a set executemode command with immediate or deferred as the executemode value. If the execution mode is immediate then SQL statements are prepared and executed immediately. If execute mode is deferred then a statement is only prepared and not executed until either a # or go command is entered.

Interactive SQL Shell, cont. The result of executing the statement is displayed on the current device after the statement is executed.The result of executing the statement is displayed on the current device after the statement is executed. SQL statements can span multiple lines ( ).SQL statements can span multiple lines ( ). The Shell supports statement recall. Any statement that is prepared may be recalled from the statement buffer.The Shell supports statement recall. Any statement that is prepared may be recalled from the statement buffer. DISPLAYMODE – In this feature exists but is primarily a convenience. It does allude to the ability to produce an XML document from a result set. This will be developed more in DISPLAYMODE – In this feature exists but is primarily a convenience. It does allude to the ability to produce an XML document from a result set. This will be developed more in Let’s see some examples:Let’s see some examples:

What’s Next? Closer integration between Dynamic SQL and Zen/CSP.Closer integration between Dynamic SQL and Zen/CSP. SQL Manager in System Management Portal updated to use Dynamic SQL.SQL Manager in System Management Portal updated to use Dynamic SQL. TSQL and other shells may be integrated.TSQL and other shells may be integrated.