426 |
|
|
427 |
|
{ TIBDatabase } |
428 |
|
|
429 |
< |
constructor TIBDatabase.Create(AOwner: TComponent); |
429 |
> |
constructor TIBDataBase.Create(AOwner: TComponent); |
430 |
|
{$ifdef WINDOWS} |
431 |
|
var acp: uint; |
432 |
|
{$endif} |
472 |
|
CheckStreamConnect; |
473 |
|
end; |
474 |
|
|
475 |
< |
destructor TIBDatabase.Destroy; |
475 |
> |
destructor TIBDataBase.Destroy; |
476 |
|
var |
477 |
|
i: Integer; |
478 |
|
begin |
498 |
|
inherited Destroy; |
499 |
|
end; |
500 |
|
|
501 |
< |
function TIBDatabase.Call(ErrCode: ISC_STATUS; |
502 |
< |
RaiseError: Boolean): ISC_STATUS; |
501 |
> |
function TIBDataBase.Call(ErrCode: ISC_STATUS; RaiseError: Boolean |
502 |
> |
): ISC_STATUS; |
503 |
|
begin |
504 |
|
result := ErrCode; |
505 |
|
FCanTimeout := False; |
507 |
|
IBDataBaseError; |
508 |
|
end; |
509 |
|
|
510 |
< |
procedure TIBDatabase.CheckActive; |
510 |
> |
procedure TIBDataBase.CheckActive; |
511 |
|
begin |
512 |
|
if StreamedConnected and (not Connected) then |
513 |
|
Loaded; |
515 |
|
IBError(ibxeDatabaseClosed, [nil]); |
516 |
|
end; |
517 |
|
|
518 |
< |
procedure TIBDatabase.EnsureInactive; |
518 |
> |
procedure TIBDataBase.EnsureInactive; |
519 |
|
begin |
520 |
|
if csDesigning in ComponentState then |
521 |
|
begin |
524 |
|
end |
525 |
|
end; |
526 |
|
|
527 |
< |
procedure TIBDatabase.CheckInactive; |
527 |
> |
procedure TIBDataBase.CheckInactive; |
528 |
|
begin |
529 |
|
if FHandle <> nil then |
530 |
|
IBError(ibxeDatabaseOpen, [nil]); |
531 |
|
end; |
532 |
|
|
533 |
< |
procedure TIBDatabase.CheckDatabaseName; |
533 |
> |
procedure TIBDataBase.CheckDatabaseName; |
534 |
|
begin |
535 |
|
if (FDBName = '') then |
536 |
|
IBError(ibxeDatabaseNameMissing, [nil]); |
537 |
|
end; |
538 |
|
|
539 |
< |
function TIBDatabase.AddSQLObject(ds: TIBBase): Integer; |
539 |
> |
function TIBDataBase.AddSQLObject(ds: TIBBase): Integer; |
540 |
|
begin |
541 |
|
result := 0; |
542 |
|
if (ds.Owner is TIBCustomDataSet) then |
549 |
|
FSQLObjects[result] := ds; |
550 |
|
end; |
551 |
|
|
552 |
< |
function TIBDatabase.AddTransaction(TR: TIBTransaction): Integer; |
552 |
> |
function TIBDataBase.AddTransaction(TR: TIBTransaction): Integer; |
553 |
|
begin |
554 |
|
result := FindTransaction(TR); |
555 |
|
if result <> -1 then |
566 |
|
FTransactions[result] := TR; |
567 |
|
end; |
568 |
|
|
569 |
< |
procedure TIBDatabase.DoDisconnect; |
569 |
> |
procedure TIBDataBase.DoDisconnect; |
570 |
|
begin |
571 |
|
if Connected then |
572 |
|
InternalClose(False); |
573 |
|
FDBSQLDialect := 1; |
574 |
|
end; |
575 |
|
|
576 |
< |
procedure TIBDatabase.CreateDatabase; |
576 |
> |
procedure TIBDataBase.CreateDatabase; |
577 |
|
var |
578 |
|
tr_handle: TISC_TR_HANDLE; |
579 |
|
begin |
586 |
|
True); |
587 |
|
end; |
588 |
|
|
589 |
< |
procedure TIBDatabase.DropDatabase; |
589 |
> |
procedure TIBDataBase.DropDatabase; |
590 |
|
begin |
591 |
|
CheckActive; |
592 |
|
Call(isc_drop_database(StatusVector, @FHandle), True); |
593 |
|
end; |
594 |
|
|
595 |
< |
procedure TIBDatabase.DBParamsChange(Sender: TObject); |
595 |
> |
procedure TIBDataBase.DBParamsChange(Sender: TObject); |
596 |
|
begin |
597 |
|
FDBParamsChanged := True; |
598 |
|
end; |
599 |
|
|
600 |
< |
procedure TIBDatabase.DBParamsChanging(Sender: TObject); |
600 |
> |
procedure TIBDataBase.DBParamsChanging(Sender: TObject); |
601 |
|
begin |
602 |
|
EnsureInactive; |
603 |
|
CheckInactive; |
604 |
|
end; |
605 |
|
|
606 |
< |
function TIBDatabase.FindTransaction(TR: TIBTransaction): Integer; |
606 |
> |
function TIBDataBase.FindTransaction(TR: TIBTransaction): Integer; |
607 |
|
var |
608 |
|
i: Integer; |
609 |
|
begin |
616 |
|
end; |
617 |
|
end; |
618 |
|
|
619 |
< |
function TIBDatabase.FindDefaultTransaction(): TIBTransaction; |
619 |
> |
function TIBDataBase.FindDefaultTransaction: TIBTransaction; |
620 |
|
var |
621 |
|
i: Integer; |
622 |
|
begin |
634 |
|
end; |
635 |
|
end; |
636 |
|
|
637 |
< |
procedure TIBDatabase.ForceClose; |
637 |
> |
procedure TIBDataBase.ForceClose; |
638 |
|
begin |
639 |
|
if Connected then |
640 |
|
InternalClose(True); |
641 |
|
end; |
642 |
|
|
643 |
< |
function TIBDatabase.GetConnected: Boolean; |
643 |
> |
function TIBDataBase.GetConnected: Boolean; |
644 |
|
begin |
645 |
|
result := FHandle <> nil; |
646 |
|
end; |
647 |
|
|
648 |
< |
function TIBDatabase.GetSQLObject(Index: Integer): TIBBase; |
648 |
> |
function TIBDataBase.GetSQLObject(Index: Integer): TIBBase; |
649 |
|
begin |
650 |
|
result := FSQLObjects[Index]; |
651 |
|
end; |
652 |
|
|
653 |
< |
function TIBDatabase.GetSQLObjectCount: Integer; |
653 |
> |
function TIBDataBase.GetSQLObjectCount: Integer; |
654 |
|
var |
655 |
|
i: Integer; |
656 |
|
begin |
659 |
|
Inc(result); |
660 |
|
end; |
661 |
|
|
662 |
< |
function TIBDatabase.GetDBParamByDPB(const Idx: Integer): String; |
662 |
> |
function TIBDataBase.GetDBParamByDPB( const Idx: Integer): String; |
663 |
|
var |
664 |
|
ConstIdx, EqualsIdx: Integer; |
665 |
|
begin |
682 |
|
result := ''; |
683 |
|
end; |
684 |
|
|
685 |
< |
function TIBDatabase.GetIdleTimer: Integer; |
685 |
> |
function TIBDataBase.GetIdleTimer: Integer; |
686 |
|
begin |
687 |
|
result := FTimer.Interval; |
688 |
|
end; |
689 |
|
|
690 |
< |
function TIBDatabase.GetTransaction(Index: Integer): TIBTransaction; |
690 |
> |
function TIBDataBase.GetTransaction(Index: Integer): TIBTransaction; |
691 |
|
begin |
692 |
|
result := FTransactions[Index]; |
693 |
|
end; |
694 |
|
|
695 |
< |
function TIBDatabase.GetTransactionCount: Integer; |
695 |
> |
function TIBDataBase.GetTransactionCount: Integer; |
696 |
|
var |
697 |
|
i: Integer; |
698 |
|
begin |
702 |
|
Inc(result); |
703 |
|
end; |
704 |
|
|
705 |
< |
function TIBDatabase.IndexOfDBConst(st: String): Integer; |
705 |
> |
function TIBDataBase.IndexOfDBConst(st: String): Integer; |
706 |
|
var |
707 |
|
i, pos_of_str: Integer; |
708 |
|
begin |
718 |
|
end; |
719 |
|
end; |
720 |
|
|
721 |
< |
procedure TIBDatabase.InternalClose(Force: Boolean); |
721 |
> |
procedure TIBDataBase.InternalClose(Force: Boolean); |
722 |
|
var |
723 |
|
i: Integer; |
724 |
|
begin |
797 |
|
end; |
798 |
|
end; |
799 |
|
|
800 |
< |
procedure TIBDatabase.Notification( AComponent: TComponent; |
801 |
< |
Operation: TOperation); |
800 |
> |
procedure TIBDataBase.Notification(AComponent: TComponent; |
801 |
> |
Operation: TOperation); |
802 |
|
var |
803 |
|
i: Integer; |
804 |
|
begin |
812 |
|
end; |
813 |
|
end; |
814 |
|
|
815 |
< |
function TIBDatabase.Login: Boolean; |
815 |
> |
function TIBDataBase.Login: Boolean; |
816 |
|
var |
817 |
|
IndexOfUser, IndexOfPassword: Integer; |
818 |
|
Username, Password, OldPassword: String; |
891 |
|
end; |
892 |
|
end; |
893 |
|
|
894 |
< |
procedure TIBDatabase.DoConnect; |
894 |
> |
procedure TIBDataBase.DoConnect; |
895 |
|
var |
896 |
|
DPB: String; |
897 |
|
TempDBParams: TStrings; |
946 |
|
MonitorHook.DBConnect(Self); |
947 |
|
end; |
948 |
|
|
949 |
< |
procedure TIBDatabase.RemoveSQLObject(Idx: Integer); |
949 |
> |
procedure TIBDataBase.RemoveSQLObject(Idx: Integer); |
950 |
|
var |
951 |
|
ds: TIBBase; |
952 |
|
begin |
960 |
|
end; |
961 |
|
end; |
962 |
|
|
963 |
< |
procedure TIBDatabase.RemoveSQLObjects; |
963 |
> |
procedure TIBDataBase.RemoveSQLObjects; |
964 |
|
var |
965 |
|
i: Integer; |
966 |
|
begin |
972 |
|
end; |
973 |
|
end; |
974 |
|
|
975 |
< |
procedure TIBDatabase.RemoveTransaction(Idx: Integer); |
975 |
> |
procedure TIBDataBase.RemoveTransaction(Idx: Integer); |
976 |
|
var |
977 |
|
TR: TIBTransaction; |
978 |
|
begin |
986 |
|
end; |
987 |
|
end; |
988 |
|
|
989 |
< |
procedure TIBDatabase.RemoveTransactions; |
989 |
> |
procedure TIBDataBase.RemoveTransactions; |
990 |
|
var |
991 |
|
i: Integer; |
992 |
|
begin |
994 |
|
RemoveTransaction(i); |
995 |
|
end; |
996 |
|
|
997 |
< |
procedure TIBDatabase.SetDatabaseName(const Value: TIBFileName); |
997 |
> |
procedure TIBDataBase.SetDatabaseName( const Value: TIBFileName); |
998 |
|
begin |
999 |
|
if FDBName <> Value then |
1000 |
|
begin |
1004 |
|
end; |
1005 |
|
end; |
1006 |
|
|
1007 |
< |
procedure TIBDatabase.SetDBParamByDPB(const Idx: Integer; Value: String); |
1007 |
> |
procedure TIBDataBase.SetDBParamByDPB( const Idx: Integer; Value: String); |
1008 |
|
var |
1009 |
|
ConstIdx: Integer; |
1010 |
|
begin |
1023 |
|
end; |
1024 |
|
end; |
1025 |
|
|
1026 |
< |
procedure TIBDatabase.SetDBParams(Value: TStrings); |
1026 |
> |
procedure TIBDataBase.SetDBParams(Value: TStrings); |
1027 |
|
begin |
1028 |
|
FDBParams.Assign(Value); |
1029 |
|
end; |
1030 |
|
|
1031 |
< |
procedure TIBDatabase.SetDefaultTransaction(Value: TIBTransaction); |
1031 |
> |
procedure TIBDataBase.SetDefaultTransaction(Value: TIBTransaction); |
1032 |
|
var |
1033 |
|
i: Integer; |
1034 |
|
begin |
1046 |
|
FDefaultTransaction := Value; |
1047 |
|
end; |
1048 |
|
|
1049 |
< |
procedure TIBDatabase.SetHandle(Value: TISC_DB_HANDLE); |
1049 |
> |
procedure TIBDataBase.SetHandle(Value: TISC_DB_HANDLE); |
1050 |
|
begin |
1051 |
|
if HandleIsShared then |
1052 |
|
Close |
1056 |
|
FHandleIsShared := (Value <> nil); |
1057 |
|
end; |
1058 |
|
|
1059 |
< |
procedure TIBDatabase.SetIdleTimer(Value: Integer); |
1059 |
> |
procedure TIBDataBase.SetIdleTimer(Value: Integer); |
1060 |
|
begin |
1061 |
|
if Value < 0 then |
1062 |
|
IBError(ibxeTimeoutNegative, [nil]) |
1075 |
|
end; |
1076 |
|
end; |
1077 |
|
|
1078 |
< |
function TIBDatabase.TestConnected: Boolean; |
1078 |
> |
function TIBDataBase.TestConnected: Boolean; |
1079 |
|
var |
1080 |
|
DatabaseInfo: TIBDatabaseInfo; |
1081 |
|
begin |
1096 |
|
end; |
1097 |
|
end; |
1098 |
|
|
1099 |
< |
procedure TIBDatabase.TimeoutConnection(Sender: TObject); |
1099 |
> |
procedure TIBDataBase.TimeoutConnection(Sender: TObject); |
1100 |
|
begin |
1101 |
|
if Connected then |
1102 |
|
begin |
1111 |
|
end; |
1112 |
|
end; |
1113 |
|
|
1114 |
< |
function TIBDatabase.GetIsReadOnly: Boolean; |
1114 |
> |
function TIBDataBase.GetIsReadOnly: Boolean; |
1115 |
|
var |
1116 |
|
DatabaseInfo: TIBDatabaseInfo; |
1117 |
|
begin |
1129 |
|
DatabaseInfo.Free; |
1130 |
|
end; |
1131 |
|
|
1132 |
< |
function TIBDatabase.GetSQLDialect: Integer; |
1132 |
> |
function TIBDataBase.GetSQLDialect: Integer; |
1133 |
|
begin |
1134 |
|
Result := FSQLDialect; |
1135 |
|
end; |
1136 |
|
|
1137 |
|
|
1138 |
< |
procedure TIBDatabase.SetSQLDialect(const Value: Integer); |
1138 |
> |
procedure TIBDataBase.SetSQLDialect( const Value: Integer); |
1139 |
|
begin |
1140 |
|
if (Value < 1) then IBError(ibxeSQLDialectInvalid, [nil]); |
1141 |
|
if ((FHandle = nil) or (Value <= FDBSQLDialect)) then |
1144 |
|
IBError(ibxeSQLDialectInvalid, [nil]); |
1145 |
|
end; |
1146 |
|
|
1147 |
< |
function TIBDatabase.GetDBSQLDialect: Integer; |
1147 |
> |
function TIBDataBase.GetDBSQLDialect: Integer; |
1148 |
|
var |
1149 |
|
DatabaseInfo: TIBDatabaseInfo; |
1150 |
|
begin |
1154 |
|
DatabaseInfo.Free; |
1155 |
|
end; |
1156 |
|
|
1157 |
< |
procedure TIBDatabase.ValidateClientSQLDialect; |
1157 |
> |
procedure TIBDataBase.ValidateClientSQLDialect; |
1158 |
|
begin |
1159 |
|
if (FDBSQLDialect < FSQLDialect) then |
1160 |
|
begin |
1164 |
|
end; |
1165 |
|
end; |
1166 |
|
|
1167 |
< |
procedure TIBDatabase.ApplyUpdates(const DataSets: array of TDataSet); |
1167 |
> |
procedure TIBDataBase.ApplyUpdates( const DataSets: array of TDataSet); |
1168 |
|
var |
1169 |
|
I: Integer; |
1170 |
|
DS: TIBCustomDataSet; |
1190 |
|
TR.CommitRetaining; |
1191 |
|
end; |
1192 |
|
|
1193 |
< |
procedure TIBDatabase.CloseDataSets; |
1193 |
> |
procedure TIBDataBase.CloseDataSets; |
1194 |
|
var |
1195 |
|
i: Integer; |
1196 |
|
begin |
1199 |
|
DataSets[i].close; |
1200 |
|
end; |
1201 |
|
|
1202 |
< |
function TIBDatabase.GetDataset(Index : longint) : TDataset; |
1202 |
> |
function TIBDataBase.GetDataset(Index: longint): TDataset; |
1203 |
|
begin |
1204 |
|
if (Index >= 0) and (Index < FDataSets.Count) then |
1205 |
|
Result := TDataSet(FDataSets[Index]) |
1207 |
|
raise Exception.Create('Invalid Index to DataSets'); |
1208 |
|
end; |
1209 |
|
|
1210 |
< |
function TIBDatabase.GetDataSetCount : Longint; |
1210 |
> |
function TIBDataBase.GetDataSetCount: Longint; |
1211 |
|
begin |
1212 |
|
Result := FDataSets.Count; |
1213 |
|
end; |
1228 |
|
inherited SetConnected(Value); |
1229 |
|
end; |
1230 |
|
|
1231 |
< |
procedure TIBDatabase.GetFieldNames(const TableName: string; List: TStrings); |
1231 |
> |
procedure TIBDataBase.GetFieldNames( const TableName: string; List: TStrings); |
1232 |
|
var |
1233 |
|
Query: TIBSQL; |
1234 |
|
begin |
1269 |
|
end; |
1270 |
|
end; |
1271 |
|
|
1272 |
< |
procedure TIBDatabase.GetTableNames(List: TStrings; SystemTables: Boolean); |
1272 |
> |
procedure TIBDataBase.GetTableNames(List: TStrings; SystemTables: Boolean); |
1273 |
|
var |
1274 |
|
Query : TIBSQL; |
1275 |
|
begin |
1687 |
|
for i := 0 to FSQLObjects.Count - 1 do |
1688 |
|
if (FSQLObjects[i] <> nil) and |
1689 |
|
(TIBBase(FSQLObjects[i]).Database = nil) then |
1690 |
< |
SetOrdProp(TIBBase(FSQLObjects[i]).Owner, 'Database', Integer(Value)); |
1690 |
> |
SetObjectProp(TIBBase(FSQLObjects[i]).Owner, 'Database', Value); |
1691 |
|
end; |
1692 |
|
FDefaultDatabase := Value; |
1693 |
|
end; |
2114 |
|
|
2115 |
|
|
2116 |
|
|
2117 |
< |
|
2117 |
> |
|