⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 asgsqlite3dsg.pas

📁 连接sqlite数据库控件
💻 PAS
📖 第 1 页 / 共 2 页
字号:
  if Connection = nil then begin                         // check to see if a valid database
    raise AsgError.Create('no database connection');     // object is linked
    exit;
  end;
  MyList := TStringList.Create;
  Connection.GetTableNames(MyList, true);
  if MyList.Count > 0 then                                                      // marc 20040222
     for i := 0 to MyList.Count - 1 do Proc(MyList[i]);
  MyList.Free;
 end;
end;

function TTablePropertyEditor.GetValue: string;
begin
  Result := GetStrValue;
end;

procedure TTablePropertyEditor.SetValue(const Value: string);
begin
  SetStrValue(Value);
end;

function TMasterDetailPropertyEditor.GetAttributes: TPropertyAttributes;
begin
  Result := [paDialog, paRevertable];
end;

procedure TMasterDetailPropertyEditor.GetValues(Proc: TGetStrProc);
var
    i,p    : integer;
    r      : string;
    oldr   : string;
begin
 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('Aducom SQLite3', [TASQLite3DB]);
  RegisterComponents('Aducom SQLite3', [TASQLite3Query]);
  RegisterComponents('Aducom SQLite3', [TASQLite3Table]);
  RegisterComponents('Aducom SQLite3', [TASQLite3UpdateSQL]);
  RegisterComponents('Aducom SQLite3', [TASQLite3Pragma]);
  RegisterComponents('Aducom SQLite3', [TASQLite3Log]);
  RegisterComponents('Aducom SQLite3', [TASQLite3InlineSQL]);
  RegisterComponents('Aducom 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 + -