ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/public/ibx/branches/udr/client/FBSQLData.pas
(Generate patch)

Comparing ibx/trunk/fbintf/client/FBSQLData.pas (file contents):
Revision 46 by tony, Tue Dec 6 10:33:46 2016 UTC vs.
Revision 47 by tony, Mon Jan 9 15:31:51 2017 UTC

# Line 117 | Line 117 | type
117       function SQLData: PChar; virtual; abstract;
118       function GetDataLength: cardinal; virtual; abstract;
119       function GetCodePage: TSystemCodePage; virtual; abstract;
120 +     function getCharSetID: cardinal; virtual; abstract;
121       function Transliterate(s: string; CodePage: TSystemCodePage): RawByteString;
122       procedure SetScale(aValue: integer); virtual;
123       procedure SetDataLength(len: cardinal); virtual;
# Line 320 | Line 321 | type
321      function getAliasName: string;  {Alias Name of column or Column Name if not alias}
322      function GetName: string; override;      {Disambiguated uppercase Field Name}
323      function GetScale: integer; override;
324 <    function getCharSetID: cardinal;
324 >    function getCharSetID: cardinal; override;
325      function GetIsNullable: boolean; override;
326      function GetSize: cardinal;
327      function GetArrayMetaData: IArrayMetaData;
# Line 519 | Line 520 | const
520    CommentState = 1;
521    QuoteState = 2;
522    ParamState = 3;
523 +  ArrayDimState = 4;
524   {$ifdef ALLOWDIALECT3PARAMNAMES}
525    ParamDefaultState = 0;
526    ParamQuoteState = 1;
# Line 559 | Line 561 | begin
561          cNextChar := sSQL[i + 1];
562        { Now act based on the current state }
563        case iCurState of
564 <        DefaultState: begin
564 >        DefaultState:
565 >        begin
566            case cCurChar of
567 <            '''', '"': begin
567 >            '''', '"':
568 >            begin
569                cQuoteChar := cCurChar;
570                iCurState := QuoteState;
571              end;
572 <            '?', ':': begin
572 >            '?', ':':
573 >            begin
574                iCurState := ParamState;
575                AddToProcessedSQL('?');
576              end;
577 <            '/': if (cNextChar = '*') then begin
577 >            '/': if (cNextChar = '*') then
578 >            begin
579                AddToProcessedSQL(cCurChar);
580                Inc(i);
581                iCurState := CommentState;
582              end;
583 +            '[':
584 +            begin
585 +              AddToProcessedSQL(cCurChar);
586 +              Inc(i);
587 +              iCurState := ArrayDimState;
588 +            end;
589            end;
590          end;
591 <        CommentState: begin
591 >
592 >        ArrayDimState:
593 >        begin
594 >          case cCurChar of
595 >          ':',',','0'..'9',' ',#9,#10,#13:
596 >            begin
597 >              AddToProcessedSQL(cCurChar);
598 >              Inc(i);
599 >            end;
600 >          else
601 >            begin
602 >              AddToProcessedSQL(cCurChar);
603 >              Inc(i);
604 >              iCurState := DefaultState;
605 >            end;
606 >          end;
607 >        end;
608 >
609 >        CommentState:
610 >        begin
611            if (cNextChar = #0) then
612              IBError(ibxeSQLParseError, [SEOFInComment])
613            else if (cCurChar = '*') then begin
# Line 1268 | Line 1299 | begin
1299          end;
1300          SetString(rs, sz, str_len);
1301          SetCodePage(rs,GetCodePage,false);
1302 <        Result := Trim(rs);
1302 >        if (SQLType = SQL_TEXT) and (GetCharSetID <> 1) then
1303 >          Result := TrimRight(rs)
1304 >        else
1305 >          Result := rs
1306        end;
1307        SQL_TYPE_DATE:
1308          case GetSQLDialect of
# Line 1451 | Line 1485 | begin
1485  
1486    Changing;
1487    SQLType := SQL_TIMESTAMP;
1488 <  DataLength := SizeOf(TISC_QUAD);
1488 >  DataLength := SizeOf(ISC_TIME) + sizeof(ISC_DATE);
1489    with FirebirdClientAPI do
1490      SQLEncodeDateTime(Value,SQLData);
1491    Changed;
# Line 1777 | Line 1811 | begin
1811    if not IsNull then
1812    case SQLType of
1813      SQL_ARRAY:
1814 <      result := '(Array)'; {do not localize}
1814 >      result := SArray;
1815      SQL_BLOB:
1816 <      Result := Trim(FIBXSQLVAR.GetAsBlob(AsQuad,nil).GetAsString);
1816 >      Result := FIBXSQLVAR.GetAsBlob(AsQuad,nil).GetAsString;
1817      else
1818        Result := inherited GetAsString;
1819    end;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines