📄 asgsqlite3dsg.pas
字号:
With GetComponent(0) As TASQLite3BaseQuery Do Begin
If Not Assigned(MasterSource) Then Begin
Proc('');
Exit;
End;
If Not Assigned(MasterSource.Dataset) Then Begin
Proc('');
Exit;
End;
FMD := TFMD.Create(Application);
If Not Active Then open;
If Not Active Then Exit;
For i := 0 To FieldDefs.Count - 1 Do
FMD.LBDetail.Items.Add(FieldDefs.Items[i].Name);
If Not MasterSource.Dataset.Active Then MasterSource.Dataset.open;
If Not MasterSource.Dataset.Active Then Exit;
For i := 0 To MasterSource.Dataset.FieldDefs.Count - 1 Do
FMD.LBMaster.Items.Add(MasterSource.Dataset.FieldDefs.Items[i].Name);
r := MasterFields;
oldr := r;
While r <> '' Do Begin
p := Pos(';', r);
If p = 0 Then Begin
If Trim(r) <> '' Then FMD.LBLinked.Items.Add(Trim(r));
r := '';
End Else Begin
FMD.LBLinked.Items.Add(Trim(Copy(r, 1, p - 1)));
System.Delete(r, 1, p);
End;
End;
If FMD.ShowModal = mrOk Then Begin
For i := 0 To FMD.LBLinked.Items.Count - 1 Do Begin
r := r + FMD.LBLinked.Items[i] + ';';
End;
End Else r := oldr;
FMD.Free;
End;
Proc(r);
End;
Function TMasterDetailPropertyEditor.GetValue: String;
Begin
Result := GetStrValue;
End;
Procedure TMasterDetailPropertyEditor.SetValue(Const Value: String);
Begin
SetStrValue(Value);
End;
Function TStoragePropertyEditor.GetAttributes: TPropertyAttributes;
Begin
Result := [paValueList, paRevertable];
End;
Procedure TStoragePropertyEditor.GetValues(Proc: TGetStrProc);
Begin
Proc('DEFAULT');
Proc('MEMORY');
Proc('FILE');
End;
Function TStoragePropertyEditor.GetValue: String;
Begin
Result := GetStrValue;
End;
Procedure TStoragePropertyEditor.SetValue(Const Value: String);
Begin
SetStrValue(Value);
End;
Function TSyncPropertyEditor.GetAttributes: TPropertyAttributes;
Begin
Result := [paValueList, paRevertable];
End;
Procedure TSyncPropertyEditor.GetValues(Proc: TGetStrProc);
Begin
Proc('FULL');
Proc('NORMAL');
Proc('OFF');
End;
Function TSyncPropertyEditor.GetValue: String;
Begin
Result := GetStrValue;
End;
Procedure TSyncPropertyEditor.SetValue(Const Value: String);
Begin
SetStrValue(Value);
End;
Function TDirPropertyEditor.GetAttributes: TPropertyAttributes;
Begin
Result := [paDialog, paRevertable];
End;
Procedure TDirPropertyEditor.GetValues(Proc: TGetStrProc);
Var Dir: String;
Begin
Dir := 'C:\';
SelectDirectory(Dir, [sdAllowCreate, sdPerformCreate, sdPrompt], 0);
Proc(Dir);
End;
Function TDirPropertyEditor.GetValue: String;
Begin
Result := GetStrValue;
End;
Procedure TDirPropertyEditor.SetValue(Const Value: String);
Begin
SetStrValue(Value);
End;
Function TDLLDirPropertyEditor.GetAttributes: TPropertyAttributes;
Begin
Result := [paDialog, paRevertable];
End;
Procedure TDLLDirPropertyEditor.GetValues(Proc: TGetStrProc);
Var Dir: String;
// Drv : string;
Begin
Dir := 'C:\';
SelectDirectory(Dir, [sdAllowCreate, sdPerformCreate, sdPrompt], 0);
// ExtractFileDrive(Dir);
// if Drv=''
If Dir[Length(Dir)] <> '\' Then Dir := Dir + '\';
Proc(Dir + 'sqlite3.dll');
End;
Function TDLLDirPropertyEditor.GetValue: String;
Begin
Result := GetStrValue;
End;
Procedure TDLLDirPropertyEditor.SetValue(Const Value: String);
Begin
SetStrValue(Value);
End;
Function TFileTypePropertyEditor.GetAttributes: TPropertyAttributes;
Begin
Result := [paValueList, paRevertable];
End;
Procedure TFileTypePropertyEditor.GetValues(Proc: TGetStrProc);
Begin
Proc('htmlfile');
Proc('xmlfile');
Proc('textfile');
End;
Function TFileTypePropertyEditor.GetValue: String;
Begin
Result := GetStrValue;
End;
Procedure TFileTypePropertyEditor.SetValue(Const Value: String);
Begin
SetStrValue(Value);
End;
Function TTransactionPropertyEditor.GetAttributes: TPropertyAttributes;
Begin
Result := [paValueList, paRevertable];
End;
Procedure TTransactionPropertyEditor.GetValues(Proc: TGetStrProc);
Begin
Proc('DEFAULT');
Proc('DEFERRED');
Proc('IMMEDIATE');
Proc('EXCLUSIVE');
End;
Function TTransactionPropertyEditor.GetValue: String;
Begin
Result := GetStrValue;
End;
Procedure TTransactionPropertyEditor.SetValue(Const Value: String);
Begin
SetStrValue(Value);
End;
Function TCharEncPropertyEditor.GetAttributes: TPropertyAttributes;
Begin
Result := [paValueList, paRevertable];
End;
Procedure TCharEncPropertyEditor.GetValues(Proc: TGetStrProc);
Begin
Proc('STANDARD');
Proc('UTF8');
// Proc('OFF');
End;
Function TCharEncPropertyEditor.GetValue: String;
Begin
Result := GetStrValue;
End;
Procedure TCharEncPropertyEditor.SetValue(Const Value: String);
Begin
SetStrValue(Value);
End;
{ This procedure is used to register this component on the component palette }
Procedure Register;
Begin
RegisterPropertyEditor(TypeInfo(String), TASQLite3DB, 'Database',
TASQLite3DatabaseProperty);
RegisterPropertyEditor(TypeInfo(String), TASQLite3DB, 'DefaultDir',
TASQLite3DirProperty);
RegisterPropertyEditor(TypeInfo(String), TASQLite3DB, 'DriverDLL',
TASQLite3DLLDirProperty);
RegisterPropertyEditor(TypeInfo(String), TASQLite3Table, 'TableName',
TASQLite3TableNameProperty);
RegisterPropertyEditor(TypeInfo(String), TASQLite3BaseQuery, 'MasterFields',
TASQLite3MasterDetailProperty);
RegisterPropertyEditor(TypeInfo(String), TASQLite3Pragma, 'TempStore',
TASQLite3StorageProperty);
RegisterPropertyEditor(TypeInfo(String), TASQLite3Pragma, 'DefaultTempStore',
TASQLite3StorageProperty);
RegisterPropertyEditor(TypeInfo(String), TASQLite3Pragma, 'Synchronous',
TASQLite3SyncProperty);
RegisterPropertyEditor(TypeInfo(String), TASQLite3Pragma, 'DefaultSynchronous',
TASQLite3SyncProperty);
RegisterPropertyEditor(TypeInfo(String), TASQLite3Output, 'OutputType',
TASQLite3FileTypeProperty);
RegisterPropertyEditor(TypeInfo(String), TASQLite3BaseQuery, 'TransactionType',
TASQLite3TransactionProperty);
RegisterPropertyEditor(TypeInfo(String), TASQLite3DB, 'TransactionType',
TASQLite3TransactionProperty);
RegisterPropertyEditor(TypeInfo(String), TASQLite3DB, 'CharacterEncoding',
TASQLite3CharEncProperty);
RegisterComponents('SQLite3', [TASQLite3DB]);
RegisterComponents('SQLite3', [TASQLite3Query]);
RegisterComponents('SQLite3', [TASQLite3Table]);
RegisterComponents('SQLite3', [TASQLite3UpdateSQL]);
RegisterComponents('SQLite3', [TASQLite3Pragma]);
RegisterComponents('SQLite3', [TASQLite3Log]);
RegisterComponents('SQLite3', [TASQLite3InlineSQL]);
RegisterComponents('SQLite3', [TASQLite3Output]);
RegisterComponentEditor(TASQLite3DB, TASQLiteEditor);
RegisterComponentEditor(TASQLite3Query, TASQLiteEditor);
RegisterComponentEditor(TASQLite3Table, TASQLiteEditor);
RegisterComponentEditor(TASQLite3UpdateSQL, TASQLiteEditor);
RegisterComponentEditor(TASQLite3Pragma, TASQLiteEditor);
RegisterComponentEditor(TASQLite3Log, TASQLiteEditor);
RegisterComponentEditor(TASQLite3InlineSQL, TASQLiteEditor);
RegisterComponentEditor(TASQLite3Output, TASQLiteEditor);
End;
End.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -