Top Banner
EMBARCADERO TECHNOLOGIES FireDAC: Local SQL Jim McKeeth Lead World Wide Developer Evangelist / Engineer [email protected] @JimMcKeeth / JimMcKeeth / Delphi.org March 19 th , 2015
13

FireDAC Local SQL Skill Sprint

Jul 15, 2015

Download

Technology

Jim McKeeth
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: FireDAC Local SQL Skill Sprint

EMBARCADERO  TECHNOLOGIESEMBARCADERO  TECHNOLOGIES

FireDAC:  Local  SQLJim  McKeeth  Lead  World  Wide  Developer  Evangelist  /  Engineer  [email protected]  @JimMcKeeth  /  JimMcKeeth  /  Delphi.org  March  19th,  2015

Page 2: FireDAC Local SQL Skill Sprint

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!

Page 3: FireDAC Local SQL Skill Sprint

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.

Page 4: FireDAC Local SQL Skill Sprint

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

Page 5: FireDAC Local SQL Skill Sprint

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

Page 6: FireDAC Local SQL Skill Sprint

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

Page 7: FireDAC Local SQL Skill Sprint

EMBARCADERO  TECHNOLOGIES

DEMONSTRATIONTFDLocalSQL

Page 8: FireDAC Local SQL Skill Sprint

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.

Page 9: FireDAC Local SQL Skill Sprint

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  

Page 10: FireDAC Local SQL Skill Sprint

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  

Page 11: FireDAC Local SQL Skill Sprint

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)

Page 12: FireDAC Local SQL Skill Sprint

EMBARCADERO  TECHNOLOGIES

RAD  Studio  Special  Offers

More  details  http://www.embarcadero.com/radoffer

March  31,  2015All  expire

Page 13: FireDAC Local SQL Skill Sprint

EMBARCADERO  TECHNOLOGIESEMBARCADERO  TECHNOLOGIES

Q  &  A  @EmbarcaderoTech

Special  offers:  http://embarcadero.com/radoffer/