コード例 #1
0
        /// <summary>
        /// The Initialize method initializes the streaming database component, preparing it for data queries.
        /// </summary>
        /// <param name="qt">Specifies the query type to use (see remarks).</param>
        /// <param name="strSchema">Specifies the query schema to use.</param>
        /// <remarks>
        /// Additional settings for each query type are specified in the 'strSettings' parameter as a set
        /// of key=value pairs for each of the settings.  The following are the query specific settings
        /// that are expected for each QUERY_TYPE.
        ///
        /// qt = TIME:
        ///    'QueryCount' - Specifies the number of items to include in each query.
        ///    'Start' - Specifies the start date of the stream.
        ///    'TimeSpanInMs' - Specifies the time increment between data items in the stream in milliseconds.
        ///    'SegmentSize' - Specifies the segment size of data queried from the database.
        ///    'MaxCount' - Specifies the maximum number of items to load into memory for each custom query.
        ///
        /// qt = GENERAL:
        ///    none at this time.
        ///
        /// The database schema defines the number of custom queries to use along with their names.  A simple key=value; list
        /// defines the streaming database schema using the following format:
        ///
        /// "ConnectionCount=2;
        ///  Connection0_CustomQueryName=Test1;
        ///  Connection0_CustomQueryParam=param_string1
        ///  Connection1_CustomQueryName=Test2;
        ///  Connection1_CustomQueryParam=param_string2"
        ///
        /// Each param_string specifies the parameters of the custom query and may include the database connection string, database
        /// table, and database fields to query.
        /// </remarks>
        public void Initialize(QUERY_TYPE qt, string strSchema)
        {
            if (qt == QUERY_TYPE.SYNCHRONIZED)
            {
                PropertySet ps            = new PropertySet(strSchema);
                int         nQueryCount   = ps.GetPropertyAsInt("QueryCount", 0);
                DateTime    dtStart       = ps.GetPropertyAsDateTime("Start");
                int         nTimeSpanInMs = ps.GetPropertyAsInt("TimeSpanInMs");
                int         nSegmentSize  = ps.GetPropertyAsInt("SegmentSize");
                int         nMaxCount     = ps.GetPropertyAsInt("MaxCount");

                m_iquery = new MgrQueryTime(nQueryCount, dtStart, nTimeSpanInMs, nSegmentSize, nMaxCount, strSchema, m_rgCustomQueryToAdd);
            }
            else
            {
                m_iquery = new MgrQueryGeneral(strSchema, m_rgCustomQueryToAdd);
            }
        }