📄 unidacdemoform.pas
字号:
{$I DacDemo.inc}
unit UniDacDemoForm;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
DemoForm, Menus, ImgList, StdCtrls, Buttons, ExtCtrls, ComCtrls, ToolWin,
DBAccess, UniDacVcl, Db, Uni, DAScript, UniScript,
{$IFNDEF CLR}
OracleUniProvider,
SQLServerUniProvider,
InterBaseUniProvider,
MySQLUniProvider
{$ELSE}
CoreLab.UniDac.Oracle.OracleUniProvider,
CoreLab.UniDac.SQLServer.SQLServerUniProvider,
CoreLab.UniDac.InterBase.InterBaseUniProvider,
CoreLab.UniDac.MySQL.MySQLUniProvider
{$ENDIF}
;
type
TUniDACForm = class(TDemoForm)
UniConnection: TUniConnection;
UniConnectDialog: TUniConnectDialog;
scCreate_InterBase: TUniScript;
scCreate_Oracle: TUniScript;
scDrop: TUniScript;
scCreate_SQLServer: TUniScript;
scDrop_InterBase: TUniScript;
scCreate_MySQL: TUniScript;
procedure cbDebugClick(Sender: TObject);
procedure lbAboutClick(Sender: TObject); override;
private
{ Private declarations }
protected
function GetConnection: TCustomDAConnection; override;
function ApplicationTitle: string; override;
function ProductName: string; override;
procedure RegisterDemos; override;
public
function ProductColor: TColor; override;
procedure ExecCreateScript; override;
procedure ExecDropScript; override;
end;
var
UniDACForm: TUniDACForm;
implementation
uses
{$IFNDEF LINUX}
{$IFDEF CRDBGRID}
CRDBGrid,
{$ENDIF}
{$ENDIF}
CachedUpdates, FilterAndIndex, MasterDetail, Query, Pictures, Sql, StoredProc,
Table, Text, UpdateSQL, VTable, UniDacAbout;
{$IFDEF CLR}
{$R *.nfm}
{$ENDIF}
{$IFDEF WIN32}
{$R *.dfm}
{$ENDIF}
{$IFDEF LINUX}
{$R *.xfm}
{$ENDIF}
function TUniDACForm.GetConnection: TCustomDAConnection;
begin
Result := UniConnection;
end;
function TUniDACForm.ProductColor: TColor;
begin
Result := $00FF0000;
end;
procedure TUniDACForm.ExecCreateScript;
begin
if UniConnection.ProviderName = 'Oracle' then
scCreate_Oracle.Execute
else
if UniConnection.ProviderName = 'InterBase' then
scCreate_InterBase.Execute
else
if UniConnection.ProviderName = 'SQL Server' then
scCreate_SQLServer.Execute
else
if UniConnection.ProviderName = 'MySQL' then
scCreate_MySQL.Execute;
end;
procedure TUniDACForm.ExecDropScript;
begin
if UniConnection.ProviderName = 'InterBase' then
scDrop_InterBase.Execute
else
scDrop.Execute;
end;
function TUniDACForm.ApplicationTitle: string;
begin
Result := 'Universal Data Access Components demos';
end;
function TUniDACForm.ProductName: string;
begin
Result := 'UniDAC';
end;
procedure TUniDACForm.RegisterDemos;
begin
Demos.RegisterCategory('UniDAC Demo', 'UniDAC Demo');
Demos.RegisterCategory('Working with components', 'Working with components'); // peculiarities of TreeView under Kilyx
{$IFNDEF LINUX}
{$IFDEF CRDBGRID}
Demos.RegisterDemo('CRDBGrid', 'Using TCRDBGrid component', 'Demonstrates how to work with the TCRDBGrid component. Shows off the main TCRDBGrid features, like filtering, searching, stretching, using compound headers, and more.', 'Working with components', TCRDBGridFrame, 1);
{$ENDIF}
{$ENDIF}
Demos.RegisterDemo('Query', 'Using TUniQuery component', 'Demonstrates working with TUniQuery, which is one of the most useful UniDAC components. Includes many TUniQuery usage scenarios. Demonstrates how to execute queries in both standard and NonBlocking mode' +
' and how to edit data and export it to XML files. Note: This is a very good introductory demo. We recommend starting here when first becoming familiar with UniDAC.', 'Working with components', TQueryFrame, 2);
Demos.RegisterDemo('Sql', 'Using TUniSQL component', 'Uses TUniSQL to execute SQL statements, and generate stored procedures calls and execute them. Demonstrates how to work with parameters in SQL.', 'Working with components', TSqlFrame, 3);
Demos.RegisterDemo('StoredProc', 'Using TUniStoredProc component', 'Demonstrates working with the TUniStoredProc component. Lets the user generate and invoke different types of stored procedure calls. Users can choose the type of procedure to be generated, ' + 'specify parameter types, and execute the procedure with different parameter values. Shows how to use the TUniStoredProc object to get a DataSet from a stored procedure that returns a record set.', 'Working with components', TStoredProcFrame, 4);
Demos.RegisterDemo('Table', 'Using TUniTable component', 'Demonstrates how to use TUniTable to work with data from a single table on the server without manually writing any SQL queries. Performs server-side data sorting and filtering and retrieves results for browsing and editing.', 'Working with components', TTableFrame, 5);
Demos.RegisterDemo('UpdateSQL', 'Using TUniUpdateSQL component', 'Demonstrates using the TUniUpdateSQL component to customize update commands. Lets you optionally use TIBSQuery objects for carrying out insert, delete, query, and update commands.', 'Working with components', TUpdateSQLFrame, 6);
Demos.RegisterDemo('VirtualTable', 'Using TVirtualTable component', 'Demonstrates working with the TVirtualTable component. This sample shows how to fill virtual dataset with data from other datasets, filter data by a given criteria, locate specified records, perform file operations, and change data and table structure.', 'Working with components', TVirtualTableFrame, 7, 'VTable');
Demos.RegisterCategory('General demos', 'General demos'); // peculiarities of TreeView under Kilyx
Demos.RegisterDemo('CachedUpdates', 'Cached updates, transaction control', 'Demonstrates how to perform the most important tasks of working with data in CachedUpdates mode, including highlighting uncommitted changes, managing transactions, and committing changes in a batch.', 'General demos', TCachedUpdatesFrame, 1);
Demos.RegisterDemo('FilterAndIndex', 'Using Filter and IndexFieldNames', 'Demonstrates UniDAC''s local storage functionality. This sample shows how to perform local filtering, sorting and locating by multiple fields, including by calculated and lookup fields.', 'General demos', TFilterAndIndexFrame, 1);
Demos.RegisterDemo('MasterDetail', 'Master/detail relationship', 'Uses UniDAC functionality to work with master/detail relationships. This sample shows how to use local master/detail functionality. Demonstrates different kinds of master/detail linking, inluding linking by SQL, by simple fields, and by calculated fields.', 'General demos', TMasterDetailFrame, 1);
Demos.RegisterDemo('Pictures', 'Working with BLOB field', 'Uses UniDAC functionality to work with graphics. The sample demonstrates how to retrieve binary data from MySQL database and display it on visual components. Sample also shows how to load and save pictures to files and to the database.', 'General demos', TPicturesFrame, 1);
Demos.RegisterDemo('Text', 'Working with the Text fields', 'Uses UniDAC functionality to work with text. The sample demonstrates how to retrieve text data from MySQL database and display it on visual components. Sample also shows how to load and save text to files and to the database.', 'General demos', TTextFrame, 1);
// Registering Supplementary Demo Projects
Demos.RegisterCategory('Miscellaneous', '', -1, True);
{$IFNDEF CLR}
Demos.RegisterCategory('', '', -1, True);
{$ENDIF}
Demos.RegisterCategory('TechnologySpecific', '', -1, True);
{$IFDEF WIN32}
Demos.RegisterCategory('', '', -1, True);
{$ENDIF}
{$IFNDEF CLR}
Demos.RegisterCategory('ThirdParty', '', -1, True);
{$IFDEF WIN32}
Demos.RegisterCategory('', '', -1, True);
{$ENDIF}
{$ENDIF}
end;
procedure TUniDACForm.cbDebugClick(Sender: TObject);
begin
inherited;
scCreate_Oracle.Debug := cbDebug.Checked;
scCreate_InterBase.Debug := cbDebug.Checked;
scCreate_SQLServer.Debug := cbDebug.Checked;
scCreate_MySQL.Debug := cbDebug.Checked;
scDrop.Debug := cbDebug.Checked;
scDrop_InterBase.Debug := cbDebug.Checked;
end;
procedure TUniDACForm.lbAboutClick(Sender: TObject);
begin
inherited;
UniDacAboutForm.ShowModal;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -