mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-09 08:47:59 +02:00
removed obsolete files
git-svn-id: trunk@8839 -
This commit is contained in:
parent
110584d448
commit
99cc7aced3
4
.gitattributes
vendored
4
.gitattributes
vendored
@ -365,13 +365,9 @@ components/sqlite/sqlitecomponenteditor.lfm svneol=native#text/plain
|
||||
components/sqlite/sqlitecomponenteditor.lrs svneol=native#text/plain
|
||||
components/sqlite/sqlitecomponenteditor.pas svneol=native#text/plain
|
||||
components/sqlite/sqliteds.lrs svneol=native#text/pascal
|
||||
components/sqlite/sqlitedslaz.lpk svneol=native#text/pascal
|
||||
components/sqlite/sqlitedslaz.pas svneol=native#text/pascal
|
||||
components/sqlite/sqliteicon.lrs svneol=native#text/plain
|
||||
components/sqlite/sqlitelaz.lpk svneol=native#text/plain
|
||||
components/sqlite/sqlitelaz.pas svneol=native#text/plain
|
||||
components/sqlite/tableeditorform.lrs svneol=native#text/pascal
|
||||
components/sqlite/tableeditorform.pas svneol=native#text/pascal
|
||||
components/sqlite/tsqlite3dataset.xpm svneol=native#text/plain
|
||||
components/sqlite/tsqlitedataset.xpm -text svneol=native#image/x-xpixmap
|
||||
components/synedit/allsyneditunits.pp svneol=native#text/pascal
|
||||
|
@ -1,66 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<CONFIG>
|
||||
<Package Version="2">
|
||||
<Name Value="sqlitedslaz"/>
|
||||
<Author Value="Luiz Americo Pereira Camara"/>
|
||||
<AutoUpdate Value="Manually"/>
|
||||
<CompilerOptions>
|
||||
<Version Value="5"/>
|
||||
<SearchPaths>
|
||||
<OtherUnitFiles Value="$(LazarusDir)/;$(LazarusDir)/components/units/$(TargetCPU)/$(TargetOS)/;$(LazarusDir)/designer/units/"/>
|
||||
<UnitOutputDirectory Value="lib/"/>
|
||||
</SearchPaths>
|
||||
<CodeGeneration>
|
||||
<Generate Value="Faster"/>
|
||||
</CodeGeneration>
|
||||
<Other>
|
||||
<CompilerPath Value="$(CompPath)"/>
|
||||
</Other>
|
||||
</CompilerOptions>
|
||||
<Description Value="Sqlite 2.8.x (TSqliteDataset) package
|
||||
"/>
|
||||
<License Value="LGPL
|
||||
"/>
|
||||
<Version Minor="2"/>
|
||||
<Files Count="5">
|
||||
<Item1>
|
||||
<Filename Value="sqliteds.pas"/>
|
||||
<Type Value="Virtual Unit"/>
|
||||
<UnitName Value="sqliteds"/>
|
||||
</Item1>
|
||||
<Item2>
|
||||
<Filename Value="tableeditorform.lfm"/>
|
||||
<Type Value="LFM"/>
|
||||
</Item2>
|
||||
<Item3>
|
||||
<Filename Value="tableeditorform.lrs"/>
|
||||
<Type Value="LRS"/>
|
||||
</Item3>
|
||||
<Item4>
|
||||
<Filename Value="tableeditorform.pas"/>
|
||||
<HasRegisterProc Value="True"/>
|
||||
<UnitName Value="tableeditorform"/>
|
||||
</Item4>
|
||||
<Item5>
|
||||
<Filename Value="sqlitedsicon.lrs"/>
|
||||
<Type Value="LRS"/>
|
||||
</Item5>
|
||||
</Files>
|
||||
<Type Value="RunAndDesignTime"/>
|
||||
<RequiredPkgs Count="2">
|
||||
<Item1>
|
||||
<PackageName Value="LCL"/>
|
||||
</Item1>
|
||||
<Item2>
|
||||
<PackageName Value="IDEIntf"/>
|
||||
</Item2>
|
||||
</RequiredPkgs>
|
||||
<UsageOptions>
|
||||
<UnitPath Value="$(PkgOutDir)/;$(LazarusDir)/;$(LazarusDir)/components/units/$(TargetCPU)/$(TargetOS)/;$(LazarusDir)/designer/units/"/>
|
||||
</UsageOptions>
|
||||
<PublishOptions>
|
||||
<Version Value="2"/>
|
||||
<IgnoreBinaries Value="False"/>
|
||||
</PublishOptions>
|
||||
</Package>
|
||||
</CONFIG>
|
@ -1,21 +0,0 @@
|
||||
{ This file was automatically created by Lazarus. Do not edit!
|
||||
This source is only used to compile and install the package.
|
||||
}
|
||||
|
||||
unit sqlitedslaz;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
sqliteds, tableeditorform, LazarusPackageIntf;
|
||||
|
||||
implementation
|
||||
|
||||
procedure Register;
|
||||
begin
|
||||
RegisterUnit('tableeditorform', @tableeditorform.Register);
|
||||
end;
|
||||
|
||||
initialization
|
||||
RegisterPackage('sqlitedslaz', @Register);
|
||||
end.
|
@ -1,34 +0,0 @@
|
||||
{ This is an automatically generated lazarus resource file }
|
||||
|
||||
LazarusResources.Add('TSqliteTableEditorForm','FORMDATA',[
|
||||
'TPF0'#22'TSqliteTableEditorForm'#21'SqliteTableEditorForm'#7'Caption'#6#19'S'
|
||||
+'qlite Table Editor'#12'ClientHeight'#3#16#1#11'ClientWidth'#3''''#1#6'OnSho'
|
||||
+'w'#7#25'SqliteTableEditorFormShow'#13'PixelsPerInch'#2'S'#18'HorzScrollBar.'
|
||||
+'Page'#3'&'#1#18'VertScrollBar.Page'#3#15#1#4'Left'#3#180#1#6'Height'#3#16#1
|
||||
+#3'Top'#3#180#0#5'Width'#3''''#1#0#6'TLabel'#6'Label1'#7'Caption'#6#10'Field'
|
||||
+' Name'#5'Color'#7#6'clNone'#4'Left'#3#147#0#6'Height'#2#12#3'Top'#2'@'#5'Wi'
|
||||
+'dth'#2'@'#0#0#6'TLabel'#6'Label2'#7'Caption'#6#10'Field Type'#5'Color'#7#6
|
||||
+'clNone'#4'Left'#3#147#0#6'Height'#2#12#3'Top'#2'x'#5'Width'#2'<'#0#0#6'TLab'
|
||||
+'el'#11'lblFilePath'#7'Caption'#6#11'lblFilePath'#5'Color'#7#6'clNone'#4'Lef'
|
||||
+'t'#2#8#6'Height'#2#12#3'Top'#2#4#5'Width'#2';'#0#0#6'TLabel'#6'Label3'#7'Ca'
|
||||
+'ption'#6#6'Label3'#5'Color'#7#6'clNone'#4'Left'#2#8#6'Height'#2#12#3'Top'#2
|
||||
+#20#5'Width'#2'&'#0#0#8'TListBox'#10'listFields'#17'OnSelectionChange'#7#25
|
||||
+'listFieldsSelectionChange'#8'TabOrder'#2#6#8'TopIndex'#2#255#4'Left'#2#8#6
|
||||
+'Height'#3#192#0#3'Top'#2'@'#5'Width'#2'|'#0#0#7'TButton'#9'butCreate'#7'Cap'
|
||||
+'tion'#6#12'Create Table'#7'OnClick'#7#10'butOkClick'#8'TabOrder'#2#1#7'TabS'
|
||||
+'top'#8#4'Left'#3#147#0#6'Height'#2#25#3'Top'#3#192#0#5'Width'#3#136#0#0#0#7
|
||||
+'TButton'#8'butClose'#7'Caption'#6#5'Close'#7'OnClick'#7#14'butCancelClick'#8
|
||||
+'TabOrder'#2#2#7'TabStop'#8#4'Left'#3#147#0#6'Height'#2#25#3'Top'#3#232#0#5
|
||||
+'Width'#3#136#0#0#0#5'TEdit'#13'editFieldName'#13'OnEditingDone'#7#24'editFi'
|
||||
+'eldNameEditingDone'#8'TabOrder'#2#4#4'Left'#3#147#0#6'Height'#2#23#3'Top'#2
|
||||
+'P'#5'Width'#3#136#0#0#0#9'TComboBox'#14'comboFieldType'#13'DropDownCount'#2
|
||||
+#10#13'Items.Strings'#1#6#6'String'#6#7'Integer'#6#7'AutoInc'#6#4'Word'#6#5
|
||||
+'Float'#6#7'Boolean'#6#8'DateTime'#6#4'Date'#6#4'Time'#6#4'Memo'#0#9'ItemInd'
|
||||
+'ex'#2#0#9'MaxLength'#2#0#8'OnChange'#7#20'comboFieldTypeChange'#5'Style'#7
|
||||
+#14'csDropDownList'#8'TabOrder'#2#5#4'Text'#6#6'String'#4'Left'#3#147#0#6'He'
|
||||
+'ight'#2#21#3'Top'#3#136#0#5'Width'#3#136#0#0#0#7'TButton'#6'butAdd'#7'Capti'
|
||||
+'on'#6#3'Add'#7'OnClick'#7#11'butAddClick'#8'TabOrder'#2#0#4'Left'#2#8#6'Hei'
|
||||
+'ght'#2#25#3'Top'#2'('#5'Width'#2'@'#0#0#7'TButton'#9'butDelete'#7'Caption'#6
|
||||
+#6'Delete'#7'OnClick'#7#14'butDeleteClick'#8'TabOrder'#2#3#4'Left'#2'H'#6'He'
|
||||
+'ight'#2#25#3'Top'#2'('#5'Width'#2'<'#0#0#0
|
||||
]);
|
@ -1,254 +0,0 @@
|
||||
{
|
||||
*****************************************************************************
|
||||
* *
|
||||
* See the file COPYING.modifiedLGPL, included in this distribution, *
|
||||
* for details about the copyright. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
|
||||
* *
|
||||
*****************************************************************************
|
||||
}
|
||||
unit tableeditorform;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, LResources, Forms, Controls, Dialogs, StdCtrls,
|
||||
Buttons, sqliteds, ComponentEditors, LazarusPackageIntf, PropEdits, LazIdeIntf;
|
||||
|
||||
type
|
||||
|
||||
{TSqliteEditor}
|
||||
|
||||
TSqliteEditor = class(TComponentEditor)
|
||||
public
|
||||
procedure ExecuteVerb(Index: Integer); override;
|
||||
function GetVerb(Index: Integer): string; override;
|
||||
function GetVerbCount: Integer; override;
|
||||
procedure Edit; override;
|
||||
end;
|
||||
|
||||
{ TSqliteTableEditorForm }
|
||||
|
||||
TSqliteTableEditorForm = class(TForm)
|
||||
butCreate: TButton;
|
||||
butClose: TButton;
|
||||
butAdd: TButton;
|
||||
butDelete: TButton;
|
||||
comboFieldType: TComboBox;
|
||||
editFieldName: TEdit;
|
||||
Label1: TLabel;
|
||||
Label2: TLabel;
|
||||
Label3: TLabel;
|
||||
lblFilePath: TLabel;
|
||||
listFields: TListBox;
|
||||
DataSet: TSqliteDataSet;
|
||||
procedure SqliteTableEditorFormShow(Sender: TObject);
|
||||
procedure butAddClick(Sender: TObject);
|
||||
procedure butCancelClick(Sender: TObject);
|
||||
procedure butDeleteClick(Sender: TObject);
|
||||
procedure butOkClick(Sender: TObject);
|
||||
procedure comboFieldTypeChange(Sender: TObject);
|
||||
procedure editFieldNameEditingDone(Sender: TObject);
|
||||
procedure listFieldsSelectionChange(Sender: TObject; User: boolean);
|
||||
private
|
||||
{ private declarations }
|
||||
public
|
||||
{ public declarations }
|
||||
end;
|
||||
|
||||
procedure Register;
|
||||
|
||||
var
|
||||
SqliteTableEditorForm: TSqliteTableEditorForm;
|
||||
|
||||
implementation
|
||||
|
||||
procedure RegisterUnitSqliteds;
|
||||
begin
|
||||
RegisterComponents('Data Access',[TSqliteDataset]);
|
||||
end;
|
||||
|
||||
procedure Register;
|
||||
begin
|
||||
RegisterUnit('sqliteds',@RegisterUnitSqliteds);
|
||||
RegisterComponentEditor(TSqliteDataset,TSqliteEditor) ;
|
||||
RegisterPropertyEditor(TypeInfo(String),TSqliteDataset,'FileName',
|
||||
TFileNamePropertyEditor);
|
||||
end;
|
||||
|
||||
function StringListHasDuplicates(const List:TStrings):boolean;
|
||||
var
|
||||
i,j:Integer;
|
||||
begin
|
||||
Result:=False;
|
||||
for i := 0 to List.Count - 1 do
|
||||
for j:= i+1 to List.Count - 1 do
|
||||
if AnsiCompareText(List[i],List[j]) = 0 then
|
||||
begin
|
||||
Result:=True;
|
||||
Exit;
|
||||
end;
|
||||
end;
|
||||
|
||||
{TSqliteEditor}
|
||||
|
||||
procedure TSqliteEditor.ExecuteVerb(Index: Integer);
|
||||
begin
|
||||
case Index of
|
||||
0:Edit;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TSqliteEditor.GetVerb(Index: Integer): string;
|
||||
begin
|
||||
case Index of
|
||||
0:Result:='Create Table';
|
||||
end;
|
||||
end;
|
||||
|
||||
function TSqliteEditor.GetVerbCount: Integer;
|
||||
begin
|
||||
Result:=1;
|
||||
end;
|
||||
|
||||
procedure TSqliteEditor.Edit;
|
||||
var
|
||||
ADataSet:TSqliteDataSet;
|
||||
OldDir:String;
|
||||
begin
|
||||
ADataSet:=TSqliteDataSet(GetComponent);
|
||||
if ADataSet.Filename = '' then
|
||||
begin
|
||||
ShowMessage('FileName not set: it''s not possible to create a table');
|
||||
exit;
|
||||
end;
|
||||
if ADataSet.TableName = '' then
|
||||
begin
|
||||
ShowMessage('TableName not set: it''s not possible to create a table');
|
||||
exit;
|
||||
end;
|
||||
|
||||
with TSqliteTableEditorForm.Create(Application) do
|
||||
begin
|
||||
try
|
||||
// In case Filename is a relative one, change dir to project dir
|
||||
// so the datafile will be created in the right place
|
||||
OldDir:=GetCurrentDir;
|
||||
if ExtractFilePath (LazarusIDE.ActiveProject.MainFile.FileName) <> '' then
|
||||
ChDir(ExtractFilePath (LazarusIDE.ActiveProject.MainFile.FileName));
|
||||
Dataset:=ADataset;
|
||||
ShowModal;
|
||||
finally
|
||||
chdir(OldDir);
|
||||
Free;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
{ TSqliteTableEditorForm }
|
||||
|
||||
procedure TSqliteTableEditorForm.butAddClick(Sender: TObject);
|
||||
begin
|
||||
listFields.Items.AddObject('AFieldName',TObject(0));
|
||||
listFields.ItemIndex:=listFields.Items.Count-1;
|
||||
comboFieldType.ItemIndex:=0;
|
||||
editFieldName.Text:='AFieldName';
|
||||
editFieldName.SetFocus;
|
||||
end;
|
||||
|
||||
procedure TSqliteTableEditorForm.SqliteTableEditorFormShow(Sender: TObject);
|
||||
begin
|
||||
lblFilePath.Caption:='File Path: '+ExpandFileName(DataSet.FileName);
|
||||
label3.caption:='Table Name: '+ DataSet.TableName;
|
||||
end;
|
||||
|
||||
procedure TSqliteTableEditorForm.butCancelClick(Sender: TObject);
|
||||
begin
|
||||
Close;
|
||||
end;
|
||||
|
||||
procedure TSqliteTableEditorForm.butDeleteClick(Sender: TObject);
|
||||
begin
|
||||
if listFields.ItemIndex <> -1 then
|
||||
listFields.Items.Delete(listFields.ItemIndex);
|
||||
end;
|
||||
|
||||
procedure TSqliteTableEditorForm.butOkClick(Sender: TObject);
|
||||
var
|
||||
i:Integer;
|
||||
ASql:String;
|
||||
begin
|
||||
if Dataset.TableExists then
|
||||
begin
|
||||
if MessageDlg('A Table named "'+Dataset.TableName+'"already exists. Are you sure you want to replace this table?'#13#10'All data stored will be lost',
|
||||
mtWarning,[mbYes,MbNo],0) = mrNo then
|
||||
exit
|
||||
else
|
||||
DataSet.ExecSQL('DROP TABLE '+DataSet.TableName+';');
|
||||
end;
|
||||
|
||||
if listFields.Items.Count = 0 then
|
||||
begin;
|
||||
ShowMessage('No fields added');
|
||||
Exit;
|
||||
end;
|
||||
|
||||
if StringListHasDuplicates(listFields.Items) then
|
||||
begin
|
||||
ShowMessage('It''s not allowed fields with the same name');
|
||||
Exit;
|
||||
end;
|
||||
|
||||
ASql:='CREATE TABLE '+ DataSet.TableName + ' (';
|
||||
with listFields do
|
||||
for i := 0 to Items.Count - 1 do
|
||||
begin
|
||||
ASql:=ASql+Items[i]+' ';
|
||||
if comboFieldType.Items[longint(Items.Objects[i])] = 'String' then
|
||||
ASql:=ASql+'VARCHAR'
|
||||
else
|
||||
ASql:=ASql+ Upcase(comboFieldType.Items[longint(Items.Objects[i])]);
|
||||
if i <> Items.Count - 1 then
|
||||
ASql:=ASql+ ' , ';
|
||||
end;
|
||||
ASql:=ASql+');';
|
||||
DataSet.ExecSQL(ASql);
|
||||
if Dataset.TableExists then
|
||||
ShowMessage('Table created successfully')
|
||||
else
|
||||
ShowMessage('It was not possible to create the table');
|
||||
end;
|
||||
|
||||
procedure TSqliteTableEditorForm.comboFieldTypeChange(Sender: TObject);
|
||||
begin
|
||||
if listFields.ItemIndex <> -1 then
|
||||
listFields.Items.Objects[listFields.ItemIndex]:=TObject(comboFieldType.ItemIndex);
|
||||
end;
|
||||
|
||||
procedure TSqliteTableEditorForm.editFieldNameEditingDone(Sender: TObject);
|
||||
begin
|
||||
if listFields.ItemIndex <> -1 then
|
||||
listFields.Items[listFields.ItemIndex]:=editFieldName.Text;
|
||||
end;
|
||||
|
||||
procedure TSqliteTableEditorForm.listFieldsSelectionChange(Sender: TObject;
|
||||
User: boolean);
|
||||
begin
|
||||
if listFields.ItemIndex <> -1 then
|
||||
begin
|
||||
editFieldName.Text:=listFields.Items[listFields.ItemIndex];
|
||||
comboFieldType.ItemIndex:=LongInt(listFields.Items.Objects[listFields.ItemIndex]);
|
||||
end;
|
||||
end;
|
||||
|
||||
initialization
|
||||
{$I tableeditorform.lrs}
|
||||
{$i sqliteds.lrs}
|
||||
|
||||
end.
|
||||
|
Loading…
Reference in New Issue
Block a user