public DataTable Discover(string request, string restrictions, string properties)
        {
            Context.TraceEvent(100, 0, "Discover: Starting (" + request + ")");

            XmlaClient client = createXmlaClientAndConnect();
            DataTable  dt     = new DataTable();

            // if no properties restriction is specified, default to using
            // the current database
            if (properties.Length == 0)
            {
                properties = string.Format("<CATALOG>{0}</CATALOG>", Context.CurrentDatabaseName);
            }
            try
            {
                string res;
                TimeoutUtility.XmlaClientDiscover(client, request, restrictions, properties, out res, false, false, false);

                dt = createDataTableFromXmla(res);
            }
            finally
            {
                client.Disconnect();
                Context.TraceEvent(100, 0, "Discover: XML/A Connection disconnected");
            }
            Context.TraceEvent(100, 0, "Discover: Finished (" + dt.Rows.Count.ToString() + " rows returned");
            return(dt);
        }
        private void SetWindowsPrincipal()
        {
            WindowsIdentity windowsIdentity = null;

            try
            {
                //using (WindowsIdentity.Impersonate(IntPtr.Zero))
                //{
                //	windowsIdentity = XmlaClient.SPProxy.GetWindowsIdentityFromCurrentPrincipal();
                //}
            }
            catch
            {
            }
            if (windowsIdentity == null || !windowsIdentity.User.Equals(WindowsIdentity.GetCurrent().User))
            {
                XmlaClient.TraceVerbose("Setting windows principal on the thread to match the windows user {0}", new object[]
                {
                    WindowsIdentity.GetCurrent().Name
                });
                this.originalPrincipal  = Thread.CurrentPrincipal;
                Thread.CurrentPrincipal = new WindowsPrincipal(WindowsIdentity.GetCurrent());
                return;
            }
            XmlaClient.TraceVerbose("SharePoint principal matches windows user so leaving SharePoint principal. User {0}", new object[]
            {
                WindowsIdentity.GetCurrent().Name
            });
        }
        public override DataType GetResponseDataType()
        {
            DataType result;

            try
            {
                this.GetResponseStream();
                Match match = WcfStream.contentTypeRegex.Match(this.responseContentType);
                if (!match.Success)
                {
                    throw new AdomdUnknownResponseException(XmlaSR.UnsupportedDataFormat(this.responseContentType), "");
                }
                DataType dataTypeFromString = DataTypes.GetDataTypeFromString(match.Groups["content_type"].Value);
                if (dataTypeFromString == DataType.Undetermined || dataTypeFromString == DataType.Unknown)
                {
                    throw new AdomdUnknownResponseException(XmlaSR.UnsupportedDataFormat(this.responseContentType), "");
                }
                result = dataTypeFromString;
            }
            catch (XmlaStreamException e)
            {
                XmlaClient.UlsWriterLogException(e);
                throw;
            }
            catch (Exception ex)
            {
                XmlaClient.UlsWriterLogException(ex);
                throw new XmlaStreamException(ex);
            }
            return(result);
        }
 internal WcfStream(string dataSource, string serverEndpointAddress, bool specificVersion, string loginName, string databaseId, DataType desiredRequestType, DataType desiredResponseType, string applicationName) : base(desiredRequestType, desiredResponseType)
 {
     try
     {
         this.Init();
         this.spSite = XmlaClient.CreateSPSite(dataSource);
         this.serverEndpointAddress = serverEndpointAddress;
         this.loginName             = loginName;
         this.databaseId            = databaseId;
         this.applicationName       = applicationName;
         this.specificVersion       = specificVersion;
         this.logonWindowsIdentity  = WindowsIdentity.GetCurrent();
         this.logonWindowsPrincipal = new WindowsPrincipal(WindowsIdentity.GetCurrent());
         XmlaClient.UlsWriterSetCurrentRequestCategoryToRequestProcessing();
     }
     catch (XmlaStreamException e)
     {
         XmlaClient.UlsWriterLogException(e);
         throw;
     }
     catch (Exception ex)
     {
         XmlaClient.UlsWriterLogException(ex);
         throw new XmlaStreamException(ex);
     }
 }
