mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-12-05 15:51:03 +01:00
fcl-db: odbc: map UNSIGNED SMALLINT to ftWord fields. TestSupportWordFields
git-svn-id: trunk@25032 -
This commit is contained in:
parent
162cb30528
commit
7a46ebd7f1
@ -1088,7 +1088,7 @@ var
|
||||
ColName,TypeName:string;
|
||||
FieldType:TFieldType;
|
||||
FieldSize:word;
|
||||
AutoIncAttr, Updatable, FixedPrecScale: SQLLEN;
|
||||
AutoIncAttr, Updatable, FixedPrecScale, Unsigned: SQLLEN;
|
||||
begin
|
||||
ODBCCursor:=cursor as TODBCCursor;
|
||||
|
||||
@ -1224,6 +1224,7 @@ begin
|
||||
|
||||
if FieldType in [ftFloat] then
|
||||
begin
|
||||
FixedPrecScale:=0;
|
||||
ODBCCheckResult(
|
||||
SQLColAttribute(ODBCCursor.FSTMTHandle,
|
||||
i,
|
||||
@ -1238,6 +1239,25 @@ begin
|
||||
FieldType:=ftCurrency;
|
||||
end;
|
||||
|
||||
if FieldType in [ftSmallint] then
|
||||
begin
|
||||
Unsigned:=0;
|
||||
ODBCCheckResult(
|
||||
SQLColAttribute(ODBCCursor.FSTMTHandle,
|
||||
i,
|
||||
SQL_DESC_UNSIGNED,
|
||||
nil,
|
||||
0,
|
||||
nil,
|
||||
@Unsigned),
|
||||
SQL_HANDLE_STMT, ODBCCursor.FSTMTHandle, 'Could not get unsigned attribute for column %d.',[i]
|
||||
);
|
||||
if Unsigned=SQL_TRUE then
|
||||
case FieldType of
|
||||
ftSmallint: FieldType:=ftWord;
|
||||
end;
|
||||
end;
|
||||
|
||||
if FieldType=ftUnknown then // if unknown field type encountered, try finding more specific information about the ODBC SQL DataType
|
||||
begin
|
||||
SetLength(TypeName,TypeNameDefaultLength); // also garantuees uniqueness
|
||||
|
||||
@ -225,6 +225,7 @@ begin
|
||||
end;
|
||||
ssMySQL:
|
||||
begin
|
||||
FieldtypeDefinitions[ftWord] := 'SMALLINT UNSIGNED';
|
||||
//MySQL recognizes BOOLEAN, but as synonym for TINYINT, not true sql boolean datatype
|
||||
FieldtypeDefinitions[ftBoolean] := '';
|
||||
// Use 'DATETIME' for datetime-fields instead of timestamp, because
|
||||
|
||||
Loading…
Reference in New Issue
Block a user