Skip to content
Permalink
Browse files

Disable some controls on VIEW editor, which the underlying server doe…

…s not support, and don't generate SQL clauses for these. Closes #39.
  • Loading branch information
ansgarbecker committed Dec 3, 2019
1 parent 097a902 commit 2f2eba6e5639b1778f21f1380b8be766311cf94b
Showing with 11 additions and 2 deletions.
  1. +11 −2 source/view.pas
@@ -107,6 +107,15 @@ procedure TfrmView.Init(Obj: TDBObject);
SynMemoBody.Text := 'SELECT ';
lblDisabledWhy.Hide;
end;

// Most clauses only supported by MySQL
comboDefiner.Enabled := comboDefiner.Enabled and Obj.Connection.Parameters.IsMySQL;
lblDefiner.Enabled := comboDefiner.Enabled;
comboSecurity.Enabled := comboSecurity.Enabled and Obj.Connection.Parameters.IsMySQL;
lblSecurity.Enabled := comboSecurity.Enabled;
rgAlgorithm.Enabled := rgAlgorithm.Enabled and Obj.Connection.Parameters.IsMySQL;
rgCheck.Enabled := rgCheck.Enabled and Obj.Connection.Parameters.IsMySQL;

Modified := False;
btnSave.Enabled := Modified;
btnDiscard.Enabled := Modified;
@@ -164,9 +173,9 @@ function TfrmView.ApplyModifications: TModalResult;
viewname := DBObject.Connection.QuoteIdent(viewname);
if rgAlgorithm.Enabled and (rgAlgorithm.ItemIndex > -1) then
sql := sql + 'ALGORITHM = '+Uppercase(rgAlgorithm.Items[rgAlgorithm.ItemIndex])+' ';
if comboDefiner.Text <> '' then
if comboDefiner.Enabled and (comboDefiner.Text <> '') then
sql := sql + 'DEFINER='+DBObject.Connection.QuoteIdent(comboDefiner.Text, True, '@')+' ';
if comboSecurity.Text <> '' then
if comboSecurity.Enabled and (comboSecurity.Text <> '') then
sql := sql + 'SQL SECURITY ' + UpperCase(comboSecurity.Text)+' ';
sql := sql + 'VIEW ' + viewname+' AS '+SynMemoBody.Text+' ';
if rgCheck.Enabled and (rgCheck.ItemIndex > 0) then

0 comments on commit 2f2eba6

Please sign in to comment.
You can’t perform that action at this time.