fcl-db: odbc: map UNSIGNED SMALLINT to ftWord fields. TestSupportWordFields

git-svn-id: trunk@25032 -
This commit is contained in:
lacak 2013-07-03 08:24:51 +00:00
parent 162cb30528
commit 7a46ebd7f1
2 changed files with 22 additions and 1 deletions

View File

@ -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

View File

@ -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