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