756 |
|
var WhereClause: string; |
757 |
|
Separator: string; |
758 |
|
Count: integer; |
759 |
– |
Prefix: string; |
759 |
|
ColumnName: string; |
760 |
+ |
ColParamName: string; |
761 |
|
begin |
762 |
|
Count := 0; |
763 |
|
WhereClause := 'Where'; |
764 |
|
Separator := ' A.'; |
765 |
– |
if UseOldValues then |
766 |
– |
Prefix := ':OLD_' |
767 |
– |
else |
768 |
– |
Prefix := ':'; |
765 |
|
with PrimaryKeys do |
766 |
|
begin |
767 |
|
DisableControls; |
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; |
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 + ')'; |
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); |