Compare commits
No commits in common. "e445c2bda1f2fe6f23c82696771de0b66e04c181" and "63330d5fc03bef0fdfdf3fb12baf74e84359eba5" have entirely different histories.
e445c2bda1
...
63330d5fc0
31
DBchat.cs
31
DBchat.cs
@ -14,9 +14,8 @@ namespace NeDvachAPI
|
|||||||
public static Post[] DbList()
|
public static Post[] DbList()
|
||||||
{
|
{
|
||||||
// Build connection string using parameters from portal
|
// Build connection string using parameters from portal
|
||||||
//Post[] posts = new Post[10];
|
Post[] posts = new Post[10];
|
||||||
List<Post> posts = new List<Post>();
|
int postCount = 0;
|
||||||
//int postCount = 0;
|
|
||||||
string received = "";
|
string received = "";
|
||||||
string connString =
|
string connString =
|
||||||
String.Format(
|
String.Format(
|
||||||
@ -34,22 +33,13 @@ namespace NeDvachAPI
|
|||||||
conn.Open();
|
conn.Open();
|
||||||
|
|
||||||
|
|
||||||
// using ( var command = new NpgsqlCommand(@"
|
using (var command = new NpgsqlCommand(@"
|
||||||
// SELECT * FROM
|
|
||||||
// (SELECT post_id, substring(post,1,200)
|
|
||||||
// FROM dvach
|
|
||||||
// ORDER BY post_id DESC
|
|
||||||
// limit 10
|
|
||||||
// )
|
|
||||||
subquery ORDER BY post_id ASC", conn) )
|
|
||||||
using ( var command = new NpgsqlCommand(@"
|
|
||||||
SELECT * FROM
|
SELECT * FROM
|
||||||
(
|
(SELECT post_id, substring(post,1,200)
|
||||||
SELECT post_id, post
|
FROM dvach
|
||||||
FROM dvach
|
ORDER BY post_id
|
||||||
ORDER BY post_id DESC
|
DESC limit 10)
|
||||||
) subquery
|
subquery ORDER BY post_id ASC", conn))
|
||||||
ORDER BY post_id ASC", conn) )
|
|
||||||
{
|
{
|
||||||
|
|
||||||
var reader = command.ExecuteReader();
|
var reader = command.ExecuteReader();
|
||||||
@ -68,9 +58,8 @@ namespace NeDvachAPI
|
|||||||
Id = reader.GetInt32(0),
|
Id = reader.GetInt32(0),
|
||||||
Text = reader.GetString(1)
|
Text = reader.GetString(1)
|
||||||
};
|
};
|
||||||
posts.Add(receivedPost);
|
posts[postCount] = receivedPost;
|
||||||
//posts[postCount] = receivedPost;
|
postCount++;
|
||||||
//postCount++;
|
|
||||||
}
|
}
|
||||||
reader.Close();
|
reader.Close();
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user