Open Solutions for a Changing World™ Copyright 2005, Data Access Worldwide June 6-9, 2005 Key Biscayne, Florida Table Types and Programming Styles John.

Slides:



Advertisements
Similar presentations
Introduction to ReportSmith and Effective Dated Tables
Advertisements

Session 2Introduction to Database Technology Data Types and Table Creation.
Data Access Worldwide May 16 – 18, 2007 Copyright 2007, Data Access Worldwide May 16 – 18, 2007 Copyright 2007, Data Access Worldwide Standardizing Application.
Some Introductory Programming 1. Structured Query Language (SQL) - used for queries. - a standard database product. 2. Visual Basic for Applications -
Quick-and-dirty.  Commands end in a semi-colon ◦ If you forget, another prompt line shows up  Either continue the command or…  End it with a semi-colon.
Automating Tasks With Macros
Fundamentals, Design, and Implementation, 9/e Chapter 11 Managing Databases with SQL Server 2000.
Automating Tasks With Macros. 2 Design a switchboard and dialog box for a graphical user interface Database developers interact directly with Access.
A Guide to Oracle9i1 Creating an Integrated Database Application Chapter 8.
A Guide to Oracle9i1 Advanced SQL And PL/SQL Topics Chapter 9.
Lecture Access – Tables. What are Tables? Records Fields.
Chapter 12 Database Connectivity with ASP.NET JavaScript, Third Edition.
Attribute databases. GIS Definition Diagram Output Query Results.
Chapter 7 Managing Data Sources. ASP.NET 2.0, Third Edition2.
Database Constraints. Database constraints are restrictions on the contents of the database or on database operations Database constraints provide a way.
LESSON 17 PREPARED BY MANJU. database A database is a collection of related information Access is the Microsoft Office database program that enables you.
The GUS 3.0 Perl Object Layer CBIL Jonathan Schug June
ODBC Unplugged: What’s New in the DataFlex Connectivity Kit for ODBC? John Kramel Senior Consultant Data Access Corporation.
8 Copyright © 2004, Oracle. All rights reserved. Creating LOVs and Editors.
Neo.NET Entity Objects Design Goals Copyright © Erik Dörnenburg – Last updated: May 2004.
JDBC Vs. Java Blend Presentation by Gopal Manchikanti Shivakumar Balasubramanyam.
Database System Concepts and Architecture Lecture # 3 22 June 2012 National University of Computer and Emerging Sciences.
Chapter 6 Additional Database Objects
Data-mining & Data As we used Excel that has capability to analyze data to find important information, the data-mining helps us to extract information.
DataFlex Web Framework Symposium – Part 2 Web Framework Overview John Tuohy Development Team
Inside the WebApp Classes John Tuohy Data Access Worldwide.
CODD’s 12 RULES OF RELATIONAL DATABASE
Object-Oriented Frameworks for Migrating Structured Data April 2004.
© Logicalis Group Using DB2/400 effectively. Data integrity facilities Traditional iSeries database usage Applications are responsible for data integrity.
Chapter 6 Additional Database Objects Oracle 10g: SQL.
DataFlex Connectivity Kit for Pervasive.SQL Eddy Kleinjan.
Open Solutions for a Changing World™ Copyright 2005, Data Access Worldwide June 6-9, 2005 Key Biscayne, Florida 1 Pervasive.SQL Version 9 - What’s New.
Technical Team WITSML SIG Dubai - November 2008 John Shields / Gary Masters.
Chapter 38 Persistence Framework with Patterns 1CS6359 Fall 2011 John Cole.
6.1 © 2010 by Prentice Hall 6 Chapter Foundations of Business Intelligence: Databases and Information Management.
Tutorial 91 Databases A database is an organized collection of related information stored in a file on a disk A database allows companies to store information.
DAY 15: ACCESS CHAPTER 1 Rahul Kavi October 6,
3 Copyright © 2004, Oracle. All rights reserved. Working in the Forms Developer Environment.
Open Solutions for a Changing World™ Copyright 2005, Data Access Worldwide June 6-9, 2005 Key Biscayne, Florida Using the Crystal RDC Interface in Visual.
XP New Perspectives on Microsoft Office Access 2003 Tutorial 10 1 Microsoft Office Access 2003 Tutorial 10 – Automating Tasks With Macros.
Database Management Supplement 1. 2 I. The Hierarchy of Data Database File (Entity, Table) Record (info for a specific entity, Row) Field (Attribute,
Dr Gordon Russell, Napier University Unit Embedde SQL - V2.0 1 Embedded SQL Unit 5.1.
Open Solutions for a Changing World™ Copyright 2005, Data Access Worldwide June 6-9, 2005 Key Biscayne, Florida Visual DataFlex 11 an Overview John J Tuohy.
Database Basics BCIS 3680 Enterprise Programming.
Open Solutions for a Changing World™ Copyright 2005, Data Access Worldwide June 6-9, 2005 Key Biscayne, Florida 1 Application Deployment Stephen W. Meeley.
Chapter 5 Introduction To Form Builder. Lesson A Objectives  Display Forms Builder forms in a Web browser  Use a data block form to view, insert, update,
Mr C Johnston ICT Teacher
The business logic engine for Microsoft IIS Speaker T.M. Arnett.
What is MySQL? MySQL is a relational database management system (RDBMS) based on SQL (Structured Query Language). First released in January, Many.
Understand Primary, Foreign, and Composite Keys Database Administration Fundamentals LESSON 4.2.
Database Connectivity with ASP.NET. 2 Introduction Web pages commonly used to: –Gather information stored on a Web server database Most server-side scripting.
SAP DEVELOPMENT BASICS Bohuslav Tesar. TRAINING OVERVIEW Amazing life of ABAP developer ;) SAP introduction ABAP basics ABAP Reporting.
* Database is a group of related objects * Objects can be Tables, Forms, Queries or Reports * All data reside in Tables * A Row in a Table is a record.
The business logic engine for Microsoft IIS Speaker T.M. Arnett.
Open Solutions for a Changing World™ Copyright 2005, Data Access Worldwide June 6-9, 2005 Key Biscayne, Florida 1 Techniques for using Visual DataFlex.
Data Access Worldwide May 16 – 18, 2007 Copyright 2007, Data Access Worldwide May 16 – 18, 2007 Copyright 2007, Data Access Worldwide Product Roadmap John.
Java Programming: Advanced Topics 1 Enterprise JavaBeans Chapter 14.
Chapter 12Introduction to Oracle9i: SQL1 Chapter 12 Additional Database Objects.
Chapter 3: Relational Databases
1 A Very Brief Introduction to Relational Databases.
CHAPTER 7 LESSON C Creating Database Reports. Lesson C Objectives  Display image data in a report  Manually create queries and data links  Create summary.
Open Solutions for a Changing World™ Copyright 2005, Data Access Worldwide June 6-9, 2005 Key Biscayne, Florida Extending Existing Applications to the.
1 Section 1 - Introduction to SQL u SQL is an abbreviation for Structured Query Language. u It is generally pronounced “Sequel” u SQL is a unified language.
Open Solutions for a Changing World™ Copyright 2005, Data Access Worldwide June 6-9, 2005 Key Biscayne, Florida Welcome to Synergy 2005! Connect! Chip.
Connectivity in DataFlex 19.0
Database Fundamentals
Data Definition Language
Chapter 11 Managing Databases with SQL Server 2000
IBM C IBM Big Data Engineer. You want to train yourself to do better in exam or you want to test your preparation in either situation Dumpspedia’s.
Presentation transcript:

