コード例 #1
0
 /// <summary>
 /// Generate the SQL string using <paramref name="sqlBuilder"/> with <paramref name="info"/>
 /// </summary>
 /// <param name="info">
 /// The current dataretrieval state. 
 /// </param>
 /// <param name="sqlBuilder">
 /// The sql builder. 
 /// </param>
 private void GenerateSql(DataRetrievalInfo info, ISqlBuilder sqlBuilder)
 {
     // Generate sql query
     Logger.Info(Resources.InfoStartGeneratingSQLDDB);
     sqlBuilder.GenerateSql(info);
     Logger.Info(Resources.InfoEndGeneratingSQLDDB);
 }
コード例 #2
0
        /// <summary>
        /// Execute the specified <paramref name="sqlBuilder"/>, if not null and <paramref name="codeListRetrievalEngine"/>
        /// </summary>
        /// <param name="info">
        /// The current codelist retrieval information
        /// </param>
        /// <param name="codeListRetrievalEngine">
        /// The code list retrieval engine.
        /// </param>
        /// <param name="sqlBuilder">
        /// The sql builder.
        /// </param>
        /// <returns>
        /// The partial codelist 
        /// </returns>
        private static ICodelistMutableObject Execute(
            StructureRetrievalInfo info, ICodeListRetrievalEngine codeListRetrievalEngine, ISqlBuilder sqlBuilder)
        {
            if (sqlBuilder != null)
            {
                info.Logger.InfoFormat(
                        CultureInfo.InvariantCulture,
                        "|-- Generating SQL for dissemination database... using sql builder :{0}",
                        sqlBuilder);
                info.SqlQuery = sqlBuilder.GenerateSql(info);
                info.Logger.Info("|-- SQL for dissemination database generated:\n" + info.SqlQuery);
            }

            info.Logger.Info("|-- Retrieving codes... using codelist retrieval engine " + codeListRetrievalEngine);

            ICodelistMutableObject codeListBean = codeListRetrievalEngine.GetCodeList(info);

            if (codeListBean != null)
            {
                info.Logger.Info("|-- Codes retrieved successfully, found : " + codeListBean.Items.Count + " codes");
            }
            else
            {
                info.Logger.Warn(
                    "|-- Warning: Codes not retrieved. The engine " + codeListRetrievalEngine + " returned no codelist.");
            }

            return codeListBean;
        }