24 |
|
{ Corporation. All Rights Reserved. } |
25 |
|
{ Contributor(s): Jeff Overcash } |
26 |
|
{ } |
27 |
+ |
{ IBX For Lazarus (Firebird Express) } |
28 |
+ |
{ Contributor: Tony Whyman, MWA Software http://www.mwasoftware.co.uk } |
29 |
+ |
{ Portions created by MWA Software are copyright McCallum Whyman } |
30 |
+ |
{ Associates Ltd 2011 } |
31 |
|
{************************************************************************} |
32 |
|
|
33 |
|
unit IBDBReg; |
34 |
|
|
35 |
+ |
{$MODE Delphi} |
36 |
+ |
|
37 |
|
(* |
38 |
|
* Compiler defines |
39 |
|
*) |
54 |
|
|
55 |
|
interface |
56 |
|
|
57 |
< |
uses Windows, SysUtils, Classes, Graphics, Dialogs, Controls, Forms, TypInfo, |
58 |
< |
DsgnIntf, DB, ParentageSupport, dsndb, DBReg, ColnEdit, FldLinks, SQLEdit, |
59 |
< |
DataModelSupport, IBTable, IBDatabase, IBUpdateSQLEditor, IBEventsEditor, |
60 |
< |
IBXConst; |
57 |
> |
uses SysUtils, Classes, Graphics, Dialogs, Controls, Forms, TypInfo, |
58 |
> |
DB, IBTable, IBDatabase, IBEventsEditor, LazarusPackageIntf, |
59 |
> |
IBUpdateSQL, IBXConst, ComponentEditors, PropEdits, DBPropEdits, FieldsEditor, |
60 |
> |
dbFieldLinkPropEditor, dbFieldListPropEditor, IBDialogs; |
61 |
|
|
62 |
|
type |
63 |
|
|
93 |
|
procedure GetValues(Proc: TGetStrProc); override; |
94 |
|
end; |
95 |
|
|
96 |
+ |
{ TDBStringProperty } |
97 |
+ |
|
98 |
|
TDBStringProperty = class(TStringProperty) |
99 |
+ |
private |
100 |
+ |
function ConnecttoDB: boolean; |
101 |
|
public |
102 |
|
function GetAttributes: TPropertyAttributes; override; |
103 |
|
procedure GetValueList(List: TStrings); virtual; |
104 |
|
procedure GetValues(Proc: TGetStrProc); override; |
105 |
+ |
procedure Edit; override; |
106 |
|
end; |
107 |
|
|
108 |
+ |
{ TIBIndexFieldNamesProperty } |
109 |
+ |
|
110 |
|
TIBIndexFieldNamesProperty = class(TDBStringProperty) |
111 |
|
public |
112 |
|
procedure GetValueList(List: TStrings); override; |
136 |
|
|
137 |
|
{ TIBQueryEditor } |
138 |
|
|
139 |
< |
TIBQueryEditor = class(TDataSetEditor) |
127 |
< |
protected |
128 |
< |
FGetTableNamesProc: TGetTableNamesProc; |
129 |
< |
FGetFieldnamesProc: TGetFieldNamesProc; |
139 |
> |
TIBQueryEditor = class(TFieldsComponentEditor) |
140 |
|
public |
131 |
– |
procedure EditSQL; |
141 |
|
procedure ExecuteVerb(Index: Integer); override; |
142 |
|
function GetVerb(Index: Integer): string; override; |
143 |
|
function GetVerbCount: Integer; override; |
145 |
|
|
146 |
|
{ TIBStoredProcEditor } |
147 |
|
|
148 |
< |
TIBStoredProcEditor = class(TDataSetEditor) |
148 |
> |
TIBStoredProcEditor = class(TFieldsComponentEditor) |
149 |
|
public |
150 |
|
procedure ExecuteVerb(Index: Integer); override; |
151 |
|
function GetVerb(Index: Integer): string; override; |
154 |
|
|
155 |
|
{ TIBDataSetEditor } |
156 |
|
|
157 |
< |
TIBDataSetEditor = class(TDataSetEditor) |
149 |
< |
protected |
150 |
< |
FGetTableNamesProc: TGetTableNamesProc; |
151 |
< |
FGetFieldnamesProc: TGetFieldNamesProc; |
157 |
> |
TIBDataSetEditor = class(TFieldsComponentEditor) |
158 |
|
public |
153 |
– |
procedure EditSQL; |
159 |
|
procedure ExecuteVerb(Index: Integer); override; |
160 |
|
function GetVerb(Index: Integer): string; override; |
161 |
|
function GetVerbCount: Integer; override; |
170 |
|
function GetVerbCount: Integer; override; |
171 |
|
end; |
172 |
|
|
173 |
< |
TIBStoredProcParamsProperty = class(TCollectionProperty) |
173 |
> |
{ TIBSQLEditor } |
174 |
> |
|
175 |
> |
TIBSQLEditor = class(TComponentEditor) |
176 |
> |
public |
177 |
> |
procedure ExecuteVerb(Index: Integer); override; |
178 |
> |
function GetVerb(Index: Integer): string; override; |
179 |
> |
function GetVerbCount: Integer; override; |
180 |
> |
end; |
181 |
> |
|
182 |
> |
{ TIBServiceEditor} |
183 |
> |
|
184 |
> |
TIBServiceEditor = class(TComponentEditor) |
185 |
> |
public |
186 |
> |
procedure ExecuteVerb(Index: Integer); override; |
187 |
> |
function GetVerb(Index: Integer): string; override; |
188 |
> |
function GetVerbCount: Integer; override; |
189 |
> |
end; |
190 |
> |
|
191 |
> |
TIBStoredProcParamsProperty = class(TCollectionPropertyEditor) |
192 |
|
public |
193 |
|
procedure Edit; override; |
194 |
|
end; |
195 |
|
|
196 |
+ |
{ TIBTableFieldLinkProperty } |
197 |
+ |
|
198 |
|
TIBTableFieldLinkProperty = class(TFieldLinkProperty) |
199 |
|
private |
200 |
|
FTable: TIBTable; |
201 |
|
protected |
202 |
+ |
function GetIndexDefs: TIndexDefs; override; |
203 |
|
function GetIndexFieldNames: string; override; |
204 |
|
function GetMasterFields: string; override; |
205 |
|
procedure SetIndexFieldNames(const Value: string); override; |
210 |
|
|
211 |
|
{ TSQLPropertyEditor } |
212 |
|
|
213 |
< |
TSQLPropertyEditor = class(TClassProperty) |
188 |
< |
protected |
189 |
< |
FGetTableNamesProc: TGetTableNamesProc; |
190 |
< |
FGetFieldnamesProc: TGetFieldNamesProc; |
213 |
> |
TSQLPropertyEditor = class(TStringsPropertyEditor) |
214 |
|
public |
192 |
– |
procedure EditSQL; |
215 |
|
function GetAttributes: TPropertyAttributes; override; |
216 |
|
end; |
217 |
|
|
222 |
|
procedure Edit; override; |
223 |
|
end; |
224 |
|
|
225 |
+ |
{TIBSQLSQLPropertyEditor } |
226 |
+ |
|
227 |
+ |
TIBSQLSQLPropertyEditor = class(TSQLPropertyEditor) |
228 |
+ |
public |
229 |
+ |
procedure Edit; override; |
230 |
+ |
end; |
231 |
+ |
|
232 |
|
{ TIBDatasetSQLProperty } |
233 |
|
|
234 |
|
TIBDatasetSQLProperty = class(TSQLPropertyEditor) |
243 |
|
procedure Edit; override; |
244 |
|
end; |
245 |
|
|
246 |
< |
TIBEventListProperty = class(TClassProperty) |
246 |
> |
{ TUpdateSQLPropertyEditor } |
247 |
> |
|
248 |
> |
TUpdateSQLPropertyEditor = class(TSQLPropertyEditor) |
249 |
> |
protected |
250 |
> |
FIBUpdateSQL: TIBUpdateSQL; |
251 |
> |
FDatabase: TIBDatabase; |
252 |
> |
function GetObjects: boolean; |
253 |
> |
end; |
254 |
> |
|
255 |
> |
{ TIBUpdateSQLProperty } |
256 |
> |
|
257 |
> |
TIBUpdateSQLProperty = class(TSQLPropertyEditor) |
258 |
|
public |
219 |
– |
function GetAttributes: TPropertyAttributes; override; |
259 |
|
procedure Edit; override; |
260 |
|
end; |
261 |
|
|
262 |
< |
{ DataModel Designer stuff } |
262 |
> |
{ TIBRefreshSQLProperty } |
263 |
|
|
264 |
< |
TIBSQLSprig = class(TSprig) |
264 |
> |
TIBRefreshSQLProperty = class(TSQLPropertyEditor) |
265 |
|
public |
266 |
< |
procedure FigureParent; override; |
228 |
< |
function AnyProblems: Boolean; override; |
229 |
< |
function DragDropTo(AItem: TSprig): Boolean; override; |
230 |
< |
function DragOverTo(AItem: TSprig): Boolean; override; |
231 |
< |
class function PaletteOverTo(AParent: TSprig; AClass: TClass): Boolean; override; |
266 |
> |
procedure Edit; override; |
267 |
|
end; |
268 |
|
|
269 |
< |
TIBCustomDataSetSprig = class(TDataSetSprig) |
235 |
< |
public |
236 |
< |
procedure FigureParent; override; |
237 |
< |
function AnyProblems: Boolean; override; |
238 |
< |
function DragDropTo(AItem: TSprig): Boolean; override; |
239 |
< |
function DragOverTo(AItem: TSprig): Boolean; override; |
240 |
< |
class function PaletteOverTo(AParent: TSprig; AClass: TClass): Boolean; override; |
241 |
< |
end; |
269 |
> |
{ TIBInsertSQLProperty } |
270 |
|
|
271 |
< |
TIBQuerySprig = class(TIBCustomDataSetSprig) |
271 |
> |
TIBInsertSQLProperty = class(TSQLPropertyEditor) |
272 |
|
public |
273 |
< |
function AnyProblems: Boolean; override; |
273 |
> |
procedure Edit; override; |
274 |
|
end; |
275 |
|
|
276 |
< |
TIBTableSprig = class(TIBCustomDataSetSprig) |
249 |
< |
public |
250 |
< |
function AnyProblems: Boolean; override; |
251 |
< |
function Caption: string; override; |
252 |
< |
end; |
276 |
> |
{ TIBDeleteSQLProperty } |
277 |
|
|
278 |
< |
TIBStoredProcSprig = class(TIBCustomDataSetSprig) |
278 |
> |
TIBDeleteSQLProperty = class(TSQLPropertyEditor) |
279 |
|
public |
280 |
< |
function AnyProblems: Boolean; override; |
257 |
< |
function Caption: string; override; |
280 |
> |
procedure Edit; override; |
281 |
|
end; |
282 |
|
|
283 |
< |
TIBUpdateSQLSprig = class(TSprigAtRoot) |
283 |
> |
{ TIBUpdateSQLUpdateProperty } |
284 |
> |
|
285 |
> |
TIBUpdateSQLUpdateProperty = class(TUpdateSQLPropertyEditor) |
286 |
|
public |
287 |
< |
function AnyProblems: Boolean; override; |
287 |
> |
procedure Edit; override; |
288 |
|
end; |
289 |
|
|
290 |
< |
TIBDatabaseSprig = class(TSprigAtRoot) |
290 |
> |
{ TIBUpdateSQLRefreshSQLProperty } |
291 |
> |
|
292 |
> |
TIBUpdateSQLRefreshSQLProperty = class(TUpdateSQLPropertyEditor) |
293 |
|
public |
294 |
< |
function AnyProblems: Boolean; override; |
268 |
< |
function Caption: string; override; |
294 |
> |
procedure Edit; override; |
295 |
|
end; |
296 |
|
|
297 |
< |
TIBTransactionSprig = class(TSprig) |
297 |
> |
{ TIBUpdateSQLInsertSQLProperty } |
298 |
> |
|
299 |
> |
TIBUpdateSQLInsertSQLProperty = class(TUpdateSQLPropertyEditor) |
300 |
|
public |
301 |
< |
function Caption: string; override; |
274 |
< |
procedure FigureParent; override; |
275 |
< |
function AnyProblems: Boolean; override; |
276 |
< |
function DragDropTo(AItem: TSprig): Boolean; override; |
277 |
< |
function DragOverTo(AItem: TSprig): Boolean; override; |
278 |
< |
class function PaletteOverTo(AParent: TSprig; AClass: TClass): Boolean; override; |
301 |
> |
procedure Edit; override; |
302 |
|
end; |
303 |
|
|
304 |
< |
TIBDatabaseInfoSprig = class(TSprig) |
304 |
> |
{ TIBUpdateSQLDeleteProperty } |
305 |
> |
|
306 |
> |
TIBUpdateSQLDeleteProperty = class(TUpdateSQLPropertyEditor) |
307 |
|
public |
308 |
< |
class function ParentProperty: string; override; |
308 |
> |
function GetAttributes: TPropertyAttributes; override; |
309 |
> |
procedure Edit; override; |
310 |
|
end; |
311 |
|
|
312 |
< |
TIBEventsSprig = class(TSprig) |
312 |
> |
{ TIBEventListProperty } |
313 |
> |
|
314 |
> |
TIBEventListProperty = class(TClassProperty) |
315 |
|
public |
316 |
< |
class function ParentProperty: string; override; |
317 |
< |
function AnyProblems: Boolean; override; |
316 |
> |
function GetAttributes: TPropertyAttributes; override; |
317 |
> |
procedure Edit; override; |
318 |
|
end; |
319 |
|
|
320 |
< |
TIBTransactionIsland = class(TIsland) |
320 |
> |
{TIBGeneratorProperty} |
321 |
> |
|
322 |
> |
TIBGeneratorProperty = class(TPersistentPropertyEditor) |
323 |
|
public |
324 |
< |
function VisibleTreeParent: Boolean; override; |
324 |
> |
function GetAttributes: TPropertyAttributes; override; |
325 |
> |
procedure Edit; override; |
326 |
|
end; |
327 |
|
|
328 |
< |
TIBSQLIsland = class(TIsland) |
328 |
> |
{ TDBDynamicGridFieldProperty } |
329 |
> |
|
330 |
> |
TDBDynamicGridFieldProperty = class(TFieldProperty) |
331 |
|
public |
332 |
< |
function VisibleTreeParent: Boolean; override; |
332 |
> |
procedure FillValues(const Values: TStringList); override; |
333 |
|
end; |
334 |
|
|
335 |
< |
TIBCustomDataSetIsland = class(TDataSetIsland) |
335 |
> |
{ TDBLookupPropertiesGridFieldProperty } |
336 |
> |
|
337 |
> |
TDBLookupPropertiesGridFieldProperty = class(TFieldProperty) |
338 |
|
public |
339 |
< |
function VisibleTreeParent: Boolean; override; |
339 |
> |
procedure FillValues(const Values: TStringList); override; |
340 |
|
end; |
341 |
|
|
342 |
< |
TIBTableIsland = class(TIBCustomDataSetIsland) |
308 |
< |
end; |
342 |
> |
{ TIBTreeViewFieldProperty } |
343 |
|
|
344 |
< |
TIBTableMasterDetailBridge = class(TMasterDetailBridge) |
344 |
> |
TIBTreeViewFieldProperty = class(TFieldProperty) |
345 |
|
public |
346 |
< |
function CanEdit: Boolean; override; |
313 |
< |
class function OmegaIslandClass: TIslandClass; override; |
314 |
< |
class function GetOmegaSource(AItem: TPersistent): TDataSource; override; |
315 |
< |
class procedure SetOmegaSource(AItem: TPersistent; ADataSource: TDataSource); override; |
316 |
< |
function Caption: string; override; |
317 |
< |
function Edit: Boolean; override; |
346 |
> |
procedure FillValues(const Values: TStringList); override; |
347 |
|
end; |
348 |
|
|
349 |
< |
TIBQueryIsland = class(TIBCustomDataSetIsland) |
321 |
< |
end; |
349 |
> |
{ TIBDynamicGridIndexNamesProperty } |
350 |
|
|
351 |
< |
TIBQueryMasterDetailBridge = class(TMasterDetailBridge) |
352 |
< |
public |
353 |
< |
class function RemoveMasterFieldsAsWell: Boolean; override; |
354 |
< |
class function OmegaIslandClass: TIslandClass; override; |
355 |
< |
class function GetOmegaSource(AItem: TPersistent): TDataSource; override; |
328 |
< |
class procedure SetOmegaSource(AItem: TPersistent; ADataSource: TDataSource); override; |
329 |
< |
function Caption: string; override; |
351 |
> |
TIBDynamicGridIndexNamesProperty = class(TIndexFieldNamesProperty) |
352 |
> |
protected |
353 |
> |
function GetFieldDefs: TFieldDefs; override; |
354 |
> |
function GetIndexFieldNames: string; override; |
355 |
> |
procedure SetIndexFieldNames(const Value: string); override; |
356 |
|
end; |
357 |
|
|
358 |
+ |
|
359 |
+ |
|
360 |
|
procedure Register; |
361 |
|
|
362 |
|
implementation |
363 |
|
|
364 |
< |
uses IB, IBQuery, IBStoredProc, IBUpdateSQL, IBCustomDataSet, |
364 |
> |
uses IB, IBQuery, IBStoredProc, IBCustomDataSet, |
365 |
|
IBIntf, IBSQL, IBSQLMonitor, IBDatabaseInfo, IBEvents, |
366 |
< |
IBServices, IBInstall, IBDatabaseEdit, IBTransactionEdit, |
367 |
< |
IBBatchMove, DBLogDlg; |
366 |
> |
IBServices, IBDatabaseEdit, IBTransactionEdit, |
367 |
> |
IBBatchMove, IBExtract,LResources, IBSelectSQLEditor, |
368 |
> |
IBModifySQLEditor,IBDeleteSQLEditor,IBRefreshSQLEditor, |
369 |
> |
IBInsertSQLEditor, IBGeneratorEditor, IBUpdateSQLEditor, IBDataSetEditor, |
370 |
> |
IBSQLEditor, ibserviceeditor, LCLVersion, IBDynamicGrid, IBLookupComboEditBox, |
371 |
> |
IBTreeView, DBControlGrid; |
372 |
> |
|
373 |
> |
|
374 |
|
|
375 |
|
procedure Register; |
376 |
|
begin |
377 |
< |
RegisterComponents(IBPalette1, [TIBTable, TIBQuery, |
378 |
< |
TIBStoredProc, TIBDatabase, TIBTransaction, TIBUpdateSQL, |
379 |
< |
TIBDataSet, TIBSQL, TIBDatabaseInfo, TIBSQLMonitor, TIBEvents]); |
380 |
< |
{$IFDEF IB6_ONLY} |
381 |
< |
if (TryIBLoad) and (GetIBClientVersion >= 6) then |
377 |
> |
if not TryIBLoad then |
378 |
> |
begin |
379 |
> |
MessageDlg('IBX is unable to locate the Firebird Library - have you remembered to install it?',mtError,[mbOK],0); |
380 |
> |
Exit; |
381 |
> |
end; |
382 |
> |
|
383 |
> |
RegisterNoIcon([TIBStringField, TIBBCDField]); |
384 |
> |
{$if lcl_fullversion < 01010000} |
385 |
> |
{see http://bugs.freepascal.org/view.php?id=19035 } |
386 |
> |
RegisterNoIcon([TIntegerField]); |
387 |
> |
{$endif} |
388 |
> |
RegisterComponents(IBPalette1, [ TIBQuery, TIBDataSet, |
389 |
> |
TIBDatabase, TIBTransaction, TIBUpdateSQL, TIBEvents, |
390 |
> |
TIBSQL, TIBDatabaseInfo, TIBSQLMonitor, |
391 |
> |
TIBStoredProc,TIBBatchMove, TIBTable,TIBExtract]); |
392 |
> |
if IBServiceAPIPresent then |
393 |
|
RegisterComponents(IBPalette2, [TIBConfigService, TIBBackupService, |
394 |
|
TIBRestoreService, TIBValidationService, TIBStatisticalService, |
395 |
< |
TIBLogService, TIBSecurityService, TIBServerProperties, |
396 |
< |
TIBInstall, TIBUninstall]); |
397 |
< |
{$ENDIF} |
398 |
< |
RegisterClasses([TIBStringField, TIBBCDField]); |
354 |
< |
RegisterFields([TIBStringField, TIBBCDField]); |
395 |
> |
TIBLogService, TIBSecurityService, TIBServerProperties]); |
396 |
> |
|
397 |
> |
|
398 |
> |
RegisterComponents(IBPalette3,[TIBLookupComboEditBox,TIBDynamicGrid,TIBTreeView,TDBControlGrid]); |
399 |
|
RegisterPropertyEditor(TypeInfo(TIBFileName), TIBDatabase, 'DatabaseName', TIBFileNameProperty); {do not localize} |
400 |
|
RegisterPropertyEditor(TypeInfo(string), TIBStoredProc, 'StoredProcName', TIBStoredProcNameProperty); {do not localize} |
401 |
|
RegisterPropertyEditor(TypeInfo(TParams), TIBStoredProc, 'Params', TIBStoredProcParamsProperty); |
405 |
|
RegisterPropertyEditor(TypeInfo(string), TIBTable, 'MasterFields', TIBTableFieldLinkProperty); {do not localize} |
406 |
|
RegisterPropertyEditor(TypeInfo(TStrings), TIBQuery, 'SQL', TIBQuerySQLProperty); {do not localize} |
407 |
|
RegisterPropertyEditor(TypeInfo(TStrings), TIBDataSet, 'SelectSQL', TIBDatasetSQLProperty); {do not localize} |
408 |
< |
RegisterPropertyEditor(TypeInfo(TStrings), TIBSQL, 'SQL', TIBSQLProperty); {do not localize} |
408 |
> |
RegisterPropertyEditor(TypeInfo(TStrings), TIBDataSet, 'ModifySQL', TIBUpdateSQLProperty); {do not localize} |
409 |
> |
RegisterPropertyEditor(TypeInfo(TStrings), TIBDataSet, 'InsertSQL', TIBInsertSQLProperty); {do not localize} |
410 |
> |
RegisterPropertyEditor(TypeInfo(TStrings), TIBDataSet, 'RefreshSQL', TIBRefreshSQLProperty); {do not localize} |
411 |
> |
RegisterPropertyEditor(TypeInfo(TStrings), TIBDataSet, 'DeleteSQL', TIBDeleteSQLProperty); {do not localize} |
412 |
> |
RegisterPropertyEditor(TypeInfo(TStrings), TIBSQL, 'SQL', TIBSQLSQLPropertyEditor); {do not localize} |
413 |
> |
RegisterPropertyEditor(TypeInfo(TStrings), TIBUpdateSQL, 'RefreshSQL', TIBUpdateSQLRefreshSQLProperty); {do not localize} |
414 |
> |
RegisterPropertyEditor(TypeInfo(TStrings), TIBUpdateSQL, 'ModifySQL', TIBUpdateSQLUpdateProperty); {do not localize} |
415 |
> |
RegisterPropertyEditor(TypeInfo(TStrings), TIBUpdateSQL, 'InsertSQL', TIBUpdateSQLInsertSQLProperty); {do not localize} |
416 |
> |
RegisterPropertyEditor(TypeInfo(TStrings), TIBUpdateSQL, 'DeleteSQL', TIBUpdateSQLDeleteProperty); {do not localize} |
417 |
|
RegisterPropertyEditor(TypeInfo(TStrings), TIBEvents, 'Events', TIBEventListProperty); {do not localize} |
418 |
+ |
RegisterPropertyEditor(TypeInfo(TPersistent), TIBDataSet, 'GeneratorField', TIBGeneratorProperty); {do not localize} |
419 |
+ |
RegisterPropertyEditor(TypeInfo(TPersistent), TIBQuery, 'GeneratorField', TIBGeneratorProperty); {do not localize} |
420 |
|
|
421 |
|
RegisterComponentEditor(TIBDatabase, TIBDatabaseEditor); |
422 |
|
RegisterComponentEditor(TIBTransaction, TIBTransactionEditor); |
424 |
|
RegisterComponentEditor(TIBDataSet, TIBDataSetEditor); |
425 |
|
RegisterComponentEditor(TIBQuery, TIBQueryEditor); |
426 |
|
RegisterComponentEditor(TIBStoredProc, TIBStoredProcEditor); |
427 |
+ |
RegisterComponentEditor(TIBSQL, TIBSQLEditor); |
428 |
+ |
RegisterComponentEditor(TIBCustomService, TIBServiceEditor); |
429 |
+ |
|
430 |
+ |
|
431 |
+ |
{Firebird Data Access Controls} |
432 |
+ |
RegisterPropertyEditor(TypeInfo(string), TDBLookupProperties, 'KeyField', TDBDynamicGridFieldProperty); |
433 |
+ |
RegisterPropertyEditor(TypeInfo(string), TDBLookupProperties, 'ListField', TDBDynamicGridFieldProperty); |
434 |
+ |
RegisterPropertyEditor(TypeInfo(string), TIBDynamicGrid, 'IndexFieldNames', TIBDynamicGridIndexNamesProperty); |
435 |
+ |
RegisterPropertyEditor(TypeInfo(string), TDBLookupProperties, 'DataFieldName', TDBLookupPropertiesGridFieldProperty); |
436 |
+ |
RegisterPropertyEditor(TypeInfo(string), TIBTreeView, 'KeyField', TIBTreeViewFieldProperty); |
437 |
+ |
RegisterPropertyEditor(TypeInfo(string), TIBTreeView, 'TextField', TIBTreeViewFieldProperty); |
438 |
+ |
RegisterPropertyEditor(TypeInfo(string), TIBTreeView, 'ParentField', TIBTreeViewFieldProperty); |
439 |
+ |
RegisterPropertyEditor(TypeInfo(string), TIBTreeView, 'HasChildField', TIBTreeViewFieldProperty); |
440 |
+ |
|
441 |
+ |
end; |
442 |
+ |
|
443 |
+ |
procedure LoadDataSourceFields(DataSource: TDataSource; List: TStrings); |
444 |
+ |
var |
445 |
+ |
DataSet: TDataSet; |
446 |
+ |
i: Integer; |
447 |
+ |
begin |
448 |
+ |
if Assigned(DataSource) then |
449 |
+ |
begin |
450 |
+ |
DataSet := DataSource.DataSet; |
451 |
+ |
if Assigned(DataSet) then |
452 |
+ |
begin |
453 |
+ |
if DataSet.Fields.Count > 0 then |
454 |
+ |
DataSet.GetFieldNames(List) |
455 |
+ |
else |
456 |
+ |
begin |
457 |
+ |
DataSet.FieldDefs.Update; |
458 |
+ |
for i := 0 to DataSet.FieldDefs.Count - 1 do |
459 |
+ |
List.Add(DataSet.FieldDefs[i].Name); |
460 |
+ |
end; |
461 |
+ |
end; |
462 |
+ |
end; |
463 |
+ |
end; |
464 |
+ |
|
465 |
+ |
{ TDBLookupPropertiesGridFieldProperty } |
466 |
+ |
|
467 |
+ |
procedure TDBLookupPropertiesGridFieldProperty.FillValues( |
468 |
+ |
const Values: TStringList); |
469 |
+ |
var |
470 |
+ |
P: TDBLookupProperties; |
471 |
+ |
begin |
472 |
+ |
P :=TDBLookupProperties(GetComponent(0)); |
473 |
+ |
if not (P is TDBLookupProperties) then exit; |
474 |
+ |
LoadDataSourceFields(TIBDynamicGrid(P.Owner.Grid).DataSource, Values); |
475 |
+ |
end; |
476 |
+ |
|
477 |
+ |
{ TIBTreeViewFieldProperty } |
478 |
+ |
|
479 |
+ |
procedure TIBTreeViewFieldProperty.FillValues(const Values: TStringList); |
480 |
+ |
var ListSource: TDataSource; |
481 |
+ |
begin |
482 |
+ |
ListSource := TIBTreeView(GetComponent(0)).DataSource; |
483 |
+ |
LoadDataSourceFields(ListSource, Values); |
484 |
+ |
end; |
485 |
+ |
|
486 |
+ |
{ TIBDynamicGridIndexNamesProperty } |
487 |
+ |
|
488 |
+ |
function TIBDynamicGridIndexNamesProperty.GetFieldDefs: TFieldDefs; |
489 |
+ |
var Grid: TIBDynamicGrid; |
490 |
+ |
begin |
491 |
+ |
Result := nil; |
492 |
+ |
Grid := TIBDynamicGrid(GetComponent(0)); |
493 |
+ |
if assigned(Grid.DataSource) and assigned(Grid.DataSource.DataSet) then |
494 |
+ |
Result := Grid.DataSource.DataSet.FieldDefs |
495 |
+ |
end; |
496 |
+ |
|
497 |
+ |
function TIBDynamicGridIndexNamesProperty.GetIndexFieldNames: string; |
498 |
+ |
var Grid: TIBDynamicGrid; |
499 |
+ |
begin |
500 |
+ |
Grid := TIBDynamicGrid(GetComponent(0)); |
501 |
+ |
Result := Grid.IndexFieldNames |
502 |
+ |
end; |
503 |
+ |
|
504 |
+ |
procedure TIBDynamicGridIndexNamesProperty.SetIndexFieldNames( |
505 |
+ |
const Value: string); |
506 |
+ |
var Grid: TIBDynamicGrid; |
507 |
+ |
begin |
508 |
+ |
Grid := TIBDynamicGrid(GetComponent(0)); |
509 |
+ |
Grid.IndexFieldNames := Value |
510 |
+ |
end; |
511 |
+ |
|
512 |
+ |
{ TDBDynamicGridFieldProperty } |
513 |
|
|
514 |
< |
RegisterSprigType(TIBDatabase, TIBDatabaseSprig); |
515 |
< |
RegisterSprigType(TIBTransaction, TIBTransactionSprig); |
514 |
> |
procedure TDBDynamicGridFieldProperty.FillValues(const Values: TStringList); |
515 |
> |
var |
516 |
> |
P: TDBLookupProperties; |
517 |
> |
begin |
518 |
> |
P :=TDBLookupProperties(GetComponent(0)); |
519 |
> |
if not (P is TDBLookupProperties) then exit; |
520 |
> |
LoadDataSourceFields(P.ListSource, Values); |
521 |
> |
end; |
522 |
> |
|
523 |
> |
{ TIBServiceEditor } |
524 |
> |
|
525 |
> |
procedure TIBServiceEditor.ExecuteVerb(Index: Integer); |
526 |
> |
begin |
527 |
> |
if Index < inherited GetVerbCount then |
528 |
> |
inherited ExecuteVerb(Index) else |
529 |
> |
begin |
530 |
> |
Dec(Index, inherited GetVerbCount); |
531 |
> |
case Index of |
532 |
> |
0 : if ibserviceeditor.EditIBService(TIBCustomService(Component)) then Designer.Modified; |
533 |
> |
end; |
534 |
> |
end; |
535 |
> |
end; |
536 |
|
|
537 |
< |
RegisterSprigType(TIBDatabaseInfo, TIBDatabaseInfoSprig); |
538 |
< |
RegisterSprigType(TIBEvents, TIBEventsSprig); |
539 |
< |
RegisterSprigType(TIBSQL, TIBSQLSprig); |
540 |
< |
|
541 |
< |
RegisterSprigType(TIBUpdateSQL, TIBUpdateSQLSprig); |
542 |
< |
|
543 |
< |
RegisterSprigType(TIBCustomDataSet, TIBCustomDataSetSprig); |
544 |
< |
RegisterSprigType(TIBQuery, TIBQuerySprig); |
545 |
< |
RegisterSprigType(TIBTable, TIBTableSprig); |
546 |
< |
RegisterSprigType(TIBStoredProc, TIBStoredProcSprig); |
547 |
< |
|
548 |
< |
RegisterIslandType(TIBTransactionSprig, TIBTransactionIsland); |
389 |
< |
RegisterIslandType(TIBSQLSprig, TIBSQLIsland); |
390 |
< |
RegisterIslandType(TIBCustomDataSetSprig, TIBCustomDataSetIsland); |
391 |
< |
RegisterIslandType(TIBTableSprig, TIBTableIsland); |
392 |
< |
RegisterIslandType(TIBQuerySprig, TIBQueryIsland); |
537 |
> |
function TIBServiceEditor.GetVerb(Index: Integer): string; |
538 |
> |
begin |
539 |
> |
if Index < inherited GetVerbCount then |
540 |
> |
Result := inherited GetVerb(Index) else |
541 |
> |
begin |
542 |
> |
Dec(Index, inherited GetVerbCount); |
543 |
> |
case Index of |
544 |
> |
0: Result := SIBServiceEditor; |
545 |
> |
1 : Result := SInterbaseExpressVersion; |
546 |
> |
end; |
547 |
> |
end; |
548 |
> |
end; |
549 |
|
|
550 |
< |
RegisterBridgeType(TDataSetIsland, TIBTableIsland, TIBTableMasterDetailBridge); |
551 |
< |
RegisterBridgeType(TDataSetIsland, TIBQueryIsland, TIBQueryMasterDetailBridge); |
550 |
> |
function TIBServiceEditor.GetVerbCount: Integer; |
551 |
> |
begin |
552 |
> |
Result := inherited GetVerbCount + 2; |
553 |
|
end; |
554 |
|
|
555 |
|
{ TIBFileNameProperty } |
558 |
|
with TOpenDialog.Create(Application) do |
559 |
|
try |
560 |
|
InitialDir := ExtractFilePath(GetStrValue); |
561 |
< |
Filter := 'Database Files|*.gdb'; {do not localize} |
561 |
> |
Filter := SDatabaseFilter; {do not localize} |
562 |
|
if Execute then |
563 |
|
SetStrValue(FileName); |
564 |
|
finally |
586 |
|
i : integer; |
587 |
|
begin |
588 |
|
StoredProc := GetComponent(0) as TIBStoredProc; |
589 |
+ |
if StoredProc.Database = nil then |
590 |
+ |
Exit; |
591 |
+ |
|
592 |
|
with StoredProc do |
593 |
+ |
try |
594 |
|
for I := 0 to StoredProcedureNames.Count - 1 do |
595 |
|
Proc (StoredProcedureNames[i]); |
596 |
+ |
except on E: Exception do |
597 |
+ |
MessageDlg(E.Message,mtError,[mbOK],0) |
598 |
+ |
end; |
599 |
|
end; |
600 |
|
|
601 |
|
{ TIBTableNameProperty } |
602 |
|
|
603 |
|
procedure TIBTableNameProperty.GetValues(Proc: TGetStrProc); |
604 |
|
var |
605 |
< |
TableName : TIBTable; |
605 |
> |
Table : TIBTable; |
606 |
|
i : integer; |
607 |
|
begin |
608 |
< |
TableName := GetComponent(0) as TIBTable; |
609 |
< |
with TableName do |
608 |
> |
Table := GetComponent(0) as TIBTable; |
609 |
> |
if Table.Database = nil then |
610 |
> |
Exit; |
611 |
> |
with Table do |
612 |
|
for I := 0 to TableNames.Count - 1 do |
613 |
|
Proc (TableNames[i]); |
614 |
|
end; |
615 |
|
|
616 |
|
{ TDBStringProperty } |
617 |
|
|
618 |
+ |
function TDBStringProperty.ConnecttoDB: boolean; |
619 |
+ |
var DataSet: TIBCustomDataSet; |
620 |
+ |
begin |
621 |
+ |
Result := false; |
622 |
+ |
DataSet := (GetComponent(0) as TIBCustomDataSet); |
623 |
+ |
if assigned(Dataset.Database) then |
624 |
+ |
begin |
625 |
+ |
try |
626 |
+ |
DataSet.Database.Connected := true; |
627 |
+ |
except on E: Exception do |
628 |
+ |
ShowMessage(E.Message) |
629 |
+ |
end; |
630 |
+ |
Result := DataSet.Database.Connected |
631 |
+ |
end; |
632 |
+ |
end; |
633 |
+ |
|
634 |
|
function TDBStringProperty.GetAttributes: TPropertyAttributes; |
635 |
|
begin |
636 |
|
Result := [paValueList, paSortList, paMultiSelect]; |
645 |
|
I: Integer; |
646 |
|
Values: TStringList; |
647 |
|
begin |
648 |
+ |
if not ConnecttoDB then Exit; |
649 |
|
Values := TStringList.Create; |
650 |
|
try |
651 |
|
GetValueList(Values); |
655 |
|
end; |
656 |
|
end; |
657 |
|
|
658 |
+ |
procedure TDBStringProperty.Edit; |
659 |
+ |
begin |
660 |
+ |
if ConnecttoDB then |
661 |
+ |
inherited Edit; |
662 |
+ |
end; |
663 |
+ |
|
664 |
|
{ Utility Functions } |
665 |
|
|
666 |
|
function GetPropertyValue(Instance: TPersistent; const PropName: string): TPersistent; |
710 |
|
|
711 |
|
{ TSQLPropertyEditor } |
712 |
|
|
524 |
– |
procedure TSQLPropertyEditor.EditSQL; |
525 |
– |
var |
526 |
– |
SQLText: string; |
527 |
– |
SQL: TStrings; |
528 |
– |
begin |
529 |
– |
SQL := TStringList.Create; |
530 |
– |
try |
531 |
– |
SQL.Assign(TStrings(GetOrdValue)); |
532 |
– |
SQLText := SQL.Text; |
533 |
– |
if (SQLEdit.EditSQL(SQLText, FGetTableNamesProc, FGetFieldNamesProc)) and |
534 |
– |
(SQL.Text <> SQLText) then |
535 |
– |
begin |
536 |
– |
SQL.Text := SQLText; |
537 |
– |
SetOrdValue(LongInt(SQL)); |
538 |
– |
end; |
539 |
– |
finally |
540 |
– |
SQL.free; |
541 |
– |
end; |
542 |
– |
end; |
543 |
– |
|
713 |
|
function TSQLPropertyEditor.GetAttributes: TPropertyAttributes; |
714 |
|
begin |
715 |
< |
Result := inherited GetAttributes + [paDialog] - [paSubProperties]; |
715 |
> |
Result := inherited GetAttributes + [paDialog] - [paMultiSelect,paSubProperties]; |
716 |
|
end; |
717 |
|
|
718 |
|
{ TIBQuerySQLProperty } |
721 |
|
var |
722 |
|
Query: TIBQuery; |
723 |
|
begin |
724 |
< |
Query := TIBQuery(GetComponent(0)); |
725 |
< |
if Assigned(Query.Database) then |
557 |
< |
begin |
558 |
< |
FGetTableNamesProc := Query.Database.GetTableNames; |
559 |
< |
FGetFieldNamesProc := Query.Database.GetFieldNames; |
560 |
< |
end |
561 |
< |
else |
562 |
< |
begin |
563 |
< |
FGetTableNamesProc := nil; |
564 |
< |
FGetFieldNamesProc := nil; |
565 |
< |
end; |
566 |
< |
EditSQL; |
724 |
> |
Query := GetComponent(0) as TIBQuery; |
725 |
> |
if IBSelectSQLEditor.EditSQL(Query,Query.SQL) then Modified; |
726 |
|
end; |
727 |
|
|
728 |
|
{ TIBDatasetSQLProperty } |
731 |
|
var |
732 |
|
IBDataset: TIBDataset; |
733 |
|
begin |
734 |
< |
IBDataset := TIBDataset(GetComponent(0)); |
735 |
< |
if Assigned(IBDataSet.Database) then |
577 |
< |
begin |
578 |
< |
FGetTableNamesProc := IBDataset.Database.GetTableNames; |
579 |
< |
FGetFieldNamesProc := IBDataset.Database.GetFieldNames; |
580 |
< |
end |
581 |
< |
else |
582 |
< |
begin |
583 |
< |
FGetTableNamesProc := nil; |
584 |
< |
FGetFieldNamesProc := nil; |
585 |
< |
end; |
586 |
< |
EditSQL; |
734 |
> |
IBDataset := GetComponent(0) as TIBDataset; |
735 |
> |
if IBSelectSQLEditor.EditSQL(IBDataSet,IBDataSet.SelectSQL) then Modified; |
736 |
|
end; |
737 |
|
|
738 |
|
{ TIBSQLProperty } |
741 |
|
var |
742 |
|
IBSQL: TIBSQL; |
743 |
|
begin |
744 |
< |
IBSQL := TIBSQL(GetComponent(0)); |
745 |
< |
if Assigned(IBSQL.Database) then |
597 |
< |
begin |
598 |
< |
FGetTableNamesProc := IBSQL.Database.GetTableNames; |
599 |
< |
FGetFieldNamesProc := IBSQL.Database.GetFieldNames; |
600 |
< |
end |
601 |
< |
else |
602 |
< |
begin |
603 |
< |
FGetTableNamesProc := nil; |
604 |
< |
FGetFieldNamesProc := nil; |
605 |
< |
end; |
606 |
< |
EditSQL; |
744 |
> |
IBSQL := GetComponent(0) as TIBSQL; |
745 |
> |
if IBSQLEditor.EditIBSQL(IBSQL) then Modified; |
746 |
|
end; |
747 |
|
|
748 |
|
{ TIBUpdateSQLEditor } |
749 |
|
|
750 |
|
procedure TIBUpdateSQLEditor.ExecuteVerb(Index: Integer); |
751 |
|
begin |
752 |
< |
if EditIBUpdateSQL(TIBUpdateSQL(Component)) then Designer.Modified; |
752 |
> |
if IBUpdateSQLEditor.EditIBUpdateSQL(TIBUpdateSQL(Component)) then Modified; |
753 |
|
end; |
754 |
|
|
755 |
|
function TIBUpdateSQLEditor.GetVerb(Index: Integer): string; |
756 |
|
begin |
757 |
|
case Index of |
758 |
|
0 : Result := SIBUpdateSQLEditor; |
759 |
< |
2: Result := SInterbaseExpressVersion; |
759 |
> |
1: Result := SInterbaseExpressVersion; |
760 |
|
end; |
761 |
|
end; |
762 |
|
|
763 |
|
function TIBUpdateSQLEditor.GetVerbCount: Integer; |
764 |
|
begin |
765 |
< |
Result := 2; |
765 |
> |
Result := 2; |
766 |
|
end; |
767 |
|
|
768 |
|
{ TIBDataSetEditor } |
769 |
|
|
631 |
– |
procedure TIBDataSetEditor.EditSQL; |
632 |
– |
var |
633 |
– |
SQLText: string; |
634 |
– |
SQL: TStrings; |
635 |
– |
begin |
636 |
– |
SQL := TStringList.Create; |
637 |
– |
try |
638 |
– |
SQL.Assign(TIBDataset(Component).SelectSQL); |
639 |
– |
SQLText := SQL.Text; |
640 |
– |
if (SQLEdit.EditSQL(SQLText, FGetTableNamesProc, FGetFieldNamesProc)) and |
641 |
– |
(SQL.Text <> SQLText) then |
642 |
– |
begin |
643 |
– |
SQL.Text := SQLText; |
644 |
– |
TIBDataset(Component).SelectSQL.Assign(SQL); |
645 |
– |
end; |
646 |
– |
finally |
647 |
– |
SQL.free; |
648 |
– |
end; |
649 |
– |
end; |
650 |
– |
|
770 |
|
procedure TIBDataSetEditor.ExecuteVerb(Index: Integer); |
771 |
|
var |
772 |
|
IBDataset: TIBDataset; |
777 |
|
Dec(Index, inherited GetVerbCount); |
778 |
|
case Index of |
779 |
|
0: |
780 |
< |
if EditIBDataSet(TIBDataSet(Component)) then |
780 |
> |
if IBDataSetEditor.EditIBDataSet(TIBDataSet(Component)) then |
781 |
|
Designer.Modified; |
782 |
|
1: (Component as TIBDataSet).ExecSQL; |
664 |
– |
2: |
665 |
– |
begin |
666 |
– |
IBDataset := TIBDataset(Component); |
667 |
– |
if Assigned(IBDataSet.Database) then |
668 |
– |
begin |
669 |
– |
FGetTableNamesProc := IBDataset.Database.GetTableNames; |
670 |
– |
FGetFieldNamesProc := IBDataset.Database.GetFieldNames; |
671 |
– |
end |
672 |
– |
else |
673 |
– |
begin |
674 |
– |
FGetTableNamesProc := nil; |
675 |
– |
FGetFieldNamesProc := nil; |
676 |
– |
end; |
677 |
– |
EditSQL; |
678 |
– |
end; |
783 |
|
end; |
784 |
|
end; |
785 |
|
end; |
793 |
|
case Index of |
794 |
|
0: Result := SIBDataSetEditor; |
795 |
|
1: Result := SExecute; |
796 |
< |
2: Result := SEditSQL; |
693 |
< |
3: Result := SInterbaseExpressVersion; |
796 |
> |
2: Result := SInterbaseExpressVersion; |
797 |
|
end; |
798 |
|
end; |
799 |
|
end; |
800 |
|
|
801 |
|
function TIBDataSetEditor.GetVerbCount: Integer; |
802 |
|
begin |
803 |
< |
Result := inherited GetVerbCount + 4; |
803 |
> |
Result := inherited GetVerbCount + 3; |
804 |
|
end; |
805 |
|
|
806 |
|
{ TIBEventListProperty } |
807 |
|
|
808 |
|
function TIBEventListProperty.GetAttributes: TPropertyAttributes; |
809 |
|
begin |
810 |
< |
Result := inherited GetAttributes + [paDialog] - [paSubProperties]; |
810 |
> |
Result := inherited GetAttributes + [paDialog] - [paMultiSelect,paSubProperties]; |
811 |
|
end; |
812 |
|
|
813 |
|
procedure TIBEventListProperty.Edit; |
814 |
|
var |
815 |
|
Events: TStrings; |
816 |
+ |
IBEvents: TIBEvents; |
817 |
|
begin |
818 |
+ |
IBEvents := GetComponent(0) as TIBEvents; |
819 |
|
Events := TStringList.Create; |
820 |
|
try |
821 |
< |
Events.Assign( TStrings(GetOrdValue)); |
822 |
< |
if EditAlerterEvents( Events) then SetOrdValue( longint(Events)); |
821 |
> |
Events.Assign( IBEvents.Events); |
822 |
> |
if EditAlerterEvents( Events) then |
823 |
> |
begin |
824 |
> |
IBEvents.Events.Assign(Events); |
825 |
> |
Modified |
826 |
> |
end; |
827 |
|
finally |
828 |
|
Events.Free; |
829 |
|
end; |
884 |
|
|
885 |
|
{ TIBQueryEditor } |
886 |
|
|
778 |
– |
procedure TIBQueryEditor.EditSQL; |
779 |
– |
var |
780 |
– |
SQLText: string; |
781 |
– |
SQL: TStrings; |
782 |
– |
begin |
783 |
– |
SQL := TStringList.Create; |
784 |
– |
try |
785 |
– |
SQL.Assign(TIBQuery(Component).SQL); |
786 |
– |
SQLText := SQL.Text; |
787 |
– |
if (SQLEdit.EditSQL(SQLText, FGetTableNamesProc, FGetFieldNamesProc)) and |
788 |
– |
(SQL.Text <> SQLText) then |
789 |
– |
begin |
790 |
– |
SQL.Text := SQLText; |
791 |
– |
TIBQuery(Component).SQL.Assign(SQL); |
792 |
– |
end; |
793 |
– |
finally |
794 |
– |
SQL.free; |
795 |
– |
end; |
796 |
– |
end; |
797 |
– |
|
887 |
|
procedure TIBQueryEditor.ExecuteVerb(Index: Integer); |
888 |
|
var |
889 |
|
Query: TIBQuery; |
895 |
|
Dec(Index, inherited GetVerbCount); |
896 |
|
case Index of |
897 |
|
0: Query.ExecSQL; |
898 |
< |
1: |
810 |
< |
begin |
811 |
< |
if Assigned(Query.Database) then |
812 |
< |
begin |
813 |
< |
FGetTableNamesProc := Query.Database.GetTableNames; |
814 |
< |
FGetFieldNamesProc := Query.Database.GetFieldNames; |
815 |
< |
end |
816 |
< |
else |
817 |
< |
begin |
818 |
< |
FGetTableNamesProc := nil; |
819 |
< |
FGetFieldNamesProc := nil; |
820 |
< |
end; |
821 |
< |
EditSQL; |
822 |
< |
end; |
898 |
> |
1: if ibselectsqleditor.EditSQL(Query,Query.SQL) then Designer.Modified; |
899 |
|
end; |
900 |
|
end; |
901 |
|
end; |
971 |
|
procedure TIBTableFieldLinkProperty.Edit; |
972 |
|
begin |
973 |
|
FTable := DataSet as TIBTable; |
974 |
+ |
if assigned(FTable.Database) then |
975 |
+ |
FTable.Database.Connected := true; |
976 |
|
inherited Edit; |
977 |
|
end; |
978 |
|
|
979 |
+ |
function TIBTableFieldLinkProperty.GetIndexDefs: TIndexDefs; |
980 |
+ |
begin |
981 |
+ |
Result := FTable.IndexDefs |
982 |
+ |
end; |
983 |
+ |
|
984 |
|
function TIBTableFieldLinkProperty.GetIndexFieldNames: string; |
985 |
|
begin |
986 |
|
Result := FTable.IndexFieldNames; |
1001 |
|
FTable.MasterFields := Value; |
1002 |
|
end; |
1003 |
|
|
1004 |
< |
{ TIBDatabaseSprig } |
922 |
< |
|
923 |
< |
function TIBDatabaseSprig.AnyProblems: Boolean; |
924 |
< |
begin |
925 |
< |
Result := (TIBDatabase(Item).DatabaseName = '') or |
926 |
< |
(TIBDatabase(Item).DefaultTransaction = nil); |
927 |
< |
end; |
928 |
< |
|
929 |
< |
function TIBDatabaseSprig.Caption: string; |
930 |
< |
begin |
931 |
< |
Result := CaptionFor(TIBDatabase(Item).DatabaseName, UniqueName); |
932 |
< |
end; |
933 |
< |
|
934 |
< |
{ TIBTransactionSprig } |
935 |
< |
|
936 |
< |
function TIBTransactionSprig.AnyProblems: Boolean; |
937 |
< |
begin |
938 |
< |
Result := TIBTransaction(Item).DefaultDatabase = nil; |
939 |
< |
end; |
940 |
< |
|
941 |
< |
function TIBTransactionSprig.Caption: string; |
942 |
< |
begin |
943 |
< |
if (TIBTransaction(Item).DefaultDatabase <> nil) and |
944 |
< |
(TIBTransaction(Item).DefaultDatabase.DefaultTransaction = Item) then |
945 |
< |
Result := CaptionFor(Format(SDefaultTransaction, [UniqueName])) |
946 |
< |
else |
947 |
< |
Result := inherited Caption; |
948 |
< |
end; |
949 |
< |
|
950 |
< |
procedure TIBTransactionSprig.FigureParent; |
951 |
< |
begin |
952 |
< |
SeekParent(TIBTransaction(Item).DefaultDatabase).Add(Self); |
953 |
< |
end; |
954 |
< |
|
955 |
< |
function TIBTransactionSprig.DragDropTo(AItem: TSprig): Boolean; |
956 |
< |
begin |
957 |
< |
Result := False; |
958 |
< |
if AItem is TIBDatabaseSprig then |
959 |
< |
begin |
960 |
< |
Result := TIBDatabase(AItem.Item) <> TIBTransaction(Item).DefaultDatabase; |
961 |
< |
if Result then |
962 |
< |
begin |
963 |
< |
TIBTransaction(Item).DefaultDatabase := TIBDatabase(AItem.Item); |
964 |
< |
TIBDatabase(AItem.Item).DefaultTransaction := TIBTransaction(Item); |
965 |
< |
end; |
966 |
< |
end |
967 |
< |
end; |
968 |
< |
|
969 |
< |
function TIBTransactionSprig.DragOverTo(AItem: TSprig): Boolean; |
970 |
< |
begin |
971 |
< |
Result := (AItem is TIBDatabaseSprig); |
972 |
< |
end; |
1004 |
> |
{ TIBUpdateSQLProperty } |
1005 |
|
|
1006 |
< |
class function TIBTransactionSprig.PaletteOverTo(AParent: TSprig; AClass: TClass): Boolean; |
1006 |
> |
procedure TIBUpdateSQLProperty.Edit; |
1007 |
> |
var |
1008 |
> |
IBDataset: TIBDataset; |
1009 |
|
begin |
1010 |
< |
Result := (AParent is TIBDatabaseSprig); |
1010 |
> |
IBDataset := GetComponent(0) as TIBDataset; |
1011 |
> |
if IBModifySQLEditor.EditSQL(IBDataSet,IBDataSet.ModifySQL) then Modified; |
1012 |
|
end; |
1013 |
|
|
1014 |
< |
{ support stuff for sprigs } |
1014 |
> |
{ TIBUpdateSQLUpdateProperty } |
1015 |
|
|
1016 |
< |
function IBAnyProblems(ATransaction: TIBTransaction; ADatabase: TIBDatabase): Boolean; |
1016 |
> |
procedure TIBUpdateSQLUpdateProperty.Edit; |
1017 |
|
begin |
1018 |
< |
Result := (ATransaction = nil) or |
1019 |
< |
(ADatabase = nil) or |
985 |
< |
(ATransaction.DefaultDatabase <> ADatabase); |
1018 |
> |
GetObjects; |
1019 |
> |
if IBModifySQLEditor.EditSQL(FIBUpdateSQL.DataSet,FIBUpdateSQL.ModifySQL) then Modified; |
1020 |
|
end; |
1021 |
|
|
1022 |
< |
procedure IBFigureParent(ASprig: TSprig; ATransaction: TIBTransaction; ADatabase: TIBDatabase); |
989 |
< |
begin |
990 |
< |
if ATransaction <> nil then |
991 |
< |
ASprig.SeekParent(ATransaction).Add(ASprig) |
992 |
< |
else if ADatabase <> nil then |
993 |
< |
ASprig.SeekParent(ADatabase).Add(ASprig) |
994 |
< |
else |
995 |
< |
ASprig.Root.Add(ASprig); |
996 |
< |
end; |
997 |
< |
|
998 |
< |
function IBDragOver(ASprig: TSprig): Boolean; |
999 |
< |
begin |
1000 |
< |
Result := (ASprig is TIBTransactionSprig) or |
1001 |
< |
(ASprig is TIBDatabaseSprig); |
1002 |
< |
end; |
1022 |
> |
{ TIBRefreshSQLProperty } |
1023 |
|
|
1024 |
< |
function IBDropOver(AParent: TSprig; var ATransaction: TIBTransaction; var ADatabase: TIBDatabase): Boolean; |
1024 |
> |
procedure TIBRefreshSQLProperty.Edit; |
1025 |
|
var |
1026 |
< |
vParentTransaction: TIBTransaction; |
1027 |
< |
vParentDatabase: TIBDatabase; |
1026 |
> |
IBDataset: TIBDataset; |
1027 |
> |
aDatabase: TIBDatabase; |
1028 |
|
begin |
1029 |
< |
Result := False; |
1030 |
< |
if AParent is TIBTransactionSprig then |
1011 |
< |
begin |
1012 |
< |
vParentTransaction := TIBTransaction(AParent.Item); |
1013 |
< |
Result := vParentTransaction <> ATransaction; |
1014 |
< |
if Result then |
1015 |
< |
ATransaction := vParentTransaction; |
1016 |
< |
if (vParentTransaction.DefaultDatabase = nil) or |
1017 |
< |
(ADatabase <> vParentTransaction.DefaultDatabase) then |
1018 |
< |
begin |
1019 |
< |
Result := True; |
1020 |
< |
ADatabase := vParentTransaction.DefaultDatabase; |
1021 |
< |
end; |
1022 |
< |
end else if AParent is TIBDatabaseSprig then |
1023 |
< |
begin |
1024 |
< |
vParentDatabase := TIBDatabase(AParent.Item); |
1025 |
< |
Result := vParentDatabase <> ADatabase; |
1026 |
< |
if Result then |
1027 |
< |
ADatabase := vParentDatabase; |
1028 |
< |
if (vParentDatabase.DefaultTransaction = nil) or |
1029 |
< |
(ATransaction <> vParentDatabase.DefaultTransaction) then |
1030 |
< |
begin |
1031 |
< |
Result := True; |
1032 |
< |
ATransaction := vParentDatabase.DefaultTransaction; |
1033 |
< |
end; |
1034 |
< |
end; |
1029 |
> |
IBDataset := GetComponent(0) as TIBDataset; |
1030 |
> |
if IBRefreshSQLEditor.EditSQL(IBDataSet,IBDataSet.RefreshSQL) then Modified; |
1031 |
|
end; |
1032 |
|
|
1033 |
< |
{ TIBSQLSprig } |
1033 |
> |
{ TIBUpdateSQLRefreshSQLProperty } |
1034 |
|
|
1035 |
< |
function TIBSQLSprig.AnyProblems: Boolean; |
1035 |
> |
procedure TIBUpdateSQLRefreshSQLProperty.Edit; |
1036 |
|
begin |
1037 |
< |
Result := IBAnyProblems(TIBSQL(Item).Transaction, |
1038 |
< |
TIBSQL(Item).Database) or |
1043 |
< |
(TIBSQL(Item).SQL.Count = 0); |
1037 |
> |
GetObjects; |
1038 |
> |
if IBRefreshSQLEditor.EditSQL(FIBUpdateSQL.DataSet,FIBUpdateSQL.RefreshSQL) then Modified; |
1039 |
|
end; |
1040 |
|
|
1041 |
< |
function TIBSQLSprig.DragDropTo(AItem: TSprig): Boolean; |
1047 |
< |
var |
1048 |
< |
vTransaction: TIBTransaction; |
1049 |
< |
vDatabase: TIBDatabase; |
1050 |
< |
begin |
1051 |
< |
with TIBSQL(Item) do |
1052 |
< |
begin |
1053 |
< |
vTransaction := Transaction; |
1054 |
< |
vDatabase := Database; |
1055 |
< |
Result := IBDropOver(AItem, vTransaction, vDatabase); |
1056 |
< |
if Result then |
1057 |
< |
begin |
1058 |
< |
Transaction := vTransaction; |
1059 |
< |
Database := vDatabase; |
1060 |
< |
end; |
1061 |
< |
end; |
1062 |
< |
end; |
1041 |
> |
{ TIBDeleteSQLProperty } |
1042 |
|
|
1043 |
< |
function TIBSQLSprig.DragOverTo(AItem: TSprig): Boolean; |
1043 |
> |
procedure TIBDeleteSQLProperty.Edit; |
1044 |
> |
var |
1045 |
> |
IBDataset: TIBDataSet; |
1046 |
|
begin |
1047 |
< |
Result := IBDragOver(AItem); |
1047 |
> |
IBDataset := GetComponent(0) as TIBDataSet; |
1048 |
> |
if IBDeleteSQLEditor.EditSQL(IBDataSet,IBDataSet.DeleteSQL) then Modified; |
1049 |
|
end; |
1050 |
|
|
1051 |
< |
procedure TIBSQLSprig.FigureParent; |
1070 |
< |
begin |
1071 |
< |
IBFigureParent(Self, TIBSQL(Item).Transaction, |
1072 |
< |
TIBSQL(Item).Database); |
1073 |
< |
end; |
1051 |
> |
{ TIBUpdateSQLDeleteProperty } |
1052 |
|
|
1053 |
< |
class function TIBSQLSprig.PaletteOverTo(AParent: TSprig; AClass: TClass): Boolean; |
1053 |
> |
function TIBUpdateSQLDeleteProperty.GetAttributes: TPropertyAttributes; |
1054 |
|
begin |
1055 |
< |
Result := IBDragOver(AParent); |
1055 |
> |
Result:=inherited GetAttributes; |
1056 |
|
end; |
1057 |
|
|
1058 |
< |
{ TIBCustomDataSetSprig } |
1081 |
< |
|
1082 |
< |
function TIBCustomDataSetSprig.AnyProblems: Boolean; |
1058 |
> |
procedure TIBUpdateSQLDeleteProperty.Edit; |
1059 |
|
begin |
1060 |
< |
Result := IBAnyProblems(TIBCustomDataSet(Item).Transaction, |
1061 |
< |
TIBCustomDataSet(Item).Database); |
1060 |
> |
GetObjects; |
1061 |
> |
if IBDeleteSQLEditor.EditSQL(FIBUpdateSQL.DataSet,FIBUpdateSQL.DeleteSQL) then Modified; |
1062 |
|
end; |
1063 |
|
|
1064 |
< |
procedure TIBCustomDataSetSprig.FigureParent; |
1089 |
< |
begin |
1090 |
< |
IBFigureParent(Self, TIBCustomDataSet(Item).Transaction, |
1091 |
< |
TIBCustomDataSet(Item).Database); |
1092 |
< |
end; |
1064 |
> |
{ TUpdateSQLPropertyEditor } |
1065 |
|
|
1066 |
< |
function TIBCustomDataSetSprig.DragDropTo(AItem: TSprig): Boolean; |
1095 |
< |
var |
1096 |
< |
vTransaction: TIBTransaction; |
1097 |
< |
vDatabase: TIBDatabase; |
1066 |
> |
function TUpdateSQLPropertyEditor.GetObjects: boolean; |
1067 |
|
begin |
1068 |
< |
with TIBCustomDataSet(Item) do |
1068 |
> |
Result := false; |
1069 |
> |
FIBUpdateSQL := GetComponent(0) as TIBUpdateSQL; |
1070 |
> |
if not assigned(FIBUpdateSQL) or not assigned(FIBUpdateSQL.DataSet) then |
1071 |
> |
Exit; |
1072 |
> |
FDatabase := nil; |
1073 |
> |
if FIBUpdateSQL.DataSet is TIBQuery then |
1074 |
|
begin |
1075 |
< |
vTransaction := Transaction; |
1076 |
< |
vDatabase := Database; |
1103 |
< |
Result := IBDropOver(AItem, vTransaction, vDatabase); |
1104 |
< |
if Result then |
1105 |
< |
begin |
1106 |
< |
Transaction := vTransaction; |
1107 |
< |
Database := vDatabase; |
1108 |
< |
end; |
1075 |
> |
FDatabase := (FIBUpdateSQL.DataSet as TIBQuery).Database; |
1076 |
> |
Result := true |
1077 |
|
end; |
1078 |
|
end; |
1079 |
|
|
1080 |
< |
function TIBCustomDataSetSprig.DragOverTo(AItem: TSprig): Boolean; |
1113 |
< |
begin |
1114 |
< |
Result := IBDragOver(AItem); |
1115 |
< |
end; |
1116 |
< |
|
1117 |
< |
class function TIBCustomDataSetSprig.PaletteOverTo(AParent: TSprig; AClass: TClass): Boolean; |
1118 |
< |
begin |
1119 |
< |
Result := IBDragOver(AParent); |
1120 |
< |
end; |
1121 |
< |
|
1122 |
< |
{ TIBStoredProcSprig } |
1080 |
> |
{ TIBInsertSQLProperty } |
1081 |
|
|
1082 |
< |
function TIBStoredProcSprig.AnyProblems: Boolean; |
1125 |
< |
begin |
1126 |
< |
Result := inherited AnyProblems or |
1127 |
< |
(TIBStoredProc(Item).StoredProcName = ''); |
1128 |
< |
end; |
1129 |
< |
|
1130 |
< |
function TIBStoredProcSprig.Caption: string; |
1131 |
< |
begin |
1132 |
< |
Result := CaptionFor(TIBStoredProc(Item).StoredProcName, UniqueName); |
1133 |
< |
end; |
1134 |
< |
|
1135 |
< |
{ TIBTableSprig } |
1136 |
< |
|
1137 |
< |
function TIBTableSprig.AnyProblems: Boolean; |
1138 |
< |
begin |
1139 |
< |
Result := inherited AnyProblems or |
1140 |
< |
(TIBTable(Item).TableName = ''); |
1141 |
< |
end; |
1142 |
< |
|
1143 |
< |
function TIBTableSprig.Caption: string; |
1144 |
< |
begin |
1145 |
< |
Result := CaptionFor(TIBTable(Item).TableName, UniqueName); |
1146 |
< |
end; |
1147 |
< |
|
1148 |
< |
{ TIBQuerySprig } |
1149 |
< |
|
1150 |
< |
function TIBQuerySprig.AnyProblems: Boolean; |
1151 |
< |
begin |
1152 |
< |
Result := inherited AnyProblems or |
1153 |
< |
(TIBQuery(Item).SQL.Count = 0); |
1154 |
< |
end; |
1155 |
< |
|
1156 |
< |
{ TIBDatabaseInfoSprig } |
1157 |
< |
|
1158 |
< |
class function TIBDatabaseInfoSprig.ParentProperty: string; |
1159 |
< |
begin |
1160 |
< |
Result := 'Database'; { do not localize } |
1161 |
< |
end; |
1162 |
< |
|
1163 |
< |
{ TIBUpdateSQLSprig } |
1164 |
< |
|
1165 |
< |
function TIBUpdateSQLSprig.AnyProblems: Boolean; |
1166 |
< |
begin |
1167 |
< |
with TIBUpdateSQL(Item) do |
1168 |
< |
Result := (ModifySQL.Count = 0) and |
1169 |
< |
(InsertSQL.Count = 0) and |
1170 |
< |
(DeleteSQL.Count = 0) and |
1171 |
< |
(RefreshSQL.Count = 0); |
1172 |
< |
end; |
1173 |
< |
|
1174 |
< |
{ TIBEventsSprig } |
1175 |
< |
|
1176 |
< |
function TIBEventsSprig.AnyProblems: Boolean; |
1177 |
< |
begin |
1178 |
< |
Result := inherited AnyProblems or |
1179 |
< |
(TIBEvents(Item).Events.Count = 0); |
1180 |
< |
end; |
1181 |
< |
|
1182 |
< |
class function TIBEventsSprig.ParentProperty: string; |
1183 |
< |
begin |
1184 |
< |
Result := 'Database'; { do not localize } |
1185 |
< |
end; |
1186 |
< |
|
1187 |
< |
{ TIBTableMasterDetailBridge } |
1188 |
< |
|
1189 |
< |
function TIBTableMasterDetailBridge.CanEdit: Boolean; |
1190 |
< |
begin |
1191 |
< |
Result := True; |
1192 |
< |
end; |
1193 |
< |
|
1194 |
< |
function TIBTableMasterDetailBridge.Caption: string; |
1195 |
< |
begin |
1196 |
< |
if TIBTable(Omega.Item).MasterFields = '' then |
1197 |
< |
Result := SNoMasterFields |
1198 |
< |
else |
1199 |
< |
Result := TIBTable(Omega.Item).MasterFields; |
1200 |
< |
end; |
1201 |
< |
|
1202 |
< |
function TIBTableMasterDetailBridge.Edit: Boolean; |
1082 |
> |
procedure TIBInsertSQLProperty.Edit; |
1083 |
|
var |
1084 |
< |
vPropEd: TIBTableFieldLinkProperty; |
1084 |
> |
IBDataset: TIBDataSet; |
1085 |
|
begin |
1086 |
< |
vPropEd := TIBTableFieldLinkProperty.CreateWith(TDataSet(Omega.Item)); |
1087 |
< |
try |
1208 |
< |
vPropEd.Edit; |
1209 |
< |
Result := vPropEd.Changed; |
1210 |
< |
finally |
1211 |
< |
vPropEd.Free; |
1212 |
< |
end; |
1213 |
< |
end; |
1214 |
< |
|
1215 |
< |
class function TIBTableMasterDetailBridge.GetOmegaSource( |
1216 |
< |
AItem: TPersistent): TDataSource; |
1217 |
< |
begin |
1218 |
< |
Result := TIBTable(AItem).MasterSource; |
1086 |
> |
IBDataset := GetComponent(0) as TIBDataSet; |
1087 |
> |
if IBInsertSQLEditor.EditSQL(IBDataSet,IBDataSet.InsertSQL) then Modified; |
1088 |
|
end; |
1089 |
|
|
1090 |
< |
class function TIBTableMasterDetailBridge.OmegaIslandClass: TIslandClass; |
1222 |
< |
begin |
1223 |
< |
Result := TIBTableIsland; |
1224 |
< |
end; |
1090 |
> |
{ TIBUpdateSQLInsertSQLProperty } |
1091 |
|
|
1092 |
< |
class procedure TIBTableMasterDetailBridge.SetOmegaSource( |
1227 |
< |
AItem: TPersistent; ADataSource: TDataSource); |
1092 |
> |
procedure TIBUpdateSQLInsertSQLProperty.Edit; |
1093 |
|
begin |
1094 |
< |
TIBTable(AItem).MasterSource := ADataSource; |
1094 |
> |
GetObjects; |
1095 |
> |
if IBInsertSQLEditor.EditSQL(FIBUpdateSQL.Dataset,FIBUpdateSQL.InsertSQL) then Modified; |
1096 |
|
end; |
1097 |
|
|
1098 |
< |
{ TIBQueryMasterDetailBridge } |
1098 |
> |
{ TIBGeneratorProperty } |
1099 |
|
|
1100 |
< |
function TIBQueryMasterDetailBridge.Caption: string; |
1100 |
> |
function TIBGeneratorProperty.GetAttributes: TPropertyAttributes; |
1101 |
|
begin |
1102 |
< |
Result := SParamsFields; |
1102 |
> |
Result:= inherited GetAttributes + [paDialog] - [paMultiSelect,paValueList]; |
1103 |
|
end; |
1104 |
|
|
1105 |
< |
class function TIBQueryMasterDetailBridge.GetOmegaSource( |
1240 |
< |
AItem: TPersistent): TDataSource; |
1105 |
> |
procedure TIBGeneratorProperty.Edit; |
1106 |
|
begin |
1107 |
< |
Result := TIBQuery(AItem).DataSource; |
1107 |
> |
if IBGeneratorEditor.EditGenerator(GetPersistentReference as TIBGenerator) then Modified; |
1108 |
|
end; |
1109 |
|
|
1110 |
< |
class function TIBQueryMasterDetailBridge.OmegaIslandClass: TIslandClass; |
1246 |
< |
begin |
1247 |
< |
Result := TIBQueryIsland; |
1248 |
< |
end; |
1110 |
> |
{ TIBSQLEditor } |
1111 |
|
|
1112 |
< |
class function TIBQueryMasterDetailBridge.RemoveMasterFieldsAsWell: Boolean; |
1112 |
> |
procedure TIBSQLEditor.ExecuteVerb(Index: Integer); |
1113 |
|
begin |
1114 |
< |
Result := False; |
1114 |
> |
if IBSQLEditor.EditIBSQL(TIBSQL(Component)) then Modified; |
1115 |
|
end; |
1116 |
|
|
1117 |
< |
class procedure TIBQueryMasterDetailBridge.SetOmegaSource( |
1256 |
< |
AItem: TPersistent; ADataSource: TDataSource); |
1117 |
> |
function TIBSQLEditor.GetVerb(Index: Integer): string; |
1118 |
|
begin |
1119 |
< |
TIBQuery(AItem).DataSource := ADataSource; |
1120 |
< |
end; |
1121 |
< |
|
1122 |
< |
{ TIBCustomDataSetIsland } |
1262 |
< |
|
1263 |
< |
function TIBCustomDataSetIsland.VisibleTreeParent: Boolean; |
1264 |
< |
begin |
1265 |
< |
Result := False; |
1119 |
> |
case Index of |
1120 |
> |
0 : Result := SIBSQLEditor; |
1121 |
> |
1: Result := SInterbaseExpressVersion; |
1122 |
> |
end; |
1123 |
|
end; |
1124 |
|
|
1125 |
< |
{ TIBSQLIsland } |
1269 |
< |
|
1270 |
< |
function TIBSQLIsland.VisibleTreeParent: Boolean; |
1125 |
> |
function TIBSQLEditor.GetVerbCount: Integer; |
1126 |
|
begin |
1127 |
< |
Result := False; |
1127 |
> |
Result:= 2 |
1128 |
|
end; |
1129 |
|
|
1130 |
< |
{ TIBTransactionIsland } |
1130 |
> |
{ TIBSQLSQLPropertyEditor } |
1131 |
|
|
1132 |
< |
function TIBTransactionIsland.VisibleTreeParent: Boolean; |
1132 |
> |
procedure TIBSQLSQLPropertyEditor.Edit; |
1133 |
> |
var |
1134 |
> |
IBSQL: TIBSQL; |
1135 |
|
begin |
1136 |
< |
Result := TIBTransaction(Sprig.Item).DefaultDatabase = nil; |
1136 |
> |
IBSQL := GetComponent(0) as TIBSQL; |
1137 |
> |
if IBSQLEditor.EditIBSQL(IBSQL) then Modified; |
1138 |
|
end; |
1139 |
|
|
1140 |
+ |
initialization |
1141 |
+ |
{$I IBDBReg.lrs} |
1142 |
|
end. |