|
From: Peter T. <pe...@us...> - 2003-08-23 23:30:36
|
Update of /cvsroot/jvcl/dev/JVCL3/examples/RaLib/RaDBMove
In directory sc8-pr-cvs1:/tmp/cvs-serv5637/JVCL3/examples/RaLib/RaDBMove
Added Files:
B1_DBMove.cpp B1_DBMove.mak B1_DBMove.mps B1_DBMove.res
B4_DBMove.bpr B4_DBMove.cpp B4_DBMove.res DBMove.dof
DBMove.dpr DBMove.mps DBMove.res fJvDBMove.dfm fJvDBMove.pas
Log Message:
- Copied jvcl/devtools and jvcl/examples dev/JVCL3
- Copied JVCLConvert *.dat files to dev/JVCL3/converter
--- NEW FILE: B1_DBMove.cpp ---
//---------------------------------------------------------------------------
#include <vcl\vcl.h>
#pragma hdrstop
//---------------------------------------------------------------------------
USERES("B1_DBMove.res");
USEFORMNS("fDBMove.pas", Fdbmove, Form1);
//---------------------------------------------------------------------------
WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
{
try
{
Application->Initialize();
Application->CreateForm(__classid(TForm1), &Form1);
Application->Run();
}
catch (Exception &exception)
{
Application->ShowException(&exception);
}
return 0;
}
//---------------------------------------------------------------------------
--- NEW FILE: B1_DBMove.mak ---
# ---------------------------------------------------------------------------
VERSION = BCB.01
# ---------------------------------------------------------------------------
!ifndef BCB
BCB = $(MAKEDIR)\..
!endif
# ---------------------------------------------------------------------------
PROJECT = B1_DBMove.exe
OBJFILES = fDBMove.obj B1_DBMove.obj
RESFILES = B1_DBMove.res
RESDEPEN = $(RESFILES) fDBMove.dfm
LIBFILES =
DEFFILE =
# ---------------------------------------------------------------------------
CFLAG1 = -Od -Hc -w -k -r- -y -v -vi- -c -a4 -b- -w-par -w-inl -Vx -Ve -x
CFLAG2 = -I$(BCB)\include;$(BCB)\include\vcl -H=$(BCB)\lib\vcld.csm
PFLAGS = -AWinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE \
-U$(BCB)\lib\obj;$(BCB)\lib;..\..\lib -I$(BCB)\include;$(BCB)\include\vcl -v \
-$Y -$W -$O- -JPHNV -M
RFLAGS = -i$(BCB)\include;$(BCB)\include\vcl
LFLAGS = -L$(BCB)\lib\obj;$(BCB)\lib;..\..\lib -aa -Tpe -x -v -V4.0
IFLAGS =
LINKER = ilink32
# ---------------------------------------------------------------------------
ALLOBJ = c0w32.obj $(OBJFILES)
ALLRES = $(RESFILES)
ALLLIB = $(LIBFILES) vcl.lib import32.lib cp32mt.lib
# ---------------------------------------------------------------------------
.autodepend
$(PROJECT): $(OBJFILES) $(RESDEPEN) $(DEFFILE)
$(BCB)\BIN\$(LINKER) @&&!
$(LFLAGS) +
$(ALLOBJ), +
$(PROJECT),, +
$(ALLLIB), +
$(DEFFILE), +
$(ALLRES)
!
.pas.hpp:
$(BCB)\BIN\dcc32 $(PFLAGS) { $** }
.pas.obj:
$(BCB)\BIN\dcc32 $(PFLAGS) { $** }
.cpp.obj:
$(BCB)\BIN\bcc32 $(CFLAG1) $(CFLAG2) -o$* $*
.c.obj:
$(BCB)\BIN\bcc32 $(CFLAG1) $(CFLAG2) -o$* $**
.rc.res:
$(BCB)\BIN\brcc32 $(RFLAGS) $<
#-----------------------------------------------------------------------------
--- NEW FILE: B1_DBMove.mps ---
[Hooked Modules]
B1_DBMOVE.EXE=T
[Non-Hooked Modules]
IDAPI32.DLL=T
INDICDLL.DLL=T
IDR20009.DLL=T
BANTAM.DLL=T
IDPDX32.DLL=T
--- NEW FILE: B1_DBMove.res ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: B4_DBMove.bpr ---
# ---------------------------------------------------------------------------
!if !$d(BCB)
BCB = $(MAKEDIR)\..
!endif
# ---------------------------------------------------------------------------
# IDE SECTION
# ---------------------------------------------------------------------------
# The following section of the project makefile is managed by the BCB IDE.
# It is recommended to use the IDE to change any of the values in this
# section.
# ---------------------------------------------------------------------------
VERSION = BCB.04.04
# ---------------------------------------------------------------------------
PROJECT = B4_DBMove.exe
OBJFILES = fDBMove.obj B4_DBMove.obj
RESFILES = B4_DBMove.res
RESDEPEN = $(RESFILES) fDBMove.dfm
LIBFILES =
IDLGENFILES =
IDLFILES =
LIBRARIES = rai45.lib radb45.lib dclradb45.lib ractl45.lib inet40.lib inetdb40.lib \
nmfast40.lib dss40.lib tee40.lib teedb40.lib teeui40.lib qrpt40.lib \
vcldbx40.lib ibsmp40.lib bcbsmp40.lib
SPARELIBS = vcl40.lib vclx40.lib vcljpg40.lib vclmid40.lib vcldb40.lib bcbsmp40.lib \
ibsmp40.lib vcldbx40.lib qrpt40.lib teeui40.lib teedb40.lib tee40.lib dss40.lib \
nmfast40.lib inetdb40.lib inet40.lib ractl45.lib dclradb45.lib radb45.lib \
rai45.lib
PACKAGES = VCL40.bpi VCLX40.bpi VCLJPG40.bpi VCLMID40.bpi VCLDB40.bpi
DEFFILE =
# ---------------------------------------------------------------------------
PATHCPP = .;
PATHASM = .;
PATHPAS = .;
PATHRC = .;
DEBUGLIBPATH = $(BCB)\lib\debug
RELEASELIBPATH = $(BCB)\lib\release
USERDEFINES =
SYSDEFINES = _RTLDLL;NO_STRICT;USEPACKAGES
# ---------------------------------------------------------------------------
CFLAG1 = -I$(BCB)\include;$(BCB)\include\vcl -Od -Hc -H=$(BCB)\lib\vcl40.csm -w -Ve -r- \
-a8 -k -y -v -vi- -c -b- -w-par -w-inl -Vx -tW -tWM \
-D$(SYSDEFINES);$(USERDEFINES)
IDLCFLAGS = -I$(BCB)\include -I$(BCB)\include\vcl -src_suffixcpp
PFLAGS = -U$(BCB)\projects\lib;c:\cbuilder4\lib\release;$(BCB)\lib\obj;$(BCB)\lib;$(RELEASELIBPATH) \
-I$(BCB)\include;$(BCB)\include\vcl -$YD -$W -$O- -v -JPHNE -M
RFLAGS = -i$(BCB)\include;$(BCB)\include\vcl
AFLAGS = /i$(BCB)\include /i$(BCB)\include\vcl /mx /w2 /zd
LFLAGS = -L$(BCB)\projects\lib;c:\cbuilder4\lib\release;$(BCB)\lib\obj;$(BCB)\lib;$(RELEASELIBPATH) \
-aa -Tpe -x -Gn -v
# ---------------------------------------------------------------------------
ALLOBJ = c0w32.obj Memmgr.Lib $(PACKAGES) sysinit.obj $(OBJFILES)
ALLRES = $(RESFILES)
ALLLIB = $(LIBFILES) $(LIBRARIES) import32.lib cp32mti.lib
# ---------------------------------------------------------------------------
!ifdef IDEOPTIONS
[Version Info]
IncludeVerInfo=0
AutoIncBuild=0
MajorVer=1
MinorVer=0
Release=0
Build=0
Debug=0
PreRelease=0
Special=0
Private=0
DLL=0
Locale=1049
CodePage=1251
[Version Info Keys]
CompanyName=
FileDescription=
FileVersion=1.0.0.0
InternalName=
LegalCopyright=
LegalTrademarks=
OriginalFilename=
ProductName=
ProductVersion=1.0.0.0
Comments=
[Debugging]
DebugSourceDirs=$(BCB)\source\vcl
[Parameters]
RunParams=
HostApplication=
RemoteHost=
RemotePath=
RemoteDebug=0
[Compiler]
InMemoryExe=0
ShowInfoMsgs=0
[CORBA]
AddServerUnit=1
AddClientUnit=1
PrecompiledHeaders=1
!endif
# ---------------------------------------------------------------------------
# MAKE SECTION
# ---------------------------------------------------------------------------
# This section of the project file is not used by the BCB IDE. It is for
# the benefit of building from the command-line using the MAKE utility.
# ---------------------------------------------------------------------------
.autodepend
# ---------------------------------------------------------------------------
!if !$d(BCC32)
BCC32 = bcc32
!endif
!if !$d(CPP32)
CPP32 = cpp32
!endif
!if !$d(DCC32)
DCC32 = dcc32
!endif
!if !$d(TASM32)
TASM32 = tasm32
!endif
!if !$d(LINKER)
LINKER = ilink32
!endif
!if !$d(BRCC32)
BRCC32 = brcc32
!endif
!if !$d(IDL2CPP)
IDL2CPP = idl2cpp
!endif
# ---------------------------------------------------------------------------
!if $d(PATHCPP)
.PATH.CPP = $(PATHCPP)
.PATH.C = $(PATHCPP)
!endif
!if $d(PATHPAS)
.PATH.PAS = $(PATHPAS)
!endif
!if $d(PATHASM)
.PATH.ASM = $(PATHASM)
!endif
!if $d(PATHRC)
.PATH.RC = $(PATHRC)
!endif
# ---------------------------------------------------------------------------
$(PROJECT): $(IDLGENFILES) $(OBJFILES) $(RESDEPEN) $(DEFFILE)
$(BCB)\BIN\$(LINKER) @&&!
$(LFLAGS) +
$(ALLOBJ), +
$(PROJECT),, +
$(ALLLIB), +
$(DEFFILE), +
$(ALLRES)
!
# ---------------------------------------------------------------------------
.pas.hpp:
$(BCB)\BIN\$(DCC32) $(PFLAGS) {$< }
.pas.obj:
$(BCB)\BIN\$(DCC32) $(PFLAGS) {$< }
.cpp.obj:
$(BCB)\BIN\$(BCC32) $(CFLAG1) -n$(@D) {$< }
.c.obj:
$(BCB)\BIN\$(BCC32) $(CFLAG1) -n$(@D) {$< }
.c.i:
$(BCB)\BIN\$(CPP32) $(CFLAG1) -n. {$< }
.cpp.i:
$(BCB)\BIN\$(CPP32) $(CFLAG1) -n. {$< }
.asm.obj:
$(BCB)\BIN\$(TASM32) $(AFLAGS) $<, $@
.rc.res:
$(BCB)\BIN\$(BRCC32) $(RFLAGS) -fo$@ $<
# ---------------------------------------------------------------------------
--- NEW FILE: B4_DBMove.cpp ---
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
USERES("B4_DBMove.res");
USEFORMNS("fDBMove.pas", Fdbmove, Form1);
//---------------------------------------------------------------------------
WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
{
try
{
Application->Initialize();
Application->CreateForm(__classid(TForm1), &Form1);
Application->Run();
}
catch (Exception &exception)
{
Application->ShowException(&exception);
}
return 0;
}
//---------------------------------------------------------------------------
--- NEW FILE: B4_DBMove.res ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: DBMove.dof ---
[Directories]
OutputDir=..\..\..\Bin
UnitOutputDir=..\..\..\Dcu
SearchPath=..\..\..\Source;..\..\..\Common
--- NEW FILE: DBMove.dpr ---
program DBMove;
uses
Forms,
fJvDBMove in 'fJvDBMove.pas' {Form1};
{$R *.RES}
begin
Application.Initialize;
Application.Title := 'TJvDBMove Demo';
Application.CreateForm(TForm1, Form1);
Application.Run;
end.
--- NEW FILE: DBMove.mps ---
[Hooked Modules]
DBMOVE.EXE=T
[Non-Hooked Modules]
IDAPI32.DLL=T
INDICDLL.DLL=T
IDR20009.DLL=T
BANTAM.DLL=T
ODBCINT.DLL=T
ODBC32.DLL=T
IDPDX32.DLL=T
IDSQL32.DLL=T
--- NEW FILE: DBMove.res ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: fJvDBMove.dfm ---
object Form1: TForm1
Left = 387
Top = 124
BorderIcons = [biSystemMenu, biMinimize]
BorderStyle = bsSingle
Caption = 'TJvDBMove Demo'
ClientHeight = 401
ClientWidth = 567
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
OldCreateOrder = True
OnCreate = FormCreate
PixelsPerInch = 96
TextHeight = 13
object PageControl1: TPageControl
Left = 8
Top = 8
Width = 553
Height = 353
ActivePage = TabSheet1
TabOrder = 0
object TabSheet1: TTabSheet
Caption = 'Source (DBDEMOS)'
object Label1: TLabel
Left = 8
Top = 0
Width = 79
Height = 13
Caption = 'CUSTOMER.DB'
end
object Label2: TLabel
Left = 8
Top = 148
Width = 64
Height = 13
Caption = 'ORDERS.DB'
end
object Label3: TLabel
Left = 8
Top = 300
Width = 409
Height = 17
AutoSize = False
Caption = 'CUSTOMER.CustNo ->ORDERS.CustNo'
Font.Charset = DEFAULT_CHARSET
Font.Color = clNavy
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
ParentFont = False
WordWrap = True
end
object Label4: TLabel
Left = 424
Top = 16
Width = 113
Height = 273
AutoSize = False
Caption =
'This is Source Database. It contains two tables and one referenc' +
'e between them.'
Color = clBtnFace
ParentColor = False
WordWrap = True
end
object DBGrid1: TDBGrid
Left = 8
Top = 16
Width = 409
Height = 121
DataSource = dsSource1
TabOrder = 0
TitleFont.Charset = DEFAULT_CHARSET
TitleFont.Color = clWindowText
TitleFont.Height = -11
TitleFont.Name = 'MS Sans Serif'
TitleFont.Style = []
end
object DBGrid2: TDBGrid
Left = 8
Top = 165
Width = 409
Height = 120
DataSource = dsSource2
TabOrder = 1
TitleFont.Charset = DEFAULT_CHARSET
TitleFont.Color = clWindowText
TitleFont.Height = -11
TitleFont.Name = 'MS Sans Serif'
TitleFont.Style = []
end
end
object TabSheet2: TTabSheet
Caption = ' ->'
object Label9: TLabel
Left = 16
Top = 16
Width = 513
Height = 33
AutoSize = False
Caption = 'This demo includes steps:'
Font.Charset = DEFAULT_CHARSET
Font.Color = clNavy
Font.Height = -16
Font.Name = 'MS Sans Serif'
Font.Style = []
ParentFont = False
end
object BitBtn1: TBitBtn
Left = 24
Top = 56
Width = 497
Height = 25
Caption = '1. Create destination tables'
Font.Charset = DEFAULT_CHARSET
Font.Color = clNavy
Font.Height = -13
Font.Name = 'MS Sans Serif'
Font.Style = [fsBold]
ParentFont = False
TabOrder = 0
OnClick = BitBtn1Click
Margin = 20
end
object BitBtn2: TBitBtn
Left = 24
Top = 96
Width = 497
Height = 25
Caption = '2. Batch moving'
Font.Charset = DEFAULT_CHARSET
Font.Color = clNavy
Font.Height = -13
Font.Name = 'MS Sans Serif'
Font.Style = [fsBold]
ParentFont = False
TabOrder = 1
OnClick = BitBtn2Click
Margin = 20
end
object GroupBox1: TGroupBox
Left = 16
Top = 144
Width = 513
Height = 153
Caption = ' Key properties '
TabOrder = 2
object Label11: TLabel
Left = 8
Top = 20
Width = 98
Height = 13
Caption = 'RADBMove1.Tables'
end
object Label12: TLabel
Left = 176
Top = 20
Width = 121
Height = 13
Caption = 'RADBMove1.References'
end
object Label13: TLabel
Left = 344
Top = 20
Width = 112
Height = 13
Caption = 'RADBMove1.Mappings'
end
object Memo1: TMemo
Left = 8
Top = 40
Width = 160
Height = 100
ReadOnly = True
ScrollBars = ssBoth
TabOrder = 0
WordWrap = False
end
object Memo2: TMemo
Left = 176
Top = 40
Width = 160
Height = 100
ReadOnly = True
ScrollBars = ssBoth
TabOrder = 1
WordWrap = False
end
object Memo3: TMemo
Left = 345
Top = 40
Width = 160
Height = 100
ReadOnly = True
ScrollBars = ssBoth
TabOrder = 2
WordWrap = False
end
end
end
object TabSheet3: TTabSheet
Caption = 'Destination (WINDOWS TEMP DIR)'
object Label7: TLabel
Left = 424
Top = 16
Width = 113
Height = 273
AutoSize = False
Caption =
'This is Destination Database. You can see that all references fi' +
'xups correctly.'#13#10'Fields CustNo in CUSTOMER.DB and OrderNo in ORD' +
'ERS.DB are changed because they are primary keys which are gener' +
'ated unique.'#13#10'Field CustNo (now called MyCustNo) in ORDERS.DB (n' +
'ow called MYORDERS) also changed, so it can correctly refer to n' +
'ew CUSTOMER.DB.'
Color = clBtnFace
ParentColor = False
WordWrap = True
end
object Label5: TLabel
Left = 8
Top = 0
Width = 79
Height = 13
Caption = 'CUSTOMER.DB'
end
object Label6: TLabel
Left = 8
Top = 148
Width = 80
Height = 13
Caption = 'MYORDERS.DB'
end
object Label8: TLabel
Left = 8
Top = 300
Width = 409
Height = 17
AutoSize = False
Caption = 'CUSTOMER.CustNo ->MYORDERS.MyCustNo'
Font.Charset = DEFAULT_CHARSET
Font.Color = clNavy
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
ParentFont = False
WordWrap = True
end
object DBGrid3: TDBGrid
Left = 8
Top = 16
Width = 409
Height = 121
DataSource = dsDestination1
TabOrder = 0
TitleFont.Charset = DEFAULT_CHARSET
TitleFont.Color = clWindowText
TitleFont.Height = -11
TitleFont.Name = 'MS Sans Serif'
TitleFont.Style = []
end
object DBGrid4: TDBGrid
Left = 8
Top = 165
Width = 409
Height = 120
DataSource = dsDestination2
TabOrder = 1
TitleFont.Charset = DEFAULT_CHARSET
TitleFont.Color = clWindowText
TitleFont.Height = -11
TitleFont.Name = 'MS Sans Serif'
TitleFont.Style = []
end
end
object TabSheet4: TTabSheet
Caption = 'Clean up'
object BitBtn3: TBitBtn
Left = 24
Top = 128
Width = 497
Height = 25
Caption = '3. Remove temporary destination tables'
Font.Charset = DEFAULT_CHARSET
Font.Color = clNavy
Font.Height = -13
Font.Name = 'MS Sans Serif'
Font.Style = [fsBold]
ParentFont = False
TabOrder = 0
OnClick = BitBtn3Click
Margin = 20
end
object BitBtn4: TBitBtn
Left = 24
Top = 168
Width = 497
Height = 25
Caption = 'Exit'
Font.Charset = DEFAULT_CHARSET
Font.Color = clNavy
Font.Height = -13
Font.Name = 'MS Sans Serif'
Font.Style = [fsBold]
ParentFont = False
TabOrder = 1
OnClick = BitBtn4Click
Margin = 20
end
end
end
object Button1: TButton
Left = 408
Top = 368
Width = 75
Height = 25
Caption = 'Next >>'
TabOrder = 1
OnClick = Button1Click
end
object Panel1: TPanel
Left = 136
Top = 80
Width = 281
Height = 73
Caption = 'Panel1'
TabOrder = 2
Visible = False
object Label10: TLabel
Left = 12
Top = 22
Width = 244
Height = 24
Caption = 'Don'#39't run from Delphi IDE!'
Font.Charset = DEFAULT_CHARSET
Font.Color = clRed
Font.Height = -19
Font.Name = 'MS Sans Serif'
Font.Style = [fsBold]
ParentFont = False
end
end
object tSource1: TTable
DatabaseName = 'DBDemos'
TableName = 'CUSTOMER.DB'
Left = 72
Top = 240
end
object dsSource1: TDataSource
DataSet = tSource1
Left = 144
Top = 240
end
object tSource2: TTable
DatabaseName = 'DBDemos'
IndexName = 'CustNo'
MasterFields = 'CustNo'
MasterSource = dsSource1
TableName = 'ORDERS.DB'
Left = 216
Top = 240
end
object dsSource2: TDataSource
DataSet = tSource2
Left = 288
Top = 240
end
object RADBMove1: TJvDBMove
Source = 'DBDemos'
Destination = 'DestBase'
Tables.Strings = (
'CUSTOMER'
'ORDERS')
TempTable = '_RATMP1_.DB'
References.Strings = (
'ORDERS.CustNo = CUSTOMER.CustNo')
Mappings.Strings = (
'ORDERS=MYORDERS'
'ORDERS.CustNo=MyCustNo')
OnMoveRecord = RADBMove1MoveRecord
Progress = True
Left = 212
Top = 192
end
object RASQLScript1: TJvaSQLScript
Script.Strings = (
'/* Creating two destination tables */'
''
'create table "CUSTOMER.DB"('
' CustNo integer, /* CustNo */'
' Company char(30), /* Company */'
' Addr1 char(30), /* Addr1 */'
' primary key (CustNo)'
');'
''
'create table "MYORDERS.DB"('
' OrderNo integer,'
' MyCustNo integer,'
' SaleDate timestamp,'
' ShipDate timestamp,'
' EmpNo integer,'
' primary key (OrderNo)'
');'
''
'create index CustNo on MYORDERS(MyCustNo);'
''
'')
Commit = ctNone
Database = DestinationDatabase
Left = 396
Top = 248
end
object DestinationDatabase: TDatabase
Connected = True
DatabaseName = 'DestBase'
DriverName = 'STANDARD'
Params.Strings = (
'PATH=C:\Temp')
SessionName = 'Default'
TransIsolation = tiDirtyRead
Left = 308
Top = 192
end
object tDestination1: TTable
DatabaseName = 'DestBase'
TableName = 'CUSTOMER.DB'
Left = 72
Top = 288
end
object dsDestination1: TDataSource
DataSet = tDestination1
Left = 144
Top = 288
end
object tDestination2: TTable
DatabaseName = 'DestBase'
IndexName = 'CustNo'
MasterFields = 'CustNo'
MasterSource = dsDestination1
TableName = 'MYORDERS.DB'
Left = 208
Top = 288
end
object dsDestination2: TDataSource
DataSet = tDestination2
Left = 288
Top = 288
end
object RAProgressForm1: TJvProgressForm
Caption = 'TJvDBMove in progress'
ProgressMin = 0
ProgressMax = 0
ProgressStep = 1
ProgressPosition = 0
OnShow = RAProgressForm1Show
Left = 396
Top = 208
end
end
--- NEW FILE: fJvDBMove.pas ---
unit fJvDBMove;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
Grids, DBGrids, Db, DBTables, StdCtrls, ComCtrls, JvDBMove,
Buttons, FileCtrl, JvDlg, ExtCtrls, JvSQLS, JvComponent;
type
TForm1 = class(TForm)
tSource1: TTable;
dsSource1: TDataSource;
tSource2: TTable;
dsSource2: TDataSource;
PageControl1: TPageControl;
TabSheet1: TTabSheet;
DBGrid1: TDBGrid;
DBGrid2: TDBGrid;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
TabSheet2: TTabSheet;
TabSheet3: TTabSheet;
DBGrid3: TDBGrid;
DBGrid4: TDBGrid;
Label7: TLabel;
Label9: TLabel;
RADBMove1: TJvDBMove;
RASQLScript1: TJvaSQLScript;
DestinationDatabase: TDatabase;
BitBtn1: TBitBtn;
BitBtn2: TBitBtn;
tDestination1: TTable;
dsDestination1: TDataSource;
tDestination2: TTable;
dsDestination2: TDataSource;
Label5: TLabel;
Label6: TLabel;
Label8: TLabel;
TabSheet4: TTabSheet;
BitBtn3: TBitBtn;
RAProgressForm1: TJvProgressForm;
Button1: TButton;
Panel1: TPanel;
Label10: TLabel;
GroupBox1: TGroupBox;
Memo1: TMemo;
Label11: TLabel;
Label12: TLabel;
Memo2: TMemo;
Label13: TLabel;
Memo3: TMemo;
BitBtn4: TBitBtn;
procedure BitBtn1Click(Sender: TObject);
procedure BitBtn2Click(Sender: TObject);
procedure RADBMove1MoveRecord(Sender: TJvDBMove; Table: TTable;
var Action: TMoveAction);
procedure FormCreate(Sender: TObject);
procedure BitBtn3Click(Sender: TObject);
procedure RAProgressForm1Show(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure BitBtn4Click(Sender: TObject);
private
Table1Uni: integer;
Table2Uni: integer;
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
uses JvDBUtil;
{$R *.DFM}
procedure TForm1.BitBtn1Click(Sender: TObject);
begin
DestinationDatabase.Close;
DestinationDatabase.Params.Clear;
ForceDirectories('C:\TEMP\RALib.DBMoveTest');
DestinationDatabase.Params.Add('PATH=' + 'C:\TEMP\RALib.DBMoveTest');
DestinationDatabase.Open;
try
JvDBUtil.ExecuteSQLScript(DestinationDatabase,
'drop table "CUSTOMER.DB";', ctAll, nil, 0);
JvDBUtil.ExecuteSQLScript(DestinationDatabase,
'drop table "MYORDERS.DB";', ctAll, nil, 0);
except
{ All Ok }
end;
RASQLScript1.Execute;
end;
procedure TForm1.BitBtn2Click(Sender: TObject);
begin
Table1Uni := 1;
Table2Uni := 1;
RAProgressForm1.Execute;
// see RAProgressForm1.OnShow
end;
procedure TForm1.BitBtn3Click(Sender: TObject);
begin
try
tDestination1.Close;
tDestination2.Close;
JvDBUtil.ExecuteSQLScript(DestinationDatabase,
'drop table "CUSTOMER.DB";', ctAll, nil, 0);
JvDBUtil.ExecuteSQLScript(DestinationDatabase,
'drop table "MYORDERS.DB";', ctAll, nil, 0);
except
{ All Ok }
end;
end;
procedure TForm1.RAProgressForm1Show(Sender: TObject);
begin
RADBMove1.Execute;
tDestination1.Open;
tDestination2.Open;
end;
procedure TForm1.RADBMove1MoveRecord(Sender: TJvDBMove; Table: TTable;
var Action: TMoveAction);
begin
if Cmp(Table.TableName, 'CUSTOMER') then
begin
Table.Fields[0].AsInteger := Table1Uni;
inc(Table1Uni);
end
else if Cmp(Table.TableName, 'MYORDERS') then
begin
Table.Fields[0].AsInteger := Table2Uni;
inc(Table2Uni);
end;
RAProgressForm1.InfoLabel := Table.Fields[1].AsString;
RAProgressForm1.ProgressMax := RADBMove1.RecordCount;
RAProgressForm1.ProgressPosition := RADBMove1.CurrentRecord;
Application.ProcessMessages;
if RAProgressForm1.Cancel then
Abort;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
PageControl1.ActivePage := TabSheet1;
tSource1.Open;
tSource2.Open;
Memo1.Lines := RADBMove1.Tables;
Memo2.Lines := RADBMove1.References;
Memo3.Lines := RADBMove1.Mappings;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
PageControl1.SelectNextPage(true);
end;
procedure TForm1.BitBtn4Click(Sender: TObject);
begin
Close;
end;
end.
|