EMBARCADERO TECHNOLOGIES FireDAC: Local SQL Jim McKeeth Lead World Wide Developer Evangelist / Engineer [email protected] @JimMcKeeth / JimMcKeeth / Delphi.org March 19 th , 2015
EMBARCADERO TECHNOLOGIESEMBARCADERO TECHNOLOGIES
FireDAC: Local SQLJim McKeeth Lead World Wide Developer Evangelist / Engineer [email protected] @JimMcKeeth / JimMcKeeth / Delphi.org March 19th, 2015
EMBARCADERO TECHNOLOGIES
This Skill Sprint Works with . . .
• Windows • Mac OS X • Android • iOS • RAD Studio • Appmethod • Object Pascal • C++
• RAD Studio XE7 DocWiki – http://embt.co/latestdocwiki – http://docwiki.embarcadero.com/RADStudio/en/
• Appmethod September 2014 DocWiki – http://embt.co/AppmethodTopics – http://docwiki.appmethod.com/appmethod/topics/en/
• Appmethod supports the FireMonkey framework on all 4 platforms while RAD Studio, Delphi and C++Builder also support VCL on Windows. Contact sales with any questions!
EMBARCADERO TECHNOLOGIES
FireDAC’s TFDLocalSQL for Local SQL
• Run SQL queries locally on TDataSet descendants. • Works for any TDataSet descendants. • Simplify code with SQL instead of spinning through records.
• Join queries between heterogeneous data sources. • Supports the INSERT/UPDATE/DELETE SQL commands as transactions and savepoints.
EMBARCADERO TECHNOLOGIES
Some Possible Uses
• Heterogeneous queries (Queryable datasets have result sets from different DBs).
• In-‐memory database (TFDMemTables serving as the datasets). • Advanced offline mode (While main DB is not accessible, an application is still able to perform the SQL queries locally.)
• Advanced DataSnap client (the data delivered by the DataSnap driver to the client can be queried locally).
• Simplified migration. (Use 3rd-‐party TDataSet objects in an application, and use FireDAC API to work with these data sources.)4
EMBARCADERO TECHNOLOGIES
Unsupported SQL and Alternatives
• ALTER TABLE ... ADD COLUMN -‐ Instead, change the structure via the DataSet.
• DROP TABLE -‐ When a dataset is unlinked from the Local SQL engine, it is automatically dropped (not freed).
• CREATE INDEX / DROP INDEX -‐ Instead of the SQL indexes, use the DataSet indexes.
• CREATE TRIGGER / DROP TRIGGER -‐ Instead of the triggers, use the DataSet events.
5
EMBARCADERO TECHNOLOGIES
Local SQL Components
6
TDataSet Descendant
TDataSet Descendant
TDataSet Descendant
TFDConnection w/ SQLite driver
TFDGUIxWaitCursor
(Wait Cursor)
TFDLocalSQLTFDQuery
or TFDCommand
ConnectionDataSets
Activate 2nd
Activate 1st
Activate 3rd
EMBARCADERO TECHNOLOGIES
TFDLocalSQL Summary
• Works with any TDataSet descendent. • Supports DML/CRUD, but no DDL. • Supports Transactions and SavePoints. • Uses SQLite internally. • Query across multiple heterogeneous DataSets.
EMBARCADERO TECHNOLOGIES
TFDLocalSQL Resources
• Samples – C:\Users\Public\Documents\Embarcadero\Studio\15.0\Samples\ Object Pascal\Database\FireDAC\Samples\Comp Layer\TFDLocalSQL
• DocWiki – http://docwiki.embarcadero.com/RADStudio/en/Local_SQL_(FireDAC) – http://docwiki.embarcadero.com/Libraries/en/FireDAC.Phys.SQLiteVDataSet.TFDLocalSQL • Blog Posts – Dmitry Arefiev – FireDAC Local SQL video: https://youtu.be/QA-‐xhfYoEq4 – CodeRage 9: FireDAC Tips, Tricks and News: http://youtu.be/gljfudAKlTI
– Jens Fudge’s Local SQL video: https://youtu.be/fJsmKiUz6VU – All these links and more: http://delphi.org/?p=1951
https://commons.wikimedia.org/wiki/File:Iceberg.jpg
EMBARCADERO TECHNOLOGIES
Next Time….
• Preview: Box2D • Sneak peak from a future release • Cross platform 2D physics engine • Tuesday the 24th of March – 6AM San Francisco / 9AM New York / 1PM London / 2PM Milan / 13 UTC – 11AM San Francisco / 2PM New York / 6PM London / 7PM Milan / 18 UTC – 5PM San Francisco / Wed 9AM Tokyo / Wed 11AM Sydney / 0 UTC
Sign-‐up: http://www.embarcadero.com/landing-‐pages/skill-‐sprints
EMBARCADERO TECHNOLOGIES
Next Time….
• FireDAC: BDE to InterBase Migration • Paradox and BDE are Deprecated • Take advantage of new FireDAC and InterBase features • Thursday the 26th of March – 6AM San Francisco / 9AM New York / 1PM London / 2PM Milan / 13 UTC – 11AM San Francisco / 2PM New York / 6PM London / 7PM Milan / 18 UTC – 5PM San Francisco / Fri 9AM Tokyo / Fri 11AM Sydney / 0 UTC
Sign-‐up: http://www.embarcadero.com/landing-‐pages/skill-‐sprints (2nd sign-‐up on the left)
EMBARCADERO TECHNOLOGIES
RAD Studio Special Offers
More details http://www.embarcadero.com/radoffer
March 31, 2015All expire
EMBARCADERO TECHNOLOGIESEMBARCADERO TECHNOLOGIES
Q & A @EmbarcaderoTech
Special offers: http://embarcadero.com/radoffer/