コード例 #1
0
        /// <summary>
        /// Execute a SmallWorld preview query
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>

        public static void ExecuteSmallWorldPreviewQuery(
            Query query,
            out QueryEngine qe,
            out List <object[]> rows)
        {
            byte[] ba;
            qe   = null;
            rows = null;

            string serializedQuery = query.Serialize();

            if (ServiceFacade.UseRemoteServices)
            {
                Mobius.Services.Native.INativeSession       nativeClient = ServiceFacade.CreateNativeSessionProxy();
                Services.Native.NativeMethodTransportObject resultObject =
                    ServiceFacade.InvokeNativeMethod(nativeClient,
                                                     (int)Services.Native.ServiceCodes.MobiusCompoundUtilService,
                                                     (int)Services.Native.ServiceOpCodes.MobiusCompoundUtilService.ExecuteSmallWorldPreviewQuery,
                                                     new Services.Native.NativeMethodTransportObject(new object[] { serializedQuery }));
                ((System.ServiceModel.IClientChannel)nativeClient).Close();

                if (resultObject.Value == null)
                {
                    return;
                }

                object[] oa   = resultObject.Value as object[];
                int      qeId = (int)oa[0];
                qe = new QueryEngine(qeId, null);                 // instantiate facade QE

                ba   = (byte[])oa[1];
                rows = VoArray.DeserializeByteArrayToVoArrayList(ba);
                return;
            }

            else
            {
                QEL.QueryEngine qelQe;
                Query           q2 = Query.Deserialize(serializedQuery);       // need to make separate copy of query
                QEL.MoleculeUtil.ExecuteSmallWorldPreviewQuery(q2, out qelQe, out rows);
                if (rows == null)
                {
                    return;
                }

                qe = new QueryEngine(-1, qelQe);

                ba   = VoArray.SerializeBinaryVoArrayListToByteArray(rows);                // serialize & deserialize to simulate service
                rows = VoArray.DeserializeByteArrayToVoArrayList(ba);
                return;
            }
        }
コード例 #2
0
        /// <summary>
        /// Execute a SmallWorld preview query with serialized parameters and results
        /// </summary>
        /// <param name="serializedQuery"></param>
        /// <returns>Object array with QE in first entry and serialized rows in second</returns>

        public static object[] ExecuteSmallWorldPreviewQuerySerialized(
            string serializedQuery)
        {
            QueryEngine     qe;
            List <object[]> rows;

            Query q = Data.Query.Deserialize(serializedQuery);

            ExecuteSmallWorldPreviewQuery(q, out qe, out rows);
            if (rows == null)
            {
                return(null);
            }

            byte[] ba = VoArray.SerializeBinaryVoArrayListToByteArray(rows);

            object[] oa = new object[2];
            oa[0] = qe.Id;
            oa[1] = ba;
            return(oa);
        }