protected virtual ValueTask <IQsiAnalysisResult> ExecuteDropPrepareAction(IAnalyzerContext context, IQsiDropPrepareActionNode action)
        {
            var refAction = new QsiReferenceAction
            {
                Type           = QsiReferenceType.Prepared,
                Operation      = QsiReferenceOperation.Delete,
                IsolationLevel = QsiReferenceIsolationLevel.Session,
                Target         = action.Identifier
            };

            return(refAction.ToResult().AsValueTask());
        }
        protected virtual ValueTask <IQsiAnalysisResult> ExecutePrepareAction(IAnalyzerContext context, IQsiPrepareActionNode action)
        {
            string query;

            switch (action.Query)
            {
            case IQsiLiteralExpressionNode {
                    Type: QsiDataType.String
            } literal:
                query = literal.Value?.ToString();
                break;

            case IQsiVariableExpressionNode variableAccess:
                var variable = context.Engine.RepositoryProvider.LookupVariable(variableAccess.Identifier) ??
                               throw new QsiException(QsiError.UnknownVariable, variableAccess.Identifier);

                if (variable.Type != QsiDataType.String)
                {
                    throw new InvalidOperationException();
                }

                query = variable.Value.ToString();
                break;

            default:
                throw new InvalidOperationException();
            }

            var scriptType = context.Engine.ScriptParser.GetSuitableType(query);

            var refAction = new QsiReferenceAction
            {
                Type           = QsiReferenceType.Prepared,
                Operation      = QsiReferenceOperation.Create,
                IsolationLevel = QsiReferenceIsolationLevel.Session,
                Target         = action.Identifier,
                Definition     = new QsiScript(query, scriptType)
            };

            return(refAction.ToResult().AsValueTask());
        }