コード例 #1
0
ファイル: SqlHelper.cs プロジェクト: nuxleus/flexwikicore
        /// <summary>
        /// Get the latest version for the specified topic.
        /// </summary>
        /// <param name="ns">Namespace of the topic.</param>
        /// <param name="topicName">Name of the topic.</param>
        /// <param name="connectionString">Database Connectionstring to use for this namespace.</param>
        /// <returns>SqlTopicInfo containing the topic information.</returns>
        public static SqlInfoForTopic GetSqlTopicInfoForLatestTopicVersion(string ns, string topicName, string connectionString)
        {
            SqlInfoForTopic topicInfo = null;

            SqlParameter[] parameters = new SqlParameter[2];
            parameters[0] = new SqlParameter("@namespace", ns);
            parameters[1] = new SqlParameter("@topicName", topicName + "(%)"); // pattern for sql wild card search

            using(SqlDataReader reader = SqlDataAccessHelper.ExecuteReader(connectionString, CommandType.StoredProcedure, "GetSqlTopicInfoForLatestVersion", parameters) )
            {
                while(reader.Read())
                {
                    topicInfo = new SqlInfoForTopic(reader.GetString(0), reader.GetDateTime(1));
                }
            }

            return topicInfo;
        }
コード例 #2
0
ファイル: SqlHelper.cs プロジェクト: nuxleus/flexwikicore
        /// <summary>
        /// Gets all versions for the specified topic.
        /// </summary>
        /// <param name="ns">Namespace of the topic.</param>
        /// <param name="topicName">Name of the topic to fetch the archive topics.</param>
        /// <param name="connectionString">Database Connectionstring to use for this namespace.</param>
        /// <returns>Array of SqlTopicInfo for all the archive versions of the specified topic.</returns>
        public static SqlInfoForTopic[] GetSqlTopicInfosForTopic(string ns, string topicName, string connectionString)
        {
            ArrayList topicInfos = new ArrayList();

            SqlParameter[] parameters = new SqlParameter[2];
            parameters[0] = new SqlParameter("@namespace", ns);
            parameters[1] = new SqlParameter("@topicName", topicName + "(%)"); // pattern for sql wild card search

            using(SqlDataReader reader = SqlDataAccessHelper.ExecuteReader(connectionString, CommandType.StoredProcedure, "GetSqlTopicArchiveInfos", parameters) )
            {
                while(reader.Read())
                {
                    SqlInfoForTopic topicInfo = new SqlInfoForTopic(reader.GetString(0), reader.GetDateTime(1));
                    topicInfos.Add(topicInfo);
                }
            }

            return (SqlInfoForTopic[])topicInfos.ToArray(typeof(SqlInfoForTopic));
        }
コード例 #3
0
ファイル: SqlHelper.cs プロジェクト: nuxleus/flexwikicore
        /// <summary>
        /// Gets all versions for the specified topic since the specified date and including the 
        /// specified date.
        /// </summary>
        /// <param name="ns">Namespace of the topic.</param>
        /// <param name="topicName">Name of the topic to fetch the archive topics.</param>
        /// <param name="connectionString">Database Connectionstring to use for this namespace.</param>
        /// <returns>Array of SqlTopicInfo for all the archive versions of the specified topic.</returns>
        /// <summary>
        /// Gets all versions for the specified topic since the specified date and including the 
        /// specified date.
        /// </summary>
        /// <param name="ns">Namespace of the topic.</param>
        /// <param name="topicName">Name of the topic to fetch the archive topics.</param>
        /// <param name="stamp">Datetime indicating the lower bound for topic last write time.</param>
        /// <param name="connectionString">Database Connectionstring to use for this namespace.</param>
        /// <returns>Array of SqlTopicInfo for all the archive versions of the specified topic.</returns>
        public static SqlInfoForTopic[] GetSqlTopicInfosForTopicSince(string ns, string topicName, DateTime stamp ,string connectionString)
        {
            ArrayList topicInfos = new ArrayList();

            SqlParameter[] parameters = new SqlParameter[3];
            parameters[0] = new SqlParameter("@namespace", ns);
            parameters[1] = new SqlParameter("@topicName", topicName + "(%)"); // pattern for sql wild card search
            // Sql allow only dates between January 1, 1753 through December 31, 9999
            if( stamp.Year > 1800 )
            {
                parameters[2] = new SqlParameter("@stamp", stamp);
            }
            else
            {
                parameters[2] = new SqlParameter("@stamp", new DateTime(1800,1,1));
            }

            using(SqlDataReader reader = SqlDataAccessHelper.ExecuteReader(connectionString, CommandType.StoredProcedure, "GetSqlTopicArchiveInfosSince", parameters) )
            {
                while(reader.Read())
                {
                    SqlInfoForTopic topicInfo = new SqlInfoForTopic(reader.GetString(0), reader.GetDateTime(1));
                    topicInfos.Add(topicInfo);
                }
            }

            return (SqlInfoForTopic[])topicInfos.ToArray(typeof(SqlInfoForTopic));
        }
