예제 #1
0
		/// <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
		/// <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));
		}
예제 #3
0
		/// <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));
		}
예제 #4
0
		/// <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));
		}
예제 #5
0
			public SqlInfoTopicData(SqlInfoForTopic info, string ns)
			{
				_Info = info;
				_Namespace = ns;
			}