예제 #5
0
 internal static MDDatasetFormatter ReadDataSetResponse(XmlReader reader)
 {
     if (!XmlaClient.IsDatasetResponseS(reader))
     {
         throw new InvalidOperationException(XmlaSR.SoapFormatter_ResponseIsNotDataset);
     }
     return(SoapFormatter.ReadDataSetResponsePrivate(reader));
 }
        private XmlaClient createXmlaClientAndConnect()
        {
            Context.CheckCancelled();
            XmlaClient client;

            client = new XmlaClient();
            Context.TraceEvent(100, 0, "Discover: About to Establish XML/A Connection");
            client.Connect(Context.CurrentServerID);
            Context.TraceEvent(100, 0, "Discover: XML/A Connection established");
            return(client);
        }
예제 #7
0
        private void CheckParameterValueType(object value, string argumentName)
        {
            if (value == null)
            {
                throw new ArgumentNullException(argumentName);
            }
            Type type = value.GetType();

            if (!XmlaClient.IsTypeSupportedForParameters(type))
            {
                throw new ArgumentException(SR.ArgumentErrorUnsupportedParameterType(type.FullName), argumentName);
            }
        }
        private void SetWindowsIdentity()
        {
            XmlaClient.TraceVerbose("Recovering windows identity from SharePoint", new object[0]);
            WindowsIdentity windowsIdentityFromCurrentPrincipal = XmlaClient.SPProxy.GetWindowsIdentityFromCurrentPrincipal();

            this.originalPrincipal = Thread.CurrentPrincipal;
            //this.ctx = windowsIdentityFromCurrentPrincipal.Impersonate();
            Thread.CurrentPrincipal = new WindowsPrincipal(WindowsIdentity.GetCurrent());
            XmlaClient.TraceVerbose("Set thread identity to user '{0}'", new object[]
            {
                windowsIdentityFromCurrentPrincipal.Name
            });
        }
        public DataTable DiscoverXmlMetadataFull(string path, string whereClause, string restrictions)
        {
            XmlaClient xmlac = createXmlaClientAndConnect();
            string     xmlaResult;
            string     properties = "";

            TimeoutUtility.XmlaClientDiscover(xmlac, "DISCOVER_XML_METADATA", restrictions, properties, out xmlaResult, false, false, false);

            XmlaDiscoverParser dp  = new XmlaDiscoverParser();
            XmlDocument        doc = new XmlDocument();

            doc.LoadXml(xmlaResult);
            return(dp.Parse(doc, path, Context.ExecuteForPrepare, whereClause));
        }
예제 #10
0
    public static void SendXMLA([SqlFacet(MaxSize = -1, IsNullable = false)] SqlString XMLA
                                , out SqlXml ReturnXMLA
                                , [SqlFacet(MaxSize = 255, IsNullable = true)] SqlString SSAS_Server)
    {
        XmlaClient clnt = new XmlaClient();

        clnt.Connect(SSAS_Server.IsNull ? OneIncOLAPExtensions.SSAS_Server.Value : SSAS_Server.Value);

        using (var reader = new StringReader(clnt.Send(XMLA.Value, null)))
            using (var xmlreader = new XmlTextReader(reader))
                ReturnXMLA = new SqlXml(xmlreader);

        clnt.Disconnect();
    }
        // Cancel Helper function
        private void executeCancel(string cancelCmd)
        {
            XmlaClient client = createXmlaClientAndConnect();
            string     res    = string.Empty;

            try
            {
                client.Execute(cancelCmd, string.Empty, out res, false, true);
            }
            finally
            {
                client.Disconnect();
            }
        }
예제 #12
0
 private static ResultsetFormatter ReadDiscoverResponsePrivate(XmlReader reader, InlineErrorHandlingType inlineErrorHandling, DataTable inTable, bool schemaOnly, Dictionary <string, bool> columnsToConvertTimeFor)
 {
     XmlaClient.StartDiscoverResponseS(reader);
     if (XmlaClient.IsRowsetResponseS(reader))
     {
         return(SoapFormatter.ReadRowsetResponsePrivate(reader, inlineErrorHandling, inTable, schemaOnly, columnsToConvertTimeFor));
     }
     if (!XmlaClient.IsEmptyResultS(reader))
     {
         throw new AdomdUnknownResponseException(XmlaSR.UnknownServerResponseFormat, string.Format("Expected rowset or empty result, got {0}", reader.Name));
     }
     XmlaClient.ReadEmptyRootS(reader);
     XmlaClient.EndDiscoverResponseS(reader);
     return(null);
 }