コード例 #4
0
ファイル: SqlHelper.cs プロジェクト: nuxleus/flexwikicore
        /// <summary>
        /// Get the latest version for the specified topic.
        /// </summary>
        /// <param name="ns">Namespace of the topic.</param>
        /// <param name="topicName">Name of the topic.</param>
        /// <param name="connectionString">Database Connectionstring to use for this namespace.</param>
        /// <returns>SqlTopicInfo containing the topic information.</returns>
        public SqlInfoForTopic GetSqlTopicInfoForLatestTopicVersion(string ns, string topicName)
        {
            SqlInfoForTopic topicInfo = null;

            DatabaseParameter[] parameters = new DatabaseParameter[2];
            parameters[0] = new DatabaseParameter("namespace", ns);
            parameters[1] = new DatabaseParameter("topicName", topicName + "(%)"); // pattern for sql wild card search

            _database.ExecuteReader(CommandType.StoredProcedure,
                "GetSqlTopicInfoForLatestVersion",
                delegate(IDataReader reader)
                {
                    while (reader.Read())
                    {
                        topicInfo = new SqlInfoForTopic(reader.GetString(0), reader.GetDateTime(1));
                    }
                },
                parameters);

            return topicInfo;
        }
コード例 #5
0
ファイル: SqlHelper.cs プロジェクト: nuxleus/flexwikicore
        /// <summary>
        /// Get all the non archive topics in the specified namespace.
        /// </summary>
        /// <param name="ns">Namespace of the topic.</param>
        /// <param name="sort">Boolean value to indicate if the topics need to be sorted in the 
        /// descending order based on last write time.</param>
        /// <param name="connectionString">Database Connectionstring to use for this namespace.</param>
        /// <returns>Array of SqlTopicInfo containing the information for all non archive topics in the namespace.</returns>
        public static SqlInfoForTopic[] GetSqlTopicInfoForNonArchiveTopics(string ns, bool sort, string connectionString)
        {
            ArrayList topicInfos = new ArrayList();

            SqlParameter[] parameters = new SqlParameter[1];
            parameters[0] = new SqlParameter("@namespace", ns);

            string storedProcedureName = "GetSqlTopicInfoForNonArchiveTopics";
            if( sort )
            {
                // To benefit from Sql compiled stored procedure cache using 2 different
                // stored procedures instead of passing the sort value thru to Sql.
                storedProcedureName = "GetSqlTopicInfoForNonArchiveTopicsSortedDescending";
            }
            using(SqlDataReader reader = SqlDataAccessHelper.ExecuteReader(connectionString, CommandType.StoredProcedure, storedProcedureName, parameters) )
            {
                while(reader.Read())
                {
                    SqlInfoForTopic topicInfo = new SqlInfoForTopic(reader.GetString(0), reader.GetDateTime(1));
                    topicInfos.Add(topicInfo);
                }
            }

            return (SqlInfoForTopic[])topicInfos.ToArray(typeof(SqlInfoForTopic));
        }
コード例 #6
0
ファイル: SqlHelper.cs プロジェクト: nuxleus/flexwikicore
        /// <summary>
        /// Gets all versions for the specified topic since the specified date and including the 
        /// specified date.
        /// </summary>
        /// <param name="ns">Namespace of the topic.</param>
        /// <param name="topicName">Name of the topic to fetch the archive topics.</param>
        /// <param name="stamp">Datetime indicating the lower bound for topic last write time.</param>
        /// <param name="connectionString">Database Connectionstring to use for this namespace.</param>
        /// <returns>Array of SqlTopicInfo for all the archive versions of the specified topic.</returns>
        public SqlInfoForTopic[] GetSqlTopicInfosForTopicSince(string ns, string topicName, DateTime stamp)
        {
            ArrayList topicInfos = new ArrayList();

            DatabaseParameter[] parameters = new DatabaseParameter[3];
            parameters[0] = new DatabaseParameter("namespace", ns);
            parameters[1] = new DatabaseParameter("topicName", topicName + "(%)"); // pattern for sql wild card search
            // Sql allow only dates between January 1, 1753 through December 31, 9999
            if (stamp.Year > 1800)
            {
                parameters[2] = new DatabaseParameter("stamp", stamp);
            }
            else
            {
                parameters[2] = new DatabaseParameter("stamp", new DateTime(1800, 1, 1));
            }

            _database.ExecuteReader(CommandType.StoredProcedure,
                "GetSqlTopicArchiveInfosSince",
                delegate(IDataReader reader)
                {
                    while (reader.Read())
                    {
                        SqlInfoForTopic topicInfo = new SqlInfoForTopic(reader.GetString(0), reader.GetDateTime(1));
                        topicInfos.Add(topicInfo);
                    }
                },
                parameters);

            return (SqlInfoForTopic[])topicInfos.ToArray(typeof(SqlInfoForTopic));
        }
