13
EMBARCADERO TECHNOLOGIES InMemory Dataset TFDMemTable Jim McKeeth Lead World Wide Developer Evangelist / Engineer [email protected] @JimMcKeeth / JimMcKeeth / Delphi.org March 12 th , 2015

FireDAC Skill Sprint: In-Memory DataSet - TFDMemTable

Embed Size (px)

Citation preview

Page 1: FireDAC Skill Sprint: In-Memory DataSet - TFDMemTable

EMBARCADERO  TECHNOLOGIESEMBARCADERO  TECHNOLOGIES

In-­‐Memory  Dataset  TFDMemTableJim  McKeeth  Lead  World  Wide  Developer  Evangelist  /  Engineer  [email protected]  @JimMcKeeth  /  JimMcKeeth  /  Delphi.org  March  12th,  2015

Page 2: FireDAC Skill Sprint: In-Memory DataSet - TFDMemTable

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 Skill Sprint: In-Memory DataSet - TFDMemTable

EMBARCADERO  TECHNOLOGIES

TFDMemTable  the  Disconnected/In-­‐Memory  DataSet

• Design  time  &  Runtime  persistence  functions:    • Load  File,  Save  File  &  Assign  Data  • Streaming  for  multi-­‐tier  applications  • Used  with  REST  client  components,  DataSnap,  etc.  • Combine  with  Local  SQL  for  simple  query  operations  • Use  with  ETL  for  other  data  sources  (plain  text,  csv,  etc.)

Page 4: FireDAC Skill Sprint: In-Memory DataSet - TFDMemTable

EMBARCADERO  TECHNOLOGIES

Stream  and  File  Formats  (TFDStorageFormat)  

• sfAuto  • Based  on  file  extension  or  binary    • sfBinary  (uses  FireDAC.Stan.StorageBin)  • Most  efficient  -­‐  Signature:  “ADBS”  

• sfXML  (uses  FireDAC.Stan.StorageXML)  • <FDBS  Version="14">...  

• sfJSON  (uses  FireDAC.Stan.StorageJSON)  • {"FDBS":{"Version":14,  …

4 Image  by  Shane  Porter  -­‐  Used  under  Creative  Commonshttps://commons.wikimedia.org/wiki/File:Jeongbang_Waterfall.jpg  

BinaryJSO

N

XML

Page 5: FireDAC Skill Sprint: In-Memory DataSet - TFDMemTable

EMBARCADERO  TECHNOLOGIES

Common  Code  Samples//  Create  Field  Definitions  FDMemTable1.FieldDefs.Add('ID',  ftInteger,  0,  False);  FDMemTable1.FieldDefs.Add('Name',  ftString,  20,  False);  FDMemTable1.CreateDataSet;  

//  Append  data  FDMemTable1.Open;  FDMemTable1.AppendRecord([1,  'Jim']);  

//  Load  from  another  DataSet  FDMemTable1.CopyDataSet(DataSet1,  [coStructure,  coRestart,  coAppend]);

OP

Page 6: FireDAC Skill Sprint: In-Memory DataSet - TFDMemTable

EMBARCADERO  TECHNOLOGIES

Common  Code  Samples//  Create  Field  Definitions  FDMemTable1-­‐>FieldDefs-­‐>Add("ID",  ftInteger,  0,  False);  FDMemTable1-­‐>FieldDefs-­‐>Add("Name",  ftString,  20,  False);  FDMemTable1-­‐>CreateDataSet();  

//  Append  Data  FDMemTable1-­‐>Open();  FDMemTable1-­‐>Append();  FDMemTable1-­‐>FieldByName("ID")-­‐>AsInteger  =  1;  FDMemTable1-­‐>FieldByName("Name")-­‐>AsString  =  "Jim";  FDMemTable1-­‐>Post();  

//  Load  from  another  DataSet  FDMemTable1-­‐>CopyDataSet(DataSet1,  TFDCopyDataSetOptions()  <<  coStructure  <<  coRestart  <<  coAppend);  

C++

Page 7: FireDAC Skill Sprint: In-Memory DataSet - TFDMemTable

EMBARCADERO  TECHNOLOGIES

DEMONSTRATIONTFDMemTable

Page 8: FireDAC Skill Sprint: In-Memory DataSet - TFDMemTable

EMBARCADERO  TECHNOLOGIES

TFDMemTable  Summary

• A  TDataSet  for  in-­‐memory  or  disconnected  use.  • Supports  • Copy  from  another  DataSet  • File  and  stream  persistence  • Cached  updates  • Cloned  cursors  • Nested  datasets

Page 9: FireDAC Skill Sprint: In-Memory DataSet - TFDMemTable

EMBARCADERO  TECHNOLOGIES

TFDMemTable  Resources

• Samples  – C:\Users\Public\Documents\Embarcadero\Studio\15.0\Samples\  – \Object  Pascal\Database\FireDAC\Samples\Comp  Layer\TFDMemTable  – \Object  Pascal\Database\FireDAC\Samples\Comp  Layer\TFDLocalSQL  

• DocWiki  – http://docwiki.embarcadero.com/Libraries/en/FireDAC.Comp.Client.TFDMemTable    – http://docwiki.embarcadero.com/Libraries/en/FireDAC.Comp.Client.TFDCustomMemTable    – http://docwiki.embarcadero.com/RADStudio/en/TFDMemTable_Questions    • Blog  Posts  – CodeRage  9  Video:  TFDMemTable  &  CDS  Compared  http://youtu.be/iNgHJakYWkU    – Q&A  log:  http://wiert.me/2014/10/30/coderage-­‐9-­‐qa-­‐log-­‐clientdatasets-­‐and-­‐fdmemtables-­‐compared/      

– CodeRage  9  FireDAC  Tips,  Tricks  and  News:  http://youtu.be/gljfudAKlTI      – All  these  links  and  more:  http://delphi.org/?p=1933  

https://commons.wikimedia.org/wiki/File:Iceberg.jpg  

Page 10: FireDAC Skill Sprint: In-Memory DataSet - TFDMemTable

EMBARCADERO  TECHNOLOGIES

Next  Time….

• Preview:  EMS  Push  Notifications  • Sneak  peak  from  a  future  release  • Push  notifications  via  EMS  Server  • Tuesday  the  10th  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 Skill Sprint: In-Memory DataSet - TFDMemTable

EMBARCADERO  TECHNOLOGIES

Next  Time….

• FireDAC:  Local  SQL  • Execute  SQL  on  in-­‐memory  DataSets  • Works  with  multiple  DataSets  • Thursday  the  19th  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 Skill Sprint: In-Memory DataSet - TFDMemTable

EMBARCADERO  TECHNOLOGIES

RAD  Studio  Special  Offers

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

March  31,  2015All  expire

Page 13: FireDAC Skill Sprint: In-Memory DataSet - TFDMemTable

EMBARCADERO  TECHNOLOGIESEMBARCADERO  TECHNOLOGIES

Q  &  A  @EmbarcaderoTech

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