예제 #13
0
        private static ResultsetFormatter ReadRowsetResponsePrivate(XmlReader reader, InlineErrorHandlingType inlineErrorHandling, DataTable inTable, bool schemaOnly, Dictionary <string, bool> columnsToConvertTimeFor)
        {
            RowsetFormatter rowsetFormatter = new RowsetFormatter();

            if (reader.IsEmptyElement)
            {
                reader.Skip();
            }
            else
            {
                XmlaClient.StartRowsetResponseS(reader);
                rowsetFormatter.ReadRowset(reader, inlineErrorHandling, inTable, inTable == null || inTable.Columns.Count <= 1, schemaOnly, columnsToConvertTimeFor);
                XmlaClient.EndRowsetResponseS(reader);
            }
            return(rowsetFormatter);
        }
        private bool CheckForMessages()
        {
            XmlaMessageCollection xmlaMessageCollection = null;

            if (!XmlaClient.CheckForMessages(this.xmlReader, ref xmlaMessageCollection))
            {
                return(false);
            }
            XmlaResult currentResult = this.CurrentResult;

            foreach (XmlaMessage item in ((IEnumerable)xmlaMessageCollection))
            {
                currentResult.Messages.Add(item);
            }
            return(true);
        }
예제 #15
0
        private static MDDatasetFormatter ReadDataSetResponsePrivate(XmlReader reader)
        {
            MDDatasetFormatter mDDatasetFormatter = new MDDatasetFormatter();

            if (reader.IsEmptyElement)
            {
                reader.Skip();
            }
            else
            {
                XmlaClient.StartDatasetResponseS(reader);
                mDDatasetFormatter.ReadMDDataset(reader);
                XmlaClient.EndDatasetResponseS(reader);
            }
            return(mDDatasetFormatter);
        }
 private void GetResponseStream()
 {
     if (this.outdatedVersion)
     {
         throw new AdomdConnectionException(XmlaSR.Connection_WorkbookIsOutdated);
     }
     if (this.responseStream == null)
     {
         IPrincipal currentPrincipal = Thread.CurrentPrincipal;
         try
         {
             Thread.CurrentPrincipal = this.logonWindowsPrincipal;
             using (WindowsIdentity current = WindowsIdentity.GetCurrent())
             {
                 if (this.logonWindowsIdentity.User != current.User)
                 {
                     //using (this.logonWindowsIdentity.Impersonate())
                     //{
                     //	this.GetResponseStreamHelper();
                     //	goto IL_71;
                     //}
                 }
                 this.GetResponseStreamHelper();
                 IL_71 :;
             }
             if (this.outdatedVersion)
             {
                 throw new AdomdConnectionException(XmlaSR.Connection_WorkbookIsOutdated);
             }
             this.DetermineNegotiatedOptions();
         }
         catch (XmlaStreamException e)
         {
             XmlaClient.UlsWriterLogException(e);
             throw;
         }
         catch (Exception ex)
         {
             XmlaClient.UlsWriterLogException(ex);
             throw new XmlaStreamException(ex);
         }
         finally
         {
             Thread.CurrentPrincipal = currentPrincipal;
         }
     }
 }
 private void GetResponseStreamHelper()
 {
     this.responseFlags       = "1,0,0,0,0";
     this.responseContentType = "text/xml";
     try
     {
         long num = 0L;
         foreach (byte[] current in this.buffers)
         {
             num += (long)current.Length;
         }
         byte[] array;
         if (1 == this.buffers.Count)
         {
             array = this.buffers[0];
         }
         else
         {
             array = new byte[num];
             long num2 = 0L;
             foreach (byte[] current2 in this.buffers)
             {
                 current2.CopyTo(array, num2);
                 num2 += (long)current2.Length;
             }
         }
         this.responseStream = XmlaClient.GetResponseStreamHelper(this.spSite, new MemoryStream(array), this.serverEndpointAddress, this.loginName, this.databaseId, this.specificVersion, this.isFirstRequest, this.userAgent, this.applicationName, this.userAddress, "1,0,0,0,0", "text/xml", ref this.responseFlags, ref this.responseContentType, ref this.outdatedVersion);
         this.isFirstRequest = false;
     }
     catch (XmlaStreamException e)
     {
         XmlaClient.UlsWriterLogException(e);
         throw;
     }
     catch (Exception ex)
     {
         XmlaClient.UlsWriterLogException(ex);
         throw new XmlaStreamException(ex);
     }
     finally
     {
         if (this.buffers.Count != 0)
         {
             this.buffers = new List <byte[]>();
         }
     }
 }
 internal static AdomdDataReader CreateInstance(XmlReader xmlReader, CommandBehavior commandBehavior, AdomdConnection connection)
 {
     if (connection == null)
     {
         throw new ArgumentNullException("connection");
     }
     if (xmlReader == null)
     {
         throw new ArgumentNullException("xmlReader");
     }
     XmlaClient.ReadUptoRoot(xmlReader);
     if (XmlaClient.IsAffectedObjectsResponseS(xmlReader))
     {
         return(new AdomdAffectedObjectsReader(xmlReader, commandBehavior, connection));
     }
     return(new AdomdDataReader(xmlReader, commandBehavior, connection, true));
 }
 private bool InternalRead()
 {
     if (this.isClosed)
     {
         throw new InvalidOperationException(XmlaSR.DataReaderClosedError);
     }
     if (this.xmlReader == null || this.xmlReader.ReadState == ReadState.Closed)
     {
         throw new InvalidOperationException();
     }
     if (this.emptyResult)
     {
         XmlaClient.CheckForException(this.xmlReader, null, true);
         return(false);
     }
     if (this.dataReady)
     {
         this.CompletePreviousRow();
     }
     this.dataReady = this.BeginNewRow();
     if (this.dataReady)
     {
         if (!this.sequentialAccess)
         {
             int num = this.FieldCount;
             if (this.parentReader != null)
             {
                 num++;
             }
             object[] array = new object[num];
             this.GetRowXmlValues(array);
             if (this.parentReader != null)
             {
                 array[this.ParentId] = this.currentParentRow;
             }
             this.dtStore.Rows.Add(array);
         }
     }
     else if (this.Depth == 0)
     {
         XmlaClient.EndRowsetResponseS(this.xmlReader);
     }
     return(this.dataReady);
 }
