数据库的管理

通过TFDSQLiteSecurity可以对数据库进行加密处理:

with sqlSecurity do begin
    Database := 'x:\path_to_database\db.sdb';
    Password := 'p@ssword';
    ToPassword := 'p@ssword_changed';
    case rgSecActions.ItemIndex of//是一个radiogroup
    C_SET_PASSWORD:    SetPassword;//0
    C_REMOVE_PASSWORD: RemovePassword;//1
    C_CHANGE_PASSWORD: ChangePassword;//2
    end;
  end;

通过TFDSQLiteValidate可以对数据库进行检查、分析和空间清理。

 

 with sqlValidate do begin
    Database := 'x:\path_to_database\db.sdb';
    Password := 'p@ssword';
    case rgValActions.ItemIndex of
    C_ANALYZE: Analyze;
    C_CHECKONLY:
      if not CheckOnly then
        Memo1.Lines.Add('Database has problems !')
      else
        Memo1.Lines.Add('Database is valid');
    C_SWEEP: Sweep;
    end;
  end;

通过 TFDSQLiteBackup可以对数据库进行备份操作。

  with sqlBackup do begin
    Database := 'x:\path_to_database\db.sdb';
    DestDatabase := 'x:\path_to_database\db.backup';
    Password := 'p@ssword';
    DestPassword := 'dest_p@ssword';
    Backup; 
  end;

 

posted @ 2022-11-22 09:19  Luo大哥  阅读(67)  评论(0编辑  收藏  举报