183 |
|
FDataSets: TList; |
184 |
|
FLoginCalled: boolean; |
185 |
|
FCharSetSizes: array of integer; |
186 |
+ |
FCharSetNames: array of string; |
187 |
|
procedure EnsureInactive; |
188 |
|
function GetDBSQLDialect: Integer; |
189 |
|
function GetSQLDialect: Integer; |
444 |
|
procedure DoAfterInsert(Sender: TObject); virtual; |
445 |
|
procedure DoAfterPost(Sender: TObject); virtual; |
446 |
|
function GetCharSetSize(CharSetID: integer): integer; |
447 |
+ |
function GetDefaultCharSetSize: integer; |
448 |
+ |
function GetCharSetName(CharSetID: integer): string; |
449 |
+ |
function GetDefaultCharSetName: string; |
450 |
|
procedure HandleException(Sender: TObject); |
451 |
|
procedure SetCursor; |
452 |
|
procedure RestoreCursor; |
634 |
|
InternalClose(False); |
635 |
|
FDBSQLDialect := 1; |
636 |
|
SetLength(FCharSetSizes,0); |
637 |
+ |
SetLength(FCharSetNames,0); |
638 |
|
end; |
639 |
|
|
640 |
|
procedure TIBDataBase.CreateDatabase; |
839 |
|
try |
840 |
|
Query.Database := Self; |
841 |
|
Query.Transaction := FInternalTransaction; |
842 |
< |
Query.SQL.Text := 'Select RDB$CHARACTER_SET_ID, RDB$BYTES_PER_CHARACTER ' + |
842 |
> |
Query.SQL.Text := 'Select RDB$CHARACTER_SET_ID, RDB$BYTES_PER_CHARACTER, RDB$CHARACTER_SET_NAME ' + |
843 |
|
'From RDB$CHARACTER_SETS Order by 1 DESC'; {do not localize} |
844 |
|
Query.Prepare; |
845 |
|
Query.ExecQuery; |
846 |
|
if not Query.EOF then |
847 |
|
begin |
848 |
|
SetLength(FCharSetSizes,Query.FieldByName('RDB$CHARACTER_SET_ID').AsInteger + 1); |
849 |
+ |
SetLength(FCharSetNames,Query.FieldByName('RDB$CHARACTER_SET_ID').AsInteger + 1); |
850 |
|
for i := 0 to Length(FCharSetSizes) - 1 do FCharSetSizes[i] := 1; |
851 |
|
repeat |
852 |
|
FCharSetSizes[Query.FieldByName('RDB$CHARACTER_SET_ID').AsInteger] := |
853 |
|
Query.FieldByName('RDB$BYTES_PER_CHARACTER').AsInteger; |
854 |
+ |
FCharSetNames[Query.FieldByName('RDB$CHARACTER_SET_ID').AsInteger] := |
855 |
+ |
Query.FieldByName('RDB$CHARACTER_SET_NAME').AsString; |
856 |
|
Query.Next; |
857 |
|
until Query.EOF; |
858 |
|
end; |
1030 |
|
try |
1031 |
|
TempDBParams.Assign(FDBParams); |
1032 |
|
aDBName := FDBName; |
1033 |
< |
{Opportuning to override defaults} |
1033 |
> |
{Opportunity to override defaults} |
1034 |
|
for i := 0 to FSQLObjects.Count - 1 do |
1035 |
|
begin |
1036 |
|
if FSQLObjects[i] <> nil then |
2031 |
|
Result := 1; {Unknown character set} |
2032 |
|
end; |
2033 |
|
|
2034 |
+ |
function TIBBase.GetDefaultCharSetSize: integer; |
2035 |
+ |
var DefaultCharSetName: string; |
2036 |
+ |
i: integer; |
2037 |
+ |
begin |
2038 |
+ |
DefaultCharSetName := GetDefaultCharSetName; |
2039 |
+ |
Result := 4; {worse case} |
2040 |
+ |
for i := 0 to Length(Database.FCharSetSizes) - 1 do |
2041 |
+ |
if Database.FCharSetNames[i] = DefaultCharSetName then |
2042 |
+ |
begin |
2043 |
+ |
Result := Database.FCharSetSizes[i]; |
2044 |
+ |
break; |
2045 |
+ |
end; |
2046 |
+ |
end; |
2047 |
+ |
|
2048 |
+ |
function TIBBase.GetCharSetName(CharSetID: integer): string; |
2049 |
+ |
begin |
2050 |
+ |
if (CharSetID >= 0) and (CharSetID < Length(Database.FCharSetNames)) then |
2051 |
+ |
Result := Database.FCharSetNames[CharSetID] |
2052 |
+ |
else |
2053 |
+ |
Result := ''; {Unknown character set} |
2054 |
+ |
end; |
2055 |
+ |
|
2056 |
+ |
function TIBBase.GetDefaultCharSetName: string; |
2057 |
+ |
begin |
2058 |
+ |
Result := AnsiUpperCase(Database.Params.Values['lc_ctype']); |
2059 |
+ |
end; |
2060 |
+ |
|
2061 |
|
procedure TIBBase.HandleException(Sender: TObject); |
2062 |
|
begin |
2063 |
|
if assigned(Database) then |