예제 #20
0
 private static ResultsetFormatter ReadExecuteResponsePrivate(XmlReader reader, InlineErrorHandlingType inlineErrorHandling)
 {
     XmlaClient.StartExecuteResponseS(reader);
     if (XmlaClient.IsDatasetResponseS(reader))
     {
         return(SoapFormatter.ReadDataSetResponsePrivate(reader));
     }
     if (XmlaClient.IsRowsetResponseS(reader))
     {
         return(SoapFormatter.ReadRowsetResponsePrivate(reader, inlineErrorHandling, null, false, null));
     }
     if (!XmlaClient.IsEmptyResultS(reader))
     {
         throw new AdomdUnknownResponseException(XmlaSR.UnknownServerResponseFormat, string.Format("Expected dataset, rowset, or empty result, got {0}", reader.Name));
     }
     XmlaClient.ReadEmptyRootS(reader);
     XmlaClient.EndExecuteResponseS(reader);
     return(null);
 }
 private bool InternalNextResult(bool first)
 {
     if (!first)
     {
         this.InitResultData();
         this.SkipRootContents();
     }
     if (XmlaClient.IsEmptyResultS(this.xmlReader))
     {
         if (this.IsAffectedObjects)
         {
             throw new AdomdUnknownResponseException(XmlaSR.UnknownServerResponseFormat, "Got an empty result inside AffectedObjects");
         }
         this.RowsetName = null;
         this.xmlReader.ReadStartElement("root", "urn:schemas-microsoft-com:xml-analysis:empty");
         this.GenerateSchemaForEmptyResult();
         this.emptyResult = true;
         this.EnsureResultForNewRowset();
         return(true);
     }
     else
     {
         if (this.xmlReader.IsStartElement("root", "urn:schemas-microsoft-com:xml-analysis:rowset"))
         {
             this.RowsetName = this.xmlReader.GetAttribute("name");
             this.rowsetNames.Add(this.RowsetName);
             XmlaClient.StartRowsetResponseS(this.xmlReader);
             this.LoadResponseSchema();
             this.dataReady   = true;
             this.emptyResult = false;
             this.EnsureResultForNewRowset();
             return(true);
         }
         if (first)
         {
             throw new AdomdUnknownResponseException(XmlaSR.UnknownServerResponseFormat, "Expected at least one root element");
         }
         this.CheckForMessages();
         XmlaClient.EndElementS(this.xmlReader, this.IsAffectedObjects ? "AffectedObjects" : "results", "http://schemas.microsoft.com/analysisservices/2003/xmla-multipleresults");
         this.isMultipleResult = false;
         return(false);
     }
 }
        public override int Read(byte[] buffer, int offset, int size)
        {
            if (this.disposed)
            {
                throw new ObjectDisposedException(null);
            }
            if (buffer == null)
            {
                throw new ArgumentNullException("buffer");
            }
            if (offset < 0)
            {
                throw new ArgumentOutOfRangeException("offset");
            }
            if (size < 0)
            {
                throw new ArgumentOutOfRangeException("size");
            }
            if (size + offset > buffer.Length)
            {
                throw new ArgumentException(XmlaSR.InvalidArgument, "buffer");
            }
            int result;

            try
            {
                this.GetResponseStream();
                int num = this.responseStream.Read(buffer, offset, size);
                result = num;
            }
            catch (XmlaStreamException e)
            {
                XmlaClient.UlsWriterLogException(e);
                throw;
            }
            catch (Exception ex)
            {
                XmlaClient.UlsWriterLogException(ex);
                throw new XmlaStreamException(ex);
            }
            return(result);
        }
 public override void Skip()
 {
     if (this.disposed)
     {
         throw new ObjectDisposedException(null);
     }
     try
     {
         this.Init();
     }
     catch (XmlaStreamException e)
     {
         XmlaClient.UlsWriterLogException(e);
         throw;
     }
     catch (Exception ex)
     {
         XmlaClient.UlsWriterLogException(ex);
         throw new XmlaStreamException(ex);
     }
 }