コード例 #7
0
ファイル: SqlHelper.cs プロジェクト: nuxleus/flexwikicore
        /// <summary>
        /// Gets all versions for the specified topic.
        /// </summary>
        /// <param name="ns">Namespace of the topic.</param>
        /// <param name="topicName">Name of the topic to fetch the archive topics.</param>
        /// <param name="connectionString">Database Connectionstring to use for this namespace.</param>
        /// <returns>Array of SqlTopicInfo for all the archive versions of the specified topic.</returns>
        public SqlInfoForTopic[] GetSqlTopicInfosForTopic(string ns, string topicName)
        {
            ArrayList topicInfos = new ArrayList();

            DatabaseParameter[] parameters = new DatabaseParameter[2];
            parameters[0] = new DatabaseParameter("namespace", ns);
            parameters[1] = new DatabaseParameter("topicName", topicName + "(%)"); // pattern for sql wild card search

            _database.ExecuteReader(CommandType.StoredProcedure,
                "GetSqlTopicArchiveInfos",
                delegate (IDataReader reader)
                {
                    while (reader.Read())
                    {
                        SqlInfoForTopic topicInfo = new SqlInfoForTopic(reader.GetString(0), reader.GetDateTime(1));
                        topicInfos.Add(topicInfo);
                    }
                },
                parameters);

            return (SqlInfoForTopic[])topicInfos.ToArray(typeof(SqlInfoForTopic));
        }
コード例 #8
0
ファイル: SqlHelper.cs プロジェクト: nuxleus/flexwikicore
        /// <summary>
        /// Get all the non archive topics in the specified namespace.
        /// </summary>
        /// <param name="ns">Namespace of the topic.</param>
        /// <param name="sort">Boolean value to indicate if the topics need to be sorted in the 
        /// descending order based on last write time.</param>
        /// <param name="connectionString">Database Connectionstring to use for this namespace.</param>
        /// <returns>Array of SqlTopicInfo containing the information for all non archive topics in the namespace.</returns>
        public SqlInfoForTopic[] GetSqlTopicInfoForNonArchiveTopics(string ns, bool sort)
        {
            ArrayList topicInfos = new ArrayList();

            DatabaseParameter[] parameters = new DatabaseParameter[1];
            parameters[0] = new DatabaseParameter("namespace", ns);

            string storedProcedureName = "GetSqlTopicInfoForNonArchiveTopics";
            if (sort)
            {
                // To benefit from Sql compiled stored procedure cache using 2 different
                // stored procedures instead of passing the sort value thru to Sql.
                storedProcedureName = "GetSqlTopicInfoForNonArchiveTopicsSortedDescending";
            }
            _database.ExecuteReader(CommandType.StoredProcedure,
                storedProcedureName,
                delegate(IDataReader reader)
                {
                    while (reader.Read())
                    {
                        SqlInfoForTopic topicInfo = new SqlInfoForTopic(reader.GetString(0), reader.GetDateTime(1));
                        topicInfos.Add(topicInfo);
                    }
                },
                parameters);

            return (SqlInfoForTopic[])topicInfos.ToArray(typeof(SqlInfoForTopic));
        }
コード例 #9
0
ファイル: SqlStore.cs プロジェクト: nuxleus/flexwiki
			public SqlInfoTopicData(SqlInfoForTopic info, string ns)
			{
				_Info = info;
				_Namespace = ns;
			}
コード例 #10
0
 public SqlInfoTopicData(SqlInfoForTopic info, string ns)
 {
     _info = info;
     _namespace = ns;
     _revision = new UnqualifiedTopicRevision(info.Name);
 }