--- ibx/trunk/fbintf/client/FBSQLData.pas 2016/12/06 10:33:46 46 +++ ibx/trunk/fbintf/client/FBSQLData.pas 2017/01/09 15:31:51 47 @@ -117,6 +117,7 @@ type function SQLData: PChar; virtual; abstract; function GetDataLength: cardinal; virtual; abstract; function GetCodePage: TSystemCodePage; virtual; abstract; + function getCharSetID: cardinal; virtual; abstract; function Transliterate(s: string; CodePage: TSystemCodePage): RawByteString; procedure SetScale(aValue: integer); virtual; procedure SetDataLength(len: cardinal); virtual; @@ -320,7 +321,7 @@ type function getAliasName: string; {Alias Name of column or Column Name if not alias} function GetName: string; override; {Disambiguated uppercase Field Name} function GetScale: integer; override; - function getCharSetID: cardinal; + function getCharSetID: cardinal; override; function GetIsNullable: boolean; override; function GetSize: cardinal; function GetArrayMetaData: IArrayMetaData; @@ -519,6 +520,7 @@ const CommentState = 1; QuoteState = 2; ParamState = 3; + ArrayDimState = 4; {$ifdef ALLOWDIALECT3PARAMNAMES} ParamDefaultState = 0; ParamQuoteState = 1; @@ -559,24 +561,53 @@ begin cNextChar := sSQL[i + 1]; { Now act based on the current state } case iCurState of - DefaultState: begin + DefaultState: + begin case cCurChar of - '''', '"': begin + '''', '"': + begin cQuoteChar := cCurChar; iCurState := QuoteState; end; - '?', ':': begin + '?', ':': + begin iCurState := ParamState; AddToProcessedSQL('?'); end; - '/': if (cNextChar = '*') then begin + '/': if (cNextChar = '*') then + begin AddToProcessedSQL(cCurChar); Inc(i); iCurState := CommentState; end; + '[': + begin + AddToProcessedSQL(cCurChar); + Inc(i); + iCurState := ArrayDimState; + end; end; end; - CommentState: begin + + ArrayDimState: + begin + case cCurChar of + ':',',','0'..'9',' ',#9,#10,#13: + begin + AddToProcessedSQL(cCurChar); + Inc(i); + end; + else + begin + AddToProcessedSQL(cCurChar); + Inc(i); + iCurState := DefaultState; + end; + end; + end; + + CommentState: + begin if (cNextChar = #0) then IBError(ibxeSQLParseError, [SEOFInComment]) else if (cCurChar = '*') then begin @@ -1268,7 +1299,10 @@ begin end; SetString(rs, sz, str_len); SetCodePage(rs,GetCodePage,false); - Result := Trim(rs); + if (SQLType = SQL_TEXT) and (GetCharSetID <> 1) then + Result := TrimRight(rs) + else + Result := rs end; SQL_TYPE_DATE: case GetSQLDialect of @@ -1451,7 +1485,7 @@ begin Changing; SQLType := SQL_TIMESTAMP; - DataLength := SizeOf(TISC_QUAD); + DataLength := SizeOf(ISC_TIME) + sizeof(ISC_DATE); with FirebirdClientAPI do SQLEncodeDateTime(Value,SQLData); Changed; @@ -1777,9 +1811,9 @@ begin if not IsNull then case SQLType of SQL_ARRAY: - result := '(Array)'; {do not localize} + result := SArray; SQL_BLOB: - Result := Trim(FIBXSQLVAR.GetAsBlob(AsQuad,nil).GetAsString); + Result := FIBXSQLVAR.GetAsBlob(AsQuad,nil).GetAsString; else Result := inherited GetAsString; end;