예제 #24
0
        private string DiscoverRestrictions(string serverName, string rowset)
        {
            Microsoft.AnalysisServices.Xmla.XmlaClient xc = new XmlaClient();
            string res = "";

            xc.Connect(serverName);
            try
            {
                xc.Discover("DISCOVER_SCHEMA_ROWSETS"
                            , string.Format("<SchemaName>{0}</SchemaName>", rowset)
                            , string.Empty
                            , out res
                            , false, false, false);
            }
            finally
            {
                xc.Disconnect();
            }

            return(res);
        }
예제 #25
0
        static void Main(string[] args)
        {
            Console.Write("Server:");
            string server = Console.ReadLine();

            Console.Write("Database:");
            string database = Console.ReadLine();

            Console.Write("WaitIntervalInMiliSeconds:");
            string interval = Console.ReadLine();
            int    waitIntervalInMiliSeconds;

            Int32.TryParse(interval, out waitIntervalInMiliSeconds);

            XmlaClient clnt = new XmlaClient();

            int counter = 0;

            while (true)
            {
                clnt.Connect(server);

                string xmla = String.Format(@"<ClearCache xmlns=""http://schemas.microsoft.com/analysisservices/2003/engine"">  
                                    <Object>
                                        <DatabaseID>{0}</DatabaseID>
                                    </Object >
                                </ClearCache>", database);

                Console.WriteLine("Clearing cache (counter=" + counter + ")");

                clnt.Send(xmla, null);

                clnt.Disconnect();

                Thread.Sleep(waitIntervalInMiliSeconds);

                counter++;
            }
        }
 public override void Write(byte[] buffer, int offset, int size)
 {
     if (this.disposed)
     {
         throw new ObjectDisposedException(null);
     }
     try
     {
         byte[] array = new byte[size];
         Array.Copy(buffer, offset, array, 0, size);
         this.buffers.Add(array);
     }
     catch (XmlaStreamException e)
     {
         XmlaClient.UlsWriterLogException(e);
         throw;
     }
     catch (Exception ex)
     {
         XmlaClient.UlsWriterLogException(ex);
         throw new XmlaStreamException(ex);
     }
 }
예제 #27
0
        public void ClearCache()
        {
            XmlaClient clnt = new XmlaClient();
            string     xmla;

            clnt.Connect(SSASConnection.ConnectionString);
            xmla = @"<ClearCache xmlns=""http://schemas.microsoft.com/analysisservices/2003/engine"">
                    <Object>
                    <DatabaseID>" + this.DatabaseName + @"</DatabaseID>
                    </Object>
                    </ClearCache>";
            try
            {
                clnt.Send(xmla, null);
            }
            catch (XmlaException e)
            {
                clnt.Disconnect();
                throw new Exception(e.Message, e);
            }

            clnt.Disconnect();
        }
예제 #28
0
        public static object ReadDataSetProperty(XmlReader reader, Type type)
        {
            object result = null;

            if (!reader.IsEmptyElement)
            {
                using (FormattersHelpers.GetWhitespaceHandlingRestorer(reader, WhitespaceHandling.All))
                {
                    reader.ReadStartElement();
                    if (reader.NodeType == XmlNodeType.Text)
                    {
                        result = ((FormattersHelpers.GetValueDelegate)FormattersHelpers.typeConvertersHash[type])(reader.ReadString());
                    }
                    else
                    {
                        string text = FormattersHelpers.ReadWhiteSpace(reader);
                        if (reader.NodeType == XmlNodeType.EndElement)
                        {
                            result = text;
                        }
                        else if ((result = XmlaClient.CheckAndGetDatasetError(reader)) == null)
                        {
                            FormattersHelpers.CheckException(reader);
                            if (type == typeof(object))
                            {
                                result = FormattersHelpers.ReadPropertyXml(reader);
                            }
                        }
                    }
                    reader.ReadEndElement();
                    return(result);
                }
            }
            reader.Read();
            result = ((FormattersHelpers.GetValueDelegate)FormattersHelpers.typeConvertersHash[type])(string.Empty);
            return(result);
        }
 /// <summary>
 /// Execute XMLA script for creating multidimensional project.
 /// </summary>
 public static void ExecuteXMLAScript()
 {
     string connectionString =
     ConfigurationManager.ConnectionStrings["ConnectionStringAnalysisServices"].ToString();
       var client = new XmlaClient();
       var builder = new SqlConnectionStringBuilder(connectionString);
       client.Connect(builder.DataSource);
       string xmla = File.ReadAllText(Environment.CurrentDirectory + @"\Resources\XMLAQuery2.xmla");
       client.Send(xmla, null);
       client.Disconnect();
 }
 internal XmlaDataReader(XmlReader xmlReader, CommandBehavior commandBehavior, bool isXmlReaderAtRoot, IXmlaDataReaderOwner owner)
 {
     this.columnNameLookup    = new Hashtable();
     this.columnXmlNameLookup = new Hashtable();
     this.rowsetNames         = new List <string>();
     this.rowElement          = FormattersHelpers.RowElement;
     this.rowNamespace        = FormattersHelpers.RowElementNamespace;
     this.readersXmlDepth     = -1;
     //base..ctor();
     try
     {
         this.InternalInitialize(xmlReader, commandBehavior, owner);
         if (!isXmlReaderAtRoot)
         {
             XmlaClient.ReadUptoRoot(xmlReader);
         }
         this.IsAffectedObjects = XmlaClient.IsAffectedObjectsResponseS(xmlReader);
         this.isMultipleResult  = (this.IsAffectedObjects || XmlaClient.IsMultipleResultResponseS(xmlReader));
         this.Results           = new XmlaResultCollection();
         this.CollectTopLevelAttributes();
         if (XmlaClient.IsRowsetResponseS(xmlReader))
         {
             this.RowsetName = xmlReader.GetAttribute("name");
             this.rowsetNames.Add(this.RowsetName);
             this.EnsureResultForNewRowset();
             XmlaClient.StartRowsetResponseS(xmlReader);
             this.LoadResponseSchema();
         }
         else if (XmlaClient.IsMultipleResultResponseS(xmlReader) || XmlaClient.IsAffectedObjectsResponseS(xmlReader))
         {
             XmlaClient.StartElementS(xmlReader, this.IsAffectedObjects ? "AffectedObjects" : "results", "http://schemas.microsoft.com/analysisservices/2003/xmla-multipleresults");
             if (XmlaClient.IsRootElementS(xmlReader))
             {
                 this.InternalNextResult(true);
             }
             else
             {
                 if (!this.IsAffectedObjects)
                 {
                     throw new AdomdUnknownResponseException(XmlaSR.UnknownServerResponseFormat, "Expected at least one root element");
                 }
                 this.StartEmptyAffectedObjects();
             }
         }
         else
         {
             if (XmlaClient.IsDatasetResponseS(xmlReader))
             {
                 throw new AdomdUnknownResponseException(XmlaSR.Resultset_IsNotRowset, string.Format(CultureInfo.InvariantCulture, "Got {0}:{1}", new object[]
                 {
                     "urn:schemas-microsoft-com:xml-analysis:mddataset",
                     "root"
                 }));
             }
             if (!XmlaClient.IsEmptyResultS(xmlReader))
             {
                 throw new AdomdUnknownResponseException(XmlaSR.UnknownServerResponseFormat, string.Format(CultureInfo.InvariantCulture, "Expected {0}:{1}, got {2}", new object[]
                 {
                     "urn:schemas-microsoft-com:xml-analysis:empty",
                     "root",
                     xmlReader.Name
                 }));
             }
             XmlaClient.ReadEmptyRootS(xmlReader);
             throw new AdomdUnknownResponseException(XmlaSR.Resultset_IsNotRowset, string.Format(CultureInfo.InvariantCulture, "Unexpected node {0}", new object[]
             {
                 xmlReader.Name
             }));
         }
     }
     catch (AdomdUnknownResponseException)
     {
         xmlReader.Close();
         throw;
     }
     catch (AdomdConnectionException)
     {
         throw;
     }
     catch (XmlException innerException)
     {
         xmlReader.Close();
         throw new AdomdUnknownResponseException(XmlaSR.UnknownServerResponseFormat, innerException);
     }
     catch (IOException innerException2)
     {
         if (this.owner != null)
         {
             owner.CloseConnection(false);
         }
         throw new AdomdConnectionException(XmlaSR.ConnectionBroken, innerException2);
     }
     catch (XmlaException innerException3)
     {
         xmlReader.Close();
         throw new AdomdErrorResponseException(innerException3);
     }
     catch
     {
         if (this.owner != null)
         {
             owner.CloseConnection(false);
         }
         throw;
     }
 }
예제 #31
0
 public static void CheckException(XmlReader reader)
 {
     XmlaClient.CheckForException(reader, null, true);
 }
 private XmlaClient createXmlaClientAndConnect()
 {
     Context.CheckCancelled();
     XmlaClient client;
     client = new XmlaClient();
     Context.TraceEvent(100,0,"Discover: About to Establish XML/A Connection");
     client.Connect(Context.CurrentServerID);
     Context.TraceEvent(100, 0, "Discover: XML/A Connection established");
     return client;
 }
        private string DiscoverRestrictions(string serverName, string rowset)
        {
            Microsoft.AnalysisServices.Xmla.XmlaClient xc = new XmlaClient();
            string res = "";
            xc.Connect(serverName);
            try
            {
                xc.Discover("DISCOVER_SCHEMA_ROWSETS"
                    , string.Format("<SchemaName>{0}</SchemaName>", rowset)
                    , string.Empty
                    , out res
                    , false, false, false);
            }
            finally
            {
                xc.Disconnect();
            }

            return res;
        }