Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- unit Unit1;
- interface
- uses
- Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
- Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Data.DB, FireDAC.Stan.Intf,
- FireDAC.Stan.Option, FireDAC.Stan.Param, FireDAC.Stan.Error, FireDAC.DatS,
- FireDAC.Phys.Intf, FireDAC.DApt.Intf, FireDAC.Stan.StorageBin,
- FireDAC.UI.Intf, FireDAC.Stan.Def, FireDAC.Stan.Pool, FireDAC.Stan.Async,
- FireDAC.Phys, FireDAC.Phys.SQLite, FireDAC.Phys.SQLiteDef,
- FireDAC.Stan.ExprFuncs, FireDAC.VCLUI.Wait, FireDAC.DApt, FireDAC.Comp.Client,
- FireDAC.Comp.DataSet, Vcl.Grids, Vcl.DBGrids, Vcl.StdCtrls;
- type
- TForm1 = class(TForm)
- FDMemTable1: TFDMemTable;
- DBGrid1: TDBGrid;
- DataSource1: TDataSource;
- FDConnection1: TFDConnection;
- DBGrid2: TDBGrid;
- DataSource2: TDataSource;
- FDTable1: TFDTable;
- Button1: TButton;
- Button2: TButton;
- FDSQLiteBackup1: TFDSQLiteBackup;
- FDPhysSQLiteDriverLink1: TFDPhysSQLiteDriverLink;
- Button3: TButton;
- procedure Button1Click(Sender: TObject);
- procedure Button2Click(Sender: TObject);
- procedure Button3Click(Sender: TObject);
- private
- { Private declarations }
- procedure DoNothing;
- public
- { Public declarations }
- end;
- var
- Form1: TForm1;
- implementation
- {$R *.dfm}
- procedure TForm1.DoNothing;
- begin
- // Literally nothing.
- end;
- procedure TForm1.Button1Click(Sender: TObject);
- begin
- FDTable1.Close;
- FDTable1.TableName := 'Copied Data';
- FDTable1.FieldDefs.Clear;
- FDTable1.FieldDefs.Assign(FDMemTable1.FieldDefs);
- FDTable1.CreateTable(True);
- FDTable1.CopyDataSet(FDMemTable1, [coStructure, coRestart, coAppend]);
- FDTable1.Open;
- DoNothing;
- end;
- procedure TForm1.Button2Click(Sender: TObject);
- begin
- //FDConnection1.DriverName := 'SQLite';
- FDConnection1.Open;
- FDSQLiteBackup1.DatabaseObj := FDConnection1.CliObj;
- FDSQLiteBackup1.DestDatabase := 'C:\Users\...\data.sdb';
- //FDSQLiteBackup1.DestMode := smCreate;
- FDSQLiteBackup1.Backup;
- ShowMessage('Backup Complete');
- end;
- procedure TForm1.Button3Click(Sender: TObject);
- begin
- FDTable1.Close;
- ShowMessage('Backup Check');
- FDConnection1.Close;
- FDConnection1.Params.Database := 'C:\Users\...\data.sdb';
- FDConnection1.Open;
- FDTable1.Open('COPIED DATA');
- end;
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement