();
+ private static Regex getInfoRegexByCaption(string caption) {
+ if(!regexInfoCache.ContainsKey(caption)) {
+ lock(caption) {
+ if(!regexInfoCache.ContainsKey(caption)) {
+ regexInfoCache[caption] = new Regex("]*>\\s*" + caption + "\\s* | \\s*\\s*([^<>]*)\\s* | ", RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.Multiline);
+ }
+ }
+ }
+ return regexInfoCache[caption];
+ }
+
+ private static Dictionary userImportStructure {
+ get {
+ return new Dictionary() {
+ { "regDate", "Дата\\s+регистрации" },
+ { "signature", "Подпись" },
+ { "title", "Титул" },
+ { "location", "Расположение" },
+ { "biography", "Биография" },
+ };
+ }
+ }
+
+ public static Dictionary getUserInfo(string userName) {
+ string content = getUserInfoAsString(userName);
+ return userImportStructure.ToDictionary, string, string>(
+ kvp => kvp.Key,
+ kvp => HttpUtility.HtmlDecode(getInfoRegexByCaption(kvp.Value).Match(content).Groups[1].Value).Trim()
+ );
+ }
+
+ public static IEnumerable getUserNames(int pageNum) {
+ string content = ShallerConnector.getPageContent("showmembers.php?Cat=&sb=13&page=" + pageNum + "&showlite=l", new Dictionary(), new System.Net.CookieContainer());
+ Regex matcher = new Regex(";User=([^&]+)&", RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.IgnoreCase);
+ MatchCollection matches = matcher.Matches(content);
+ HashSet result = new HashSet();
+ foreach(Match match in matches) {
+ result.Add(match.Groups[1].Value);
+ }
+ return result;
+ }
+
}
}
diff --git a/MySQLConnector/PostgresDBTraits.cs b/MySQLConnector/PostgresDBTraits.cs
index 067aef1..33400df 100644
--- a/MySQLConnector/PostgresDBTraits.cs
+++ b/MySQLConnector/PostgresDBTraits.cs
@@ -22,7 +22,7 @@ namespace FLocal.MySQLConnector {
newCommand.Transaction = command.Transaction;
}
newCommand.CommandType = System.Data.CommandType.Text;
- newCommand.CommandText = "SELECT CURRVAL(" + this.escapeIdentifier(sequenceName) + ")";
+ newCommand.CommandText = "SELECT CURRVAL('" + this.escapeIdentifier(sequenceName) + "')";
return (long)newCommand.ExecuteScalar();
}
}