|
|
|
@ -4,6 +4,8 @@ using System.Configuration.Provider;
|
|
|
|
using Npgsql;
|
|
|
|
using Npgsql;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using Yavsc.Model.Blogs;
|
|
|
|
using Yavsc.Model.Blogs;
|
|
|
|
|
|
|
|
using Yavsc.Model.Circles;
|
|
|
|
|
|
|
|
using System.Web.Mvc;
|
|
|
|
|
|
|
|
|
|
|
|
namespace Npgsql.Web.Blog
|
|
|
|
namespace Npgsql.Web.Blog
|
|
|
|
{
|
|
|
|
{
|
|
|
|
@ -28,6 +30,7 @@ namespace Npgsql.Web.Blog
|
|
|
|
cmd.CommandText = "insert into bltag (blid,tag) values (@postid,@tag) returning _id";
|
|
|
|
cmd.CommandText = "insert into bltag (blid,tag) values (@postid,@tag) returning _id";
|
|
|
|
cmd.Parameters.AddWithValue("@tag",tag);
|
|
|
|
cmd.Parameters.AddWithValue("@tag",tag);
|
|
|
|
cmd.Parameters.AddWithValue("@postid",postid);
|
|
|
|
cmd.Parameters.AddWithValue("@postid",postid);
|
|
|
|
|
|
|
|
cnx.Open ();
|
|
|
|
return (long) cmd.ExecuteScalar ();
|
|
|
|
return (long) cmd.ExecuteScalar ();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -41,20 +44,11 @@ namespace Npgsql.Web.Blog
|
|
|
|
using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
|
|
|
|
using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
|
|
|
|
cmd.CommandText = "delete from bltag where _id = @tagid";
|
|
|
|
cmd.CommandText = "delete from bltag where _id = @tagid";
|
|
|
|
cmd.Parameters.AddWithValue("@tagid",tagid);
|
|
|
|
cmd.Parameters.AddWithValue("@tagid",tagid);
|
|
|
|
|
|
|
|
cnx.Open ();
|
|
|
|
cmd.ExecuteNonQuery ();
|
|
|
|
cmd.ExecuteNonQuery ();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
|
/// Gets the post identifier.
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
|
|
/// <returns>The post identifier.</returns>
|
|
|
|
|
|
|
|
/// <param name="username">Username.</param>
|
|
|
|
|
|
|
|
/// <param name="title">Title.</param>
|
|
|
|
|
|
|
|
public override long GetPostId (string username, string title)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
throw new NotImplementedException ();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// Gets the comments.
|
|
|
|
/// Gets the comments.
|
|
|
|
/// </summary>
|
|
|
|
/// </summary>
|
|
|
|
/// <returns>The comments.</returns>
|
|
|
|
/// <returns>The comments.</returns>
|
|
|
|
@ -97,9 +91,11 @@ namespace Npgsql.Web.Blog
|
|
|
|
/// <param name="title">Title.</param>
|
|
|
|
/// <param name="title">Title.</param>
|
|
|
|
/// <param name="content">Content.</param>
|
|
|
|
/// <param name="content">Content.</param>
|
|
|
|
/// <param name="visible">If set to <c>true</c> visible.</param>
|
|
|
|
/// <param name="visible">If set to <c>true</c> visible.</param>
|
|
|
|
public override void UpdatePost (long postid, string title, string content, bool visible)
|
|
|
|
/// <param name="cids">Circle identifiers</param>
|
|
|
|
|
|
|
|
public override void UpdatePost (long postid, string title, string content,
|
|
|
|
|
|
|
|
bool visible, long [] cids)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
using (NpgsqlConnection cnx = new NpgsqlConnection(connectionString))
|
|
|
|
using (NpgsqlConnection cnx = new NpgsqlConnection(connectionString)) {
|
|
|
|
using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
|
|
|
|
using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
|
|
|
|
DateTime now = DateTime.Now;
|
|
|
|
DateTime now = DateTime.Now;
|
|
|
|
cmd.CommandText =
|
|
|
|
cmd.CommandText =
|
|
|
|
@ -115,8 +111,10 @@ namespace Npgsql.Web.Blog
|
|
|
|
cmd.Parameters.AddWithValue ("@id", postid);
|
|
|
|
cmd.Parameters.AddWithValue ("@id", postid);
|
|
|
|
cnx.Open ();
|
|
|
|
cnx.Open ();
|
|
|
|
cmd.ExecuteNonQuery ();
|
|
|
|
cmd.ExecuteNonQuery ();
|
|
|
|
|
|
|
|
}
|
|
|
|
cnx.Close();
|
|
|
|
cnx.Close();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
UpdatePostCircles (postid, cids);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
|
/// Removes the post.
|
|
|
|
/// Removes the post.
|
|
|
|
@ -249,6 +247,7 @@ namespace Npgsql.Web.Blog
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (be!=null) SetCirclesOn (be);
|
|
|
|
return be;
|
|
|
|
return be;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
|
@ -280,10 +279,10 @@ namespace Npgsql.Web.Blog
|
|
|
|
using (NpgsqlConnection cnx=new NpgsqlConnection(connectionString))
|
|
|
|
using (NpgsqlConnection cnx=new NpgsqlConnection(connectionString))
|
|
|
|
using (NpgsqlCommand cmd = cnx.CreateCommand()) {
|
|
|
|
using (NpgsqlCommand cmd = cnx.CreateCommand()) {
|
|
|
|
cmd.CommandText = "select _id,bcontent,modified,posted,visible from blog " +
|
|
|
|
cmd.CommandText = "select _id,bcontent,modified,posted,visible from blog " +
|
|
|
|
"where applicationname = @appname and username = @username and title = @title";
|
|
|
|
"where applicationname = :appname and username = :username and title = :title";
|
|
|
|
cmd.Parameters.AddWithValue ("@appname", applicationName);
|
|
|
|
cmd.Parameters.AddWithValue ("appname", applicationName);
|
|
|
|
cmd.Parameters.AddWithValue ("@username", username);
|
|
|
|
cmd.Parameters.AddWithValue ("username", username);
|
|
|
|
cmd.Parameters.AddWithValue ("@title", title);
|
|
|
|
cmd.Parameters.AddWithValue ("title", title);
|
|
|
|
cnx.Open ();
|
|
|
|
cnx.Open ();
|
|
|
|
using (NpgsqlDataReader rdr = cmd.ExecuteReader()) {
|
|
|
|
using (NpgsqlDataReader rdr = cmd.ExecuteReader()) {
|
|
|
|
if (rdr.Read ()) {
|
|
|
|
if (rdr.Read ()) {
|
|
|
|
@ -298,11 +297,11 @@ namespace Npgsql.Web.Blog
|
|
|
|
}
|
|
|
|
}
|
|
|
|
rdr.Close ();
|
|
|
|
rdr.Close ();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (be!=null)
|
|
|
|
if (be != null) {
|
|
|
|
using (NpgsqlCommand cmdtags = cnx.CreateCommand ()) {
|
|
|
|
using (NpgsqlCommand cmdtags = cnx.CreateCommand ()) {
|
|
|
|
List<string> tags = new List<string> ();
|
|
|
|
List<string> tags = new List<string> ();
|
|
|
|
cmd.CommandText = "select tag.name from tag,tagged where tag._id = tagged.tagid and tagged.postid = @pid";
|
|
|
|
cmd.CommandText = "select tag.name from tag,tagged where tag._id = tagged.tagid and tagged.postid = :pid";
|
|
|
|
cmd.Parameters.AddWithValue ("@pid", be.Id);
|
|
|
|
cmd.Parameters.AddWithValue ("pid", be.Id);
|
|
|
|
using (NpgsqlDataReader rdrt = cmd.ExecuteReader ()) {
|
|
|
|
using (NpgsqlDataReader rdrt = cmd.ExecuteReader ()) {
|
|
|
|
while (rdrt.Read ()) {
|
|
|
|
while (rdrt.Read ()) {
|
|
|
|
tags.Add (rdrt.GetString (0));
|
|
|
|
tags.Add (rdrt.GetString (0));
|
|
|
|
@ -310,9 +309,29 @@ namespace Npgsql.Web.Blog
|
|
|
|
}
|
|
|
|
}
|
|
|
|
be.Tags = tags.ToArray ();
|
|
|
|
be.Tags = tags.ToArray ();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
SetCirclesOn (be);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return be;
|
|
|
|
return be;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void SetCirclesOn(BlogEntry be)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
List<long> circles = new List<long> ();
|
|
|
|
|
|
|
|
using (NpgsqlConnection cnx=new NpgsqlConnection(connectionString))
|
|
|
|
|
|
|
|
using (NpgsqlCommand cmdcircles = cnx.CreateCommand ()) {
|
|
|
|
|
|
|
|
cmdcircles.CommandText = "select a.circle_id from blog_access a " +
|
|
|
|
|
|
|
|
"where a.post_id = :pid";
|
|
|
|
|
|
|
|
cmdcircles.Parameters.AddWithValue ("pid", be.Id);
|
|
|
|
|
|
|
|
cnx.Open ();
|
|
|
|
|
|
|
|
using (NpgsqlDataReader rdr = cmdcircles.ExecuteReader ()) {
|
|
|
|
|
|
|
|
while (rdr.Read ()) {
|
|
|
|
|
|
|
|
circles.Add ( rdr.GetInt64 (0) );
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
be.AllowedCircles = circles.ToArray();
|
|
|
|
|
|
|
|
}
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
|
/// Post the specified username, title, content and visible.
|
|
|
|
/// Post the specified username, title, content and visible.
|
|
|
|
/// </summary>
|
|
|
|
/// </summary>
|
|
|
|
@ -320,59 +339,112 @@ namespace Npgsql.Web.Blog
|
|
|
|
/// <param name="title">Title.</param>
|
|
|
|
/// <param name="title">Title.</param>
|
|
|
|
/// <param name="content">Content.</param>
|
|
|
|
/// <param name="content">Content.</param>
|
|
|
|
/// <param name="visible">If set to <c>true</c> visible.</param>
|
|
|
|
/// <param name="visible">If set to <c>true</c> visible.</param>
|
|
|
|
public override long Post (string username, string title, string content, bool visible)
|
|
|
|
/// <param name="circles">.</param>
|
|
|
|
|
|
|
|
public override long Post (string username, string title, string content, bool visible, long [] circles)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
long pid = 0;
|
|
|
|
if (username == null)
|
|
|
|
if (username == null)
|
|
|
|
throw new ArgumentNullException("username");
|
|
|
|
throw new ArgumentNullException("username");
|
|
|
|
if (title == null)
|
|
|
|
if (title == null)
|
|
|
|
throw new ArgumentNullException("title");
|
|
|
|
throw new ArgumentNullException("title");
|
|
|
|
if (content == null)
|
|
|
|
if (content == null)
|
|
|
|
throw new ArgumentNullException("content");
|
|
|
|
throw new ArgumentNullException("content");
|
|
|
|
using (NpgsqlConnection cnx=new NpgsqlConnection(connectionString))
|
|
|
|
using (NpgsqlConnection cnx = new NpgsqlConnection (connectionString)) {
|
|
|
|
using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
|
|
|
|
using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
|
|
|
|
cmd.CommandText = "insert into blog (title,bcontent,modified,posted,visible,username,applicationname)" +
|
|
|
|
cmd.CommandText = "insert into blog (title,bcontent,modified,posted,visible,username,applicationname)" +
|
|
|
|
"values (@title,@bcontent,@modified,@posted,@visible,@username,@appname) returning _id";
|
|
|
|
"values (:title,:bcontent,:modified,:posted,:visible,:username,:appname) returning _id";
|
|
|
|
cmd.Parameters.AddWithValue ("@title", title);
|
|
|
|
cmd.Parameters.AddWithValue ("title", title);
|
|
|
|
cmd.Parameters.AddWithValue ("@bcontent", content);
|
|
|
|
cmd.Parameters.AddWithValue ("bcontent", content);
|
|
|
|
DateTime now = DateTime.Now;
|
|
|
|
DateTime now = DateTime.Now;
|
|
|
|
cmd.Parameters.AddWithValue ("@modified", now);
|
|
|
|
cmd.Parameters.AddWithValue ("modified", now);
|
|
|
|
cmd.Parameters.AddWithValue ("@posted", now);
|
|
|
|
cmd.Parameters.AddWithValue ("posted", now);
|
|
|
|
cmd.Parameters.AddWithValue ("@visible", visible);
|
|
|
|
cmd.Parameters.AddWithValue ("visible", visible);
|
|
|
|
cmd.Parameters.AddWithValue ("@username", username);
|
|
|
|
cmd.Parameters.AddWithValue ("username", username);
|
|
|
|
cmd.Parameters.AddWithValue ("@appname", applicationName);
|
|
|
|
cmd.Parameters.AddWithValue ("appname", applicationName);
|
|
|
|
cnx.Open ();
|
|
|
|
cnx.Open ();
|
|
|
|
return (long) cmd.ExecuteScalar();
|
|
|
|
pid = (long)cmd.ExecuteScalar ();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
cnx.Close ();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
UpdatePostCircles (pid, circles);
|
|
|
|
|
|
|
|
return pid;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void UpdatePostCircles( long pid, long[] circles)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
using (NpgsqlConnection cnx = new NpgsqlConnection (connectionString)) {
|
|
|
|
|
|
|
|
cnx.Open ();
|
|
|
|
|
|
|
|
using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
|
|
|
|
|
|
|
|
cmd.CommandText = "delete from blog_access where post_id = :pid";
|
|
|
|
|
|
|
|
cmd.Parameters.AddWithValue ("pid", pid);
|
|
|
|
|
|
|
|
cmd.ExecuteNonQuery ();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (circles!=null)
|
|
|
|
|
|
|
|
if (circles.Length>0)
|
|
|
|
|
|
|
|
using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
|
|
|
|
|
|
|
|
cmd.CommandText = "insert into blog_access (post_id,circle_id) values (:pid,:cid)";
|
|
|
|
|
|
|
|
cmd.Parameters.AddWithValue ("pid", pid);
|
|
|
|
|
|
|
|
cmd.Parameters.Add ("cid", NpgsqlTypes.NpgsqlDbType.Bigint);
|
|
|
|
|
|
|
|
cmd.Prepare ();
|
|
|
|
|
|
|
|
foreach (long ci in circles) {
|
|
|
|
|
|
|
|
cmd.Parameters ["cid"].Value = ci;
|
|
|
|
|
|
|
|
cmd.ExecuteNonQuery ();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
cnx.Close ();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
|
/// Finds the post.
|
|
|
|
/// Finds the post.
|
|
|
|
/// </summary>
|
|
|
|
/// </summary>
|
|
|
|
/// <returns>The post.</returns>
|
|
|
|
/// <returns>The post.</returns>
|
|
|
|
|
|
|
|
/// <param name="readersName">Reader's Name.</param>
|
|
|
|
/// <param name="pattern">Pattern.</param>
|
|
|
|
/// <param name="pattern">Pattern.</param>
|
|
|
|
/// <param name="searchflags">Searchflags.</param>
|
|
|
|
/// <param name="searchflags">Searchflags.</param>
|
|
|
|
/// <param name="pageIndex">Page index.</param>
|
|
|
|
/// <param name="pageIndex">Page index.</param>
|
|
|
|
/// <param name="pageSize">Page size.</param>
|
|
|
|
/// <param name="pageSize">Page size.</param>
|
|
|
|
/// <param name="totalRecords">Total records.</param>
|
|
|
|
/// <param name="totalRecords">Total records.</param>
|
|
|
|
public override BlogEntryCollection FindPost (string pattern, FindBlogEntryFlags searchflags, int pageIndex, int pageSize, out int totalRecords)
|
|
|
|
public override BlogEntryCollection FindPost (string readersName, string pattern, FindBlogEntryFlags searchflags, int pageIndex, int pageSize, out int totalRecords)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
BlogEntryCollection c = new BlogEntryCollection ();
|
|
|
|
BlogEntryCollection c = new BlogEntryCollection ();
|
|
|
|
totalRecords = 0;
|
|
|
|
totalRecords = 0;
|
|
|
|
using (NpgsqlConnection cnx=new NpgsqlConnection(connectionString))
|
|
|
|
using (NpgsqlConnection cnx=new NpgsqlConnection(connectionString))
|
|
|
|
using (NpgsqlCommand cmd = cnx.CreateCommand()) {
|
|
|
|
using (NpgsqlCommand cmd = cnx.CreateCommand()) {
|
|
|
|
cmd.CommandText = "select title,bcontent,modified,posted,username,visible from blog " +
|
|
|
|
if (readersName != null) {
|
|
|
|
"where applicationname = @appname";
|
|
|
|
cmd.CommandText = "select _id, title,bcontent,modified," +
|
|
|
|
|
|
|
|
"posted,username,visible " +
|
|
|
|
|
|
|
|
"from blog b left outer join " +
|
|
|
|
|
|
|
|
"(select count(*)>0 acc, a.post_id pid " +
|
|
|
|
|
|
|
|
"from blog_access a," +
|
|
|
|
|
|
|
|
" circle_members m, users u where m.circle_id = a.circle_id " +
|
|
|
|
|
|
|
|
" and m.member = u.pkid and u.username = :uname " +
|
|
|
|
|
|
|
|
" and u.applicationname = :appname " +
|
|
|
|
|
|
|
|
" group by a.post_id) ma on (ma.pid = b._id) " +
|
|
|
|
|
|
|
|
"where ( ma.acc IS NULL or ma.acc = TRUE or b.UserName = :uname) ";
|
|
|
|
|
|
|
|
cmd.Parameters.AddWithValue ("uname", readersName);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
cmd.CommandText = "select _id, title,bcontent,modified," +
|
|
|
|
|
|
|
|
"posted,username,visible " +
|
|
|
|
|
|
|
|
"from blog b left outer join " +
|
|
|
|
|
|
|
|
"(select count(*)>0 acc, a.post_id pid " +
|
|
|
|
|
|
|
|
"from blog_access a" +
|
|
|
|
|
|
|
|
" group by a.post_id) ma on (ma.pid = b._id)" +
|
|
|
|
|
|
|
|
" where " +
|
|
|
|
|
|
|
|
" ma.acc IS NULL and " +
|
|
|
|
|
|
|
|
" applicationname = :appname";
|
|
|
|
|
|
|
|
}
|
|
|
|
cmd.Parameters.AddWithValue ("@appname", applicationName);
|
|
|
|
cmd.Parameters.AddWithValue ("@appname", applicationName);
|
|
|
|
if ((searchflags & FindBlogEntryFlags.MatchContent) > 0) {
|
|
|
|
if ((searchflags & FindBlogEntryFlags.MatchContent) > 0) {
|
|
|
|
cmd.CommandText += " and bcontent like @bcontent";
|
|
|
|
cmd.CommandText += " and bcontent like :bcontent";
|
|
|
|
cmd.Parameters.AddWithValue ("@bcontent", pattern);
|
|
|
|
cmd.Parameters.AddWithValue (":bcontent", pattern);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if ((searchflags & FindBlogEntryFlags.MatchTitle) > 0) {
|
|
|
|
if ((searchflags & FindBlogEntryFlags.MatchTitle) > 0) {
|
|
|
|
cmd.CommandText += " and title like @title";
|
|
|
|
cmd.CommandText += " and title like :title";
|
|
|
|
cmd.Parameters.AddWithValue ("@title", pattern);
|
|
|
|
cmd.Parameters.AddWithValue (":title", pattern);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if ((searchflags & FindBlogEntryFlags.MatchUserName) > 0) {
|
|
|
|
if ((searchflags & FindBlogEntryFlags.MatchUserName) > 0) {
|
|
|
|
cmd.CommandText += " and username like @username";
|
|
|
|
cmd.CommandText += " and username like :username";
|
|
|
|
cmd.Parameters.AddWithValue ("@username", pattern);
|
|
|
|
cmd.Parameters.AddWithValue (":username", pattern);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if ((searchflags & FindBlogEntryFlags.MatchInvisible) == 0) {
|
|
|
|
if ((searchflags & FindBlogEntryFlags.MatchInvisible) == 0) {
|
|
|
|
cmd.CommandText += " and visible = true";
|
|
|
|
cmd.CommandText += " and visible = true";
|
|
|
|
@ -397,8 +469,12 @@ namespace Npgsql.Web.Blog
|
|
|
|
}
|
|
|
|
}
|
|
|
|
totalRecords++;
|
|
|
|
totalRecords++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
rdr.Close ();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
foreach (BlogEntry be in c)
|
|
|
|
|
|
|
|
SetCirclesOn (be);
|
|
|
|
|
|
|
|
|
|
|
|
return c;
|
|
|
|
return c;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
|
@ -442,11 +518,11 @@ namespace Npgsql.Web.Blog
|
|
|
|
"where blog.posted = lblog.lpost and blog.username = lblog.username " ;
|
|
|
|
"where blog.posted = lblog.lpost and blog.username = lblog.username " ;
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
cmd.CommandText = "select * " +
|
|
|
|
cmd.CommandText = "select * " +
|
|
|
|
"from blog where applicationname = @appname and visible = true " +
|
|
|
|
"from blog where applicationname = :appname and visible = true " +
|
|
|
|
" order by posted desc limit @len" ;
|
|
|
|
" order by posted desc limit :len" ;
|
|
|
|
|
|
|
|
|
|
|
|
cmd.Parameters.AddWithValue ("@appname", applicationName);
|
|
|
|
cmd.Parameters.AddWithValue ("appname", applicationName);
|
|
|
|
cmd.Parameters.AddWithValue ("@len", defaultPageSize*10);
|
|
|
|
cmd.Parameters.AddWithValue ("len", defaultPageSize*10);
|
|
|
|
cnx.Open ();
|
|
|
|
cnx.Open ();
|
|
|
|
using (NpgsqlDataReader rdr = cmd.ExecuteReader()) {
|
|
|
|
using (NpgsqlDataReader rdr = cmd.ExecuteReader()) {
|
|
|
|
totalRecords = 0;
|
|
|
|
totalRecords = 0;
|
|
|
|
@ -467,6 +543,8 @@ namespace Npgsql.Web.Blog
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
foreach (BlogEntry be in c)
|
|
|
|
|
|
|
|
SetCirclesOn (be);
|
|
|
|
return c;
|
|
|
|
return c;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endregion
|
|
|
|
#endregion
|
|
|
|
|