Open Solutions for a Changing World™ Copyright 2005, Data Access Worldwide June 6-9, 2005 Key Biscayne, Florida Table Types and Programming Styles John J Tuohy Data Access Worldwide

Open Solutions for a Changing World™ Copyright 2005, Data Access Worldwide June 6-8,2005 Key Biscayne, Florida Record Identity  The Visual DataFlex Framework requires that every record in a Table have a unique Identifier  Record Identity is used to re-find records Used by the Runtime (e.g., DDOs) Used by commands (e.g., reread) Used by the Framework (e.g., packages) Used within developer’s code  Requirements Must provide a unique method for identifying the record Must be permanent (mostly) Must provide fastest possible access to single record Must support a generic style of programming that can be applied to all tables

Open Solutions for a Changing World™ Copyright 2005, Data Access Worldwide June 6-8,2005 Key Biscayne, Florida Using Recnum for Record Identity  Represented as a single numeric field  Uses known data-type (number) and field location (field zero)  Provides fastest possible access to Embedded database  Provides fastest possible access to PSQL database  Works well if you can define your tables structure  Consistent programming syntax across all tables  It’s what DataFlex has always used

Open Solutions for a Changing World™ Copyright 2005, Data Access Worldwide June 6-8,2005 Key Biscayne, Florida Recnum Syntax // Low level commands using recnum Reread : Integer iTempRec Move Customer.Recnum to iTempRec Clear Customer : If (iTempRec<>0) Begin Move iTempRec to Customer.Recnum Find EQ Customer by recnum End // Data Dictionary methods using recnum Integer iTempRec Integer iFile Get Current_Record of hoDDO to iTempRec Send Clear to hoDDO : Get Main_File of hoDDO to iFile Send Find_by_Recnum of hoDDO iFile iTempRec

