ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/public/ibx/trunk/design/IBSQLEditFrame.pas
(Generate patch)

Comparing ibx/trunk/design/IBSQLEditFrame.pas (file contents):
Revision 158 by tony, Thu Mar 1 11:23:33 2018 UTC vs.
Revision 263 by tony, Thu Dec 6 15:55:01 2018 UTC

# Line 32 | Line 32 | interface
32   uses
33    Classes, SysUtils, FileUtil, SynEdit, SynHighlighterSQL, LResources, Forms,
34    Controls, ActnList, Menus, Dialogs, ComCtrls, ExtCtrls, StdCtrls, IBQuery,
35 <  IBSQL, IBDatabase, IBUpdate, IBDatabaseInfo, IBLookupComboEditBox,
35 >  IBSQL, IBDatabase, IBUpdate, IBDatabaseInfo,
36    IBCustomDataset, db, LazSynTextArea, IB;
37  
38   type
# Line 702 | Line 702 | procedure TIBSQLEditFrame.GenerateModify
702   var FieldNames: TStrings;
703      ReadOnlyFieldNames: TStrings;
704      UpdateFields: TStrings;
705    i, index: integer;
705   begin
706    SQL.Clear;
707    FieldNames := TStringList.Create;
# Line 757 | Line 756 | procedure TIBSQLEditFrame.AddWhereClause
756   var WhereClause: string;
757      Separator: string;
758      Count: integer;
760    Prefix: string;
759      ColumnName: string;
760 +    ColParamName: string;
761   begin
762    Count := 0;
763    WhereClause := 'Where';
764    Separator := ' A.';
766  if UseOldValues then
767    Prefix := ':OLD_'
768  else
769    Prefix := ':';
765    with PrimaryKeys do
766    begin
767      DisableControls;
# Line 779 | Line 774 | begin
774          begin
775            Inc(Count);
776            ColumnName := FieldByName('ColumnName').AsString;
777 +          if UseOldValues then
778 +            ColParamName := 'OLD_' + AnsiUpperCase(ColumnName)
779 +          else
780 +            ColParamName := AnsiUpperCase(ColumnName);
781 +
782            if QuotedStrings then
783 <            WhereClause := WhereClause + Separator + '"' + ColumnName +
784 <                   '" = ' + Prefix+ AnsiUpperCase(ColumnName)
783 >            WhereClause := WhereClause +
784 >                           Separator +
785 >                           '"' + ColumnName + '" = :"' + ColParamName + '"'
786            else
787 <            WhereClause := WhereClause + Separator + QuoteIdentifierIfNeeded(Database.SQLDialect,ColumnName) +
788 <                   ' = ' + Prefix + AnsiUpperCase(ColumnName);
787 >            WhereClause := WhereClause +
788 >                           Separator +
789 >                           QuoteIdentifierIfNeeded(Database.SQLDialect,ColumnName) +
790 >                           ' = :' +
791 >                           QuoteIdentifierIfNeeded(Database.SQLDialect,ColParamName);
792            Separator := ' AND A.';
793          end;
794          Next;
# Line 904 | Line 908 | begin
908      Separator := ':';
909      for I := 0 to FieldNames.Count - 1 do
910        begin
911 <         InsertSQL := InsertSQL + Separator +  AnsiUpperCase(FieldNames[I]) ;
911 >        if QuotedStrings then
912 >          InsertSQL := InsertSQL + Separator +  '"' + AnsiUpperCase(FieldNames[I]) + '"'
913 >        else
914 >          InsertSQL := InsertSQL + Separator +  QuoteIdentifierIfNeeded(Database.SQLDialect,AnsiUpperCase(FieldNames[I])) ;
915           Separator := ', :';
916        end;
917      InsertSQL := InsertSQL + ')';
# Line 925 | Line 932 | begin
932               (not PrimaryKeys.Active or not PrimaryKeys.Locate('columnName;Selected',
933                    VarArrayOf([IdentityCols.FieldByName('ColumnName').AsString,0]),[loCaseInsensitive])) then
934            begin
935 <            InsertSQL := InsertSQL + Separator + IdentityCols.FieldByName('ColumnName').AsString;
935 >            InsertSQL := InsertSQL + Separator + QuoteIdentifierIfNeeded(Database.SQLDialect,IdentityCols.FieldByName('ColumnName').AsString);
936              Separator := ', ';
937            end;
938            IdentityCols.Next;
# Line 962 | Line 969 | begin
969    for I := 0 to FieldNames.Count - 1 do
970      begin
971        if QuotedStrings then
972 <        UpdateSQL := Separator + '"' + FieldNames[I] + '" = :' + AnsiUpperCase(FieldNames[I])
972 >        UpdateSQL := Separator + '"' + FieldNames[I] + '" = :"' + AnsiUpperCase(FieldNames[I]) + '"'
973        else
974 <        UpdateSQL := Separator + QuoteIdentifierIfNeeded(Database.SQLDialect,FieldNames[I]) + ' = :' + AnsiUpperCase(FieldNames[I]);
974 >        UpdateSQL := Separator + QuoteIdentifierIfNeeded(Database.SQLDialect,FieldNames[I]) + ' = :' +
975 >                                 QuoteIdentifierIfNeeded(Database.SQLDialect,AnsiUpperCase(FieldNames[I]));
976        if I < FieldNames.Count - 1 then
977          UpdateSQL := UpdateSQL + ',';
978        SQL.Add(UpdateSQL);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines