1 / 18

Let’s do data!

Let’s do data!. Venelina Jordanova JEI Varna, Bulgaria. Who am I ?. Master degree in CS from TU of Varna MCP FoxPro developer since v 2.0 Developer of wide range information systems

knoton
Download Presentation

Let’s do data!

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Let’s do data! Venelina Jordanova JEI Varna, Bulgaria The Power of CursorAdapters

  2. Who am I ? • Master degree in CS from TU of Varna • MCP • FoxPro developer since v 2.0 • Developer of wide range information systems • Speaker at Frankfurt DevCon 2003, 2004, 2005 and 2006, Prague 2004, 2005, 2006 and 2007, Utrecht 2006, Paris 2006 and Microsoft DevDays - Bulgaria • Owner of JEI - Varna, Bulgaria Outsourcing center Venelina@OutsourcingITservices.net The Power of CursorAdapters

  3. Overview • CursorAdapter class specifics • Special events of CursorAdapter class • Data retrieval tricks • Different data engines specifics • Conflict management • Error processing and server side debugging The Power of CursorAdapters

  4. Benefits of CursorAdapter class • Working in mixed environment • Access to various data sources • Creates VFP cursor • Automatically generated SQL statements • Large set of very useful events • Error handling The Power of CursorAdapters

  5. BeforeCursorFill event • Closes existing cursor • lUseCursorSchema, lNoDataOnLoad, cSelectCmd parameters passed by reference • Changed cSelectCmd will be used • Make sure you pass them to next subclassing level by reference, too The Power of CursorAdapters

  6. BeforeCursorRefresh event • Does not close existing cursor • cSelectCmd statement used by last CursorRefresh is reused • Make sure to pass all the editable parameters by reference The Power of CursorAdapters

  7. Events raised before sending updates • Events: • BeforeCursorUpdate • BeforeInsert • BeforeUpdate • BeforeDelete • Make sure to pass all the editable parameters by reference • Developer specified commands The Power of CursorAdapters

  8. Events raised after sending updates • Events: • AfterCursorUpdate • AfterInsert • AfterUpdate • AfterDelete • Error handling • Obtain auto-generated values in AfterInsert event The Power of CursorAdapters

  9. Parameterized SELECT commands • Prefix parameter variables with “?” when working with ODBC provider • make sure all the parameters exist and have correct value at the time when object initializes and every time when CursorFill or CursorRefresh is executed • ADOCommand parameters when using ADODB provider The Power of CursorAdapters

  10. Tables with more than 255 fields • Split into “main” and “slave” cursor • Updating a record • Inserting a new record • Deleting a record • Use transactions to ensure data consistency The Power of CursorAdapters

  11. Querying more than one table in SELECT command • Tables property • UpdateFieldList property • CursorAdapter class generates a complex update statement • DELETE commands are generated for all the tables that CursorAdapter object updates. The Power of CursorAdapters

  12. Using stored procedures • InsertCmd = “EXECUTE InsertOrderEntry … “ • Passing parameters The Power of CursorAdapters

  13. ODBC or ADO? • Establishing a conection • ODBC • SQLSTRINGCONNECT() or SQLCONNECT() • ADODB loConnDataSource = CREATEOBJECT('ADODB.Connection') loConnDataSource.ConnectionString = [Provider=SQLOLEDB.1...] loConnDataSource.Open() This.DataSource = CREATEOBJECT('ADODB.RecordSet') This.DataSource.ActiveConnection = loConnDataSource The Power of CursorAdapters

  14. Working with different database engines • Using quoted identifiers • Delimiter characters for different database servers • Syntax specifics • ANSI-92 compliant functions • Using server-specific functions The Power of CursorAdapters

  15. Retrieving auto generated field values • @@IDENTITY variable • The functions SCOPE_IDENTITY() and IDENT_CURRENT( 'table_name' ) • CursorAdapter class auto-refresh functionality • InsertCmdRefreshCmd • InsertCmdRefreshFieldList • InsertCmdRefreshKeyFieldList The Power of CursorAdapters

  16. Error processing • BreakOnError property of CursorAdapter class • Errors, raised by backend database • Passing parameters • Parameters data types • Manage conflicts The Power of CursorAdapters

  17. Debugging • T-SQL commandexecution • Using SELECT statement to debug update conflicts • SQL Server Profiler The Power of CursorAdapters

  18. Thank you! Please remember to fill out your evaluation. The Power of CursorAdapters

More Related