Skip to content
Permalink
Browse files

Issue #496: show UNKNOWN data type in table editor for MSSQL and MySQ…

…L, as already for PG. Avoids casting its values to int for the data grid, and at least does not show the data type from the prior column in the table editor.
  • Loading branch information...
ansgarbecker committed Apr 22, 2019
1 parent 8f94ece commit fad93ace54c5f4909ad8f05ed84a511e247679c9
Showing with 29 additions and 3 deletions.
  1. +3 −1 source/dbconnection.pas
  2. +26 −2 source/mysql_structures.pas
@@ -1598,7 +1598,7 @@ function TDBConnection.GetDatatypeByName(var DataType: String; DeleteFromSource:
Delete(DataType, 1, MatchLen);
end;

if (MatchLen = 0) and (FParameters.NetTypeGroup = ngPgSQL) then begin
if MatchLen = 0 then begin
// Fall back to unknown type
Result := Datatypes[0];
rx.Expression := '^(\S+)';
@@ -5824,6 +5824,8 @@ procedure TAdoDBQuery.Execute(AddResult: Boolean=False; UseRawResult: Integer=-1
TypeIndex := dtTime;
ftDateTime:
TypeIndex := dtDateTime;
//ftTimeStampOffset: // this is NOT data type DATETIMEOFFSET
// TypeIndex := dtDatetime;
else
raise EDatabaseError.CreateFmt(_('Unknown data type for column #%d - %s: %d'), [i, FColumnNames[i], Integer(LastResult.Fields[i].DataType)]);
end;
@@ -347,8 +347,20 @@ TServerVariable = record
);

// MySQL Data Type List and Properties
MySQLDatatypes: array [0..36] of TDBDatatype =
MySQLDatatypes: array [0..37] of TDBDatatype =
(
(
Index: dtUnknown;
NativeTypes: '99999';
Name: 'UNKNOWN';
Description: 'Unknown data type';
HasLength: False;
RequiresLength: False;
HasBinary: False;
HasDefault: False;
LoadPart: False;
Category: dtcOther;
),
(
Index: dtTinyint;
NativeType: mytTiny;
@@ -948,8 +960,20 @@ TServerVariable = record

);

MSSQLDatatypes: array [0..31] of TDBDatatype =
MSSQLDatatypes: array [0..32] of TDBDatatype =
(
(
Index: dtUnknown;
NativeTypes: '99999';
Name: 'UNKNOWN';
Description: 'Unknown data type';
HasLength: False;
RequiresLength: False;
HasBinary: False;
HasDefault: False;
LoadPart: False;
Category: dtcOther;
),
(
Index: dtTinyint;
Name: 'TINYINT';

0 comments on commit fad93ac

Please sign in to comment.
You can’t perform that action at this time.