Open Solutions for a Changing World™ Copyright 2005, Data Access Worldwide June 6-8,2005 Key Biscayne, Florida Recnum limitations  If your table does not have a unique numeric field, you cannot use the table in your application  This limits you ability to connect to existing tables

Open Solutions for a Changing World™ Copyright 2005, Data Access Worldwide June 6-8,2005 Key Biscayne, Florida Using Primary Key for Record Identity  Almost all tables support a primary key  Even Tables with Recnums should also have a primary key  Primary keys can be defined as one or more columns  Primary key column(s) can be of any data-type(s) and location(s)

Open Solutions for a Changing World™ Copyright 2005, Data Access Worldwide June 6-8,2005 Key Biscayne, Florida Primary Key Syntax // low level commands using primary key String sTempId Move Customer.Customer_Id to sTempId Clear Customer : If (sTempId<>””) Begin Move sTempId to Customer.Customer_Id Find EQ Customer by 1 // find EQ by index 1 End // Data Dictionary methods using primary key String sTempId Get Field_Current_Value of hoDDO Field Customer.Customer_Id to sTempId Send Clear to hoDDO : Move sTempId to Customer.Customer_Id Send Find of hoDDO EQ 1 // find EQ mode and index 1

Open Solutions for a Changing World™ Copyright 2005, Data Access Worldwide June 6-8,2005 Key Biscayne, Florida Primary Key Limitations  Each Primary Key table definition is unique.  There is no generic way to access primary key information in a program that works with all tables  It may not be the fastest way to get at a record

Open Solutions for a Changing World™ Copyright 2005, Data Access Worldwide June 6-8,2005 Key Biscayne, Florida Using RowId for Record Identity  It is a virtual field There will never be a RowId column in your table A table’s column, columns or some other attribute will be mapped to RowId  Special syntax has been created to support RowId  All tables now support the use of RowId syntax  The RowId syntax is generic – all tables can use the same syntax

Open Solutions for a Changing World™ Copyright 2005, Data Access Worldwide June 6-8,2005 Key Biscayne, Florida RowId Syntax // Low level commands using RowId RowId riTempId Boolean bFound Move (GetRowId(Customer.File_Number)) to riTempId Clear Customer : If not (IsNullRowId(riTempId)) Begin Move (FindByRowId(Customer.File_Number,riTempId)) to bFound End // Data Dictionary methods using RowId RowId riTempId Get CurrentRowId of hoDDO to riTempId Send Clear to hoDDO : Send FindByRowId of hoDDO Customer.File_Number riTempId

Open Solutions for a Changing World™ Copyright 2005, Data Access Worldwide June 6-8,2005 Key Biscayne, Florida RowId Limitations  None

Open Solutions for a Changing World™ Copyright 2005, Data Access Worldwide June 6-8,2005 Key Biscayne, Florida The RowId Interface  New Data Type RowIdRowId riRowId riRowId2 Property RowId priLastRecord  New Global Functions GetRowIdMove (GetRowId,iFile)) to riRowId FindByRowIdMove (FindByRowId, iFile, riRowId) to bFound NullRowIdMove (NullRowId()) to riRowId IsNullRowIdMove (IsNullRowId(riRowId)) to bIsNull IsSameRowIdMove (IsSameRowId(riRowId,riRowId2) to bSame SerializeRowIdMove (SerializeRowId(riRowId)) to sSerialRowId DeSerializeRowIdMove (DeSerializeRowId(sSerialRowId)) to riRowId  New DataDictionary Interface FindByRowIdSend FindByRowId of hoDD iFile riRowId ReadByRowIdSend ReadByRowId of hoDD iFile riRowId CurrentRowIdGet CurrentRowId of hoDD iFile to riRowId HasRecordGet HasRecord of hoDD to bHasRecord OnNewCurrentRecordSend OnNewCurrentRecord riOldId riNewId

Open Solutions for a Changing World™ Copyright 2005, Data Access Worldwide June 6-8,2005 Key Biscayne, Florida The Recnum “side-effects” Interface  You may not need any other index  You can traverse through a table via index.0  It provides an order (sometimes)  You can use it in relationships  You may use it as your primary key  It's an easy way to make indexes unique  It’s used to inactivate a record  Undocumented and often unintentional interaction between find operations and the value of recnum  The RowId Interface has no side-effect behaviors

Open Solutions for a Changing World™ Copyright 2005, Data Access Worldwide June 6-8,2005 Key Biscayne, Florida Programming Changes for RowId  Changes made by DAW in Visual DataFlex 11.0 Runtime changed to use RowId (e.g. reread, DDOs) All packages were re-written to use RowId All Sample were changed to use RowId All wizard generate RowId code Database Builder changed to support RowId Connectivity API changed to support RowId Drivers changed to support RowId

Open Solutions for a Changing World™ Copyright 2005, Data Access Worldwide June 6-8,2005 Key Biscayne, Florida Programming Changes for RowId  Developer required changes None

Open Solutions for a Changing World™ Copyright 2005, Data Access Worldwide June 6-8,2005 Key Biscayne, Florida Table Types: Recnum & Non-Recnum  A Table can be either Recnum or Non-Recnum enabled  When you define a new table you can choose to provide a recnum field.  Some databases will always have a recnum (Embedded Database,P.SQL) while others are optional  Defined in database builder Database Builder will attempt to make the best choice for you  Embedded Database and P.SQL always use recnum  When connecting to an SQL table (e.g. MSSQL) a recnum field will be defined if a “recnum-like” field is found; otherwise, Database Builder will attempt to use the Primary key for its RowId  When you use RowId programming syntax it does matter what you table type is – you code remains the same.

Open Solutions for a Changing World™ Copyright 2005, Data Access Worldwide June 6-8,2005 Key Biscayne, Florida Should I continue to use Recnum Tables?  It’s your choice  Recnum support will not go away!  Use of Recnum is a time tested technique  Many developers have much code invested in Recnum usage  You can mix Recnum and RowId style programming  All tables support the RowId syntax You can use RowId or Recnum syntax with Recnum Tables You must use RowId syntax with non-Recnum Tables  All tables can be defined to support Recnum If you control the database table definitions you can always supply a recnum field

Open Solutions for a Changing World™ Copyright 2005, Data Access Worldwide June 6-8,2005 Key Biscayne, Florida Developer Strategies for Using RowId Syntax 1.Write your new code to using RowId Syntax Pros:Allows your code to work with non-Recnum tables New syntax is clearer with no side-effects Easier for new developers to learn Cons:Learning curve - You already know the old syntax Overhead of mixed syntax application 2.Change you class packages to use RowId Syntax Pros:Allows your class code to work with non-Recnum tables Cons:If you change it, you will break it. It's work 3.Change your old code to use RowId Syntax Pros:New syntax is clearer with no side-effects Cons:If you change it, you will break it. It's work End result is your application runs the same