mirror of
https://github.com/HeidiSQL/HeidiSQL.git
synced 2025-08-14 10:02:10 +08:00
Fix international characters in grid column headers (issue #994)
This commit is contained in:
@ -1420,8 +1420,8 @@ var
|
|||||||
AutoInit: Boolean;
|
AutoInit: Boolean;
|
||||||
FieldType: TFieldType;
|
FieldType: TFieldType;
|
||||||
ResultSet: IZResultSet;
|
ResultSet: IZResultSet;
|
||||||
FieldName: string;
|
FieldName: WideString;
|
||||||
FName: string;
|
FName: WideString;
|
||||||
begin
|
begin
|
||||||
FieldDefs.Clear;
|
FieldDefs.Clear;
|
||||||
ResultSet := Self.ResultSet;
|
ResultSet := Self.ResultSet;
|
||||||
@ -1456,7 +1456,7 @@ begin
|
|||||||
while FieldDefs.IndexOf(FName) >= 0 do
|
while FieldDefs.IndexOf(FName) >= 0 do
|
||||||
begin
|
begin
|
||||||
Inc(J);
|
Inc(J);
|
||||||
FName := Format('%s_%d', [FieldName, J]);
|
FName := WideFormat('%s_%d', [FieldName, J]);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
// Workaround for bug in DB.pas:
|
// Workaround for bug in DB.pas:
|
||||||
|
@ -755,8 +755,8 @@ type
|
|||||||
|
|
||||||
function IsSigned(Column: Integer): Boolean;
|
function IsSigned(Column: Integer): Boolean;
|
||||||
function GetColumnDisplaySize(Column: Integer): Integer;
|
function GetColumnDisplaySize(Column: Integer): Integer;
|
||||||
function GetColumnLabel(Column: Integer): string;
|
function GetColumnLabel(Column: Integer): WideString;
|
||||||
function GetColumnName(Column: Integer): string;
|
function GetColumnName(Column: Integer): WideString;
|
||||||
function GetSchemaName(Column: Integer): string;
|
function GetSchemaName(Column: Integer): string;
|
||||||
function GetPrecision(Column: Integer): Integer;
|
function GetPrecision(Column: Integer): Integer;
|
||||||
function GetScale(Column: Integer): Integer;
|
function GetScale(Column: Integer): Integer;
|
||||||
|
@ -65,7 +65,7 @@ uses
|
|||||||
Comobj,
|
Comobj,
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
ZTokenizer, ZSelectSchema, ZCompatibility, ZDbcResultSet;
|
ZTokenizer, ZSelectSchema, ZCompatibility, ZDbcResultSet, WideStrings;
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|
||||||
@ -79,8 +79,8 @@ type
|
|||||||
FNullable: TZColumnNullableType;
|
FNullable: TZColumnNullableType;
|
||||||
FSigned: Boolean;
|
FSigned: Boolean;
|
||||||
FColumnDisplaySize: Integer;
|
FColumnDisplaySize: Integer;
|
||||||
FColumnLabel: string;
|
FColumnLabel: WideString;
|
||||||
FColumnName: string;
|
FColumnName: WideString;
|
||||||
FSchemaName: string;
|
FSchemaName: string;
|
||||||
FPrecision: Integer;
|
FPrecision: Integer;
|
||||||
FScale: Integer;
|
FScale: Integer;
|
||||||
@ -104,8 +104,8 @@ type
|
|||||||
property Signed: Boolean read FSigned write FSigned;
|
property Signed: Boolean read FSigned write FSigned;
|
||||||
property ColumnDisplaySize: Integer read FColumnDisplaySize
|
property ColumnDisplaySize: Integer read FColumnDisplaySize
|
||||||
write FColumnDisplaySize;
|
write FColumnDisplaySize;
|
||||||
property ColumnLabel: string read FColumnLabel write FColumnLabel;
|
property ColumnLabel: WideString read FColumnLabel write FColumnLabel;
|
||||||
property ColumnName: string read FColumnName write FColumnName;
|
property ColumnName: WideString read FColumnName write FColumnName;
|
||||||
property SchemaName: string read FSchemaName write FSchemaName;
|
property SchemaName: string read FSchemaName write FSchemaName;
|
||||||
property Precision: Integer read FPrecision write FPrecision;
|
property Precision: Integer read FPrecision write FPrecision;
|
||||||
property Scale: Integer read FScale write FScale;
|
property Scale: Integer read FScale write FScale;
|
||||||
@ -124,7 +124,7 @@ type
|
|||||||
private
|
private
|
||||||
FLoaded: Boolean;
|
FLoaded: Boolean;
|
||||||
FMetadata: IZDatabaseMetadata;
|
FMetadata: IZDatabaseMetadata;
|
||||||
FColumnsLabels: TStrings;
|
FColumnsLabels: TWideStrings;
|
||||||
FSQL: WideString;
|
FSQL: WideString;
|
||||||
FTableColumns: TZHashMap;
|
FTableColumns: TZHashMap;
|
||||||
FIdentifierConvertor: IZIdentifierConvertor;
|
FIdentifierConvertor: IZIdentifierConvertor;
|
||||||
@ -136,14 +136,14 @@ type
|
|||||||
function GetTableColumns(TableRef: TZTableRef): IZResultSet;
|
function GetTableColumns(TableRef: TZTableRef): IZResultSet;
|
||||||
function ReadColumnByRef(FieldRef: TZFieldRef;
|
function ReadColumnByRef(FieldRef: TZFieldRef;
|
||||||
ColumnInfo: TZColumnInfo): Boolean;
|
ColumnInfo: TZColumnInfo): Boolean;
|
||||||
function ReadColumnByName(FieldName: string; TableRef: TZTableRef;
|
function ReadColumnByName(FieldName: WideString; TableRef: TZTableRef;
|
||||||
ColumnInfo: TZColumnInfo): Boolean;
|
ColumnInfo: TZColumnInfo): Boolean;
|
||||||
procedure ClearColumn(ColumnInfo: TZColumnInfo);
|
procedure ClearColumn(ColumnInfo: TZColumnInfo);
|
||||||
procedure LoadColumns;
|
procedure LoadColumns;
|
||||||
procedure ReplaceStarColumns(SelectSchema: IZSelectSchema);
|
procedure ReplaceStarColumns(SelectSchema: IZSelectSchema);
|
||||||
|
|
||||||
property MetaData: IZDatabaseMetadata read FMetadata write FMetadata;
|
property MetaData: IZDatabaseMetadata read FMetadata write FMetadata;
|
||||||
property ColumnsLabels: TStrings read FColumnsLabels write FColumnsLabels;
|
property ColumnsLabels: TWideStrings read FColumnsLabels write FColumnsLabels;
|
||||||
property SQL: WideString read FSQL write FSQL;
|
property SQL: WideString read FSQL write FSQL;
|
||||||
property IdentifierConvertor: IZIdentifierConvertor
|
property IdentifierConvertor: IZIdentifierConvertor
|
||||||
read FIdentifierConvertor write FIdentifierConvertor;
|
read FIdentifierConvertor write FIdentifierConvertor;
|
||||||
@ -163,8 +163,8 @@ type
|
|||||||
|
|
||||||
function IsSigned(Column: Integer): Boolean; virtual;
|
function IsSigned(Column: Integer): Boolean; virtual;
|
||||||
function GetColumnDisplaySize(Column: Integer): Integer; virtual;
|
function GetColumnDisplaySize(Column: Integer): Integer; virtual;
|
||||||
function GetColumnLabel(Column: Integer): string; virtual;
|
function GetColumnLabel(Column: Integer): WideString; virtual;
|
||||||
function GetColumnName(Column: Integer): string; virtual;
|
function GetColumnName(Column: Integer): WideString; virtual;
|
||||||
function GetSchemaName(Column: Integer): string; virtual;
|
function GetSchemaName(Column: Integer): string; virtual;
|
||||||
function GetPrecision(Column: Integer): Integer; virtual;
|
function GetPrecision(Column: Integer): Integer; virtual;
|
||||||
function GetScale(Column: Integer): Integer; virtual;
|
function GetScale(Column: Integer): Integer; virtual;
|
||||||
@ -353,17 +353,17 @@ end;
|
|||||||
@param column the first column is 1, the second is 2, ...
|
@param column the first column is 1, the second is 2, ...
|
||||||
@return the suggested column title
|
@return the suggested column title
|
||||||
}
|
}
|
||||||
function TZAbstractResultSetMetadata.GetColumnLabel(Column: Integer): string;
|
function TZAbstractResultSetMetadata.GetColumnLabel(Column: Integer): WideString;
|
||||||
var
|
var
|
||||||
I, J, N: Integer;
|
I, J, N: Integer;
|
||||||
ColumnName: string;
|
ColumnName: WideString;
|
||||||
ColumnsInfo: TObjectList;
|
ColumnsInfo: TObjectList;
|
||||||
begin
|
begin
|
||||||
{ Prepare unique column labels. }
|
{ Prepare unique column labels. }
|
||||||
if FColumnsLabels = nil then
|
if FColumnsLabels = nil then
|
||||||
begin
|
begin
|
||||||
ColumnsInfo := FResultSet.ColumnsInfo;
|
ColumnsInfo := FResultSet.ColumnsInfo;
|
||||||
FColumnsLabels := TStringList.Create;
|
FColumnsLabels := TWideStringList.Create;
|
||||||
for I := 0 to ColumnsInfo.Count - 1 do
|
for I := 0 to ColumnsInfo.Count - 1 do
|
||||||
begin
|
begin
|
||||||
N := 0;
|
N := 0;
|
||||||
@ -390,7 +390,7 @@ end;
|
|||||||
@return column name
|
@return column name
|
||||||
}
|
}
|
||||||
function TZAbstractResultSetMetadata.GetColumnName(
|
function TZAbstractResultSetMetadata.GetColumnName(
|
||||||
Column: Integer): string;
|
Column: Integer): WideString;
|
||||||
begin
|
begin
|
||||||
if not Loaded then LoadColumns;
|
if not Loaded then LoadColumns;
|
||||||
Result := TZColumnInfo(FResultSet.ColumnsInfo[Column - 1]).ColumnName;
|
Result := TZColumnInfo(FResultSet.ColumnsInfo[Column - 1]).ColumnName;
|
||||||
@ -573,7 +573,7 @@ end;
|
|||||||
@param ColumnInfo a column information object.
|
@param ColumnInfo a column information object.
|
||||||
@return <code>True</code> is column was found and read.
|
@return <code>True</code> is column was found and read.
|
||||||
}
|
}
|
||||||
function TZAbstractResultSetMetadata.ReadColumnByName(FieldName: string;
|
function TZAbstractResultSetMetadata.ReadColumnByName(FieldName: WideString;
|
||||||
TableRef: TZTableRef; ColumnInfo: TZColumnInfo): Boolean;
|
TableRef: TZTableRef; ColumnInfo: TZColumnInfo): Boolean;
|
||||||
var
|
var
|
||||||
TableColumns: IZResultSet;
|
TableColumns: IZResultSet;
|
||||||
@ -587,14 +587,14 @@ begin
|
|||||||
{ Locates a column row. }
|
{ Locates a column row. }
|
||||||
TableColumns.BeforeFirst;
|
TableColumns.BeforeFirst;
|
||||||
while TableColumns.Next do
|
while TableColumns.Next do
|
||||||
if TableColumns.GetString(4) = FieldName then
|
if TableColumns.GetUnicodeString(4) = FieldName then
|
||||||
Break;
|
Break;
|
||||||
if TableColumns.IsAfterLast then
|
if TableColumns.IsAfterLast then
|
||||||
begin
|
begin
|
||||||
{ Locates a column row with case insensitivity. }
|
{ Locates a column row with case insensitivity. }
|
||||||
TableColumns.BeforeFirst;
|
TableColumns.BeforeFirst;
|
||||||
while TableColumns.Next do
|
while TableColumns.Next do
|
||||||
if AnsiUpperCase(TableColumns.GetString(4)) = AnsiUpperCase(FieldName) then
|
if WideUpperCase(TableColumns.GetUnicodeString(4)) = WideUpperCase(FieldName) then
|
||||||
Break;
|
Break;
|
||||||
if TableColumns.IsAfterLast then
|
if TableColumns.IsAfterLast then
|
||||||
Exit;
|
Exit;
|
||||||
|
@ -76,15 +76,15 @@ type
|
|||||||
private
|
private
|
||||||
FCatalog: string;
|
FCatalog: string;
|
||||||
FSchema: string;
|
FSchema: string;
|
||||||
FTable: string;
|
FTable: WideString;
|
||||||
FAlias: string;
|
FAlias: string;
|
||||||
public
|
public
|
||||||
constructor Create(const Catalog, Schema, Table, Alias: string);
|
constructor Create(const Catalog, Schema, Table, Alias: string);
|
||||||
function FullName: string;
|
function FullName: WideString;
|
||||||
|
|
||||||
property Catalog: string read FCatalog write FCatalog;
|
property Catalog: string read FCatalog write FCatalog;
|
||||||
property Schema: string read FSchema write FSchema;
|
property Schema: string read FSchema write FSchema;
|
||||||
property Table: string read FTable write FTable;
|
property Table: WideString read FTable write FTable;
|
||||||
property Alias: string read FAlias write FAlias;
|
property Alias: string read FAlias write FAlias;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -203,7 +203,7 @@ end;
|
|||||||
Gets a full database table name.
|
Gets a full database table name.
|
||||||
@return a full database table name.
|
@return a full database table name.
|
||||||
}
|
}
|
||||||
function TZTableRef.FullName: string;
|
function TZTableRef.FullName: WideString;
|
||||||
begin
|
begin
|
||||||
Result := FTable;
|
Result := FTable;
|
||||||
if FCatalog <> '' then
|
if FCatalog <> '' then
|
||||||
|
Reference in New Issue
Block a user