diff options
author | Justin Clark-Casey | 2014-05-27 23:29:54 +0100 |
---|---|---|
committer | Justin Clark-Casey | 2014-05-27 23:29:54 +0100 |
commit | 3f703ae1cb02cbcb0efaff061d495bacca941de0 (patch) | |
tree | 3221068b4bc4119023b3dfa621c19e126c2eb3f3 /OpenSim/Data | |
parent | Merge branch 'master' into 0.8-post-fixes (diff) | |
parent | minor: Comment out 2 error level debugging message in authentication code (diff) | |
download | opensim-SC_OLD-3f703ae1cb02cbcb0efaff061d495bacca941de0.zip opensim-SC_OLD-3f703ae1cb02cbcb0efaff061d495bacca941de0.tar.gz opensim-SC_OLD-3f703ae1cb02cbcb0efaff061d495bacca941de0.tar.bz2 opensim-SC_OLD-3f703ae1cb02cbcb0efaff061d495bacca941de0.tar.xz |
Merge branch 'master' into 0.8-post-fixes
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Data/MySQL/MySQLGroupsData.cs | 2 | ||||
-rw-r--r-- | OpenSim/Data/PGSQL/PGSQLGenericTableHandler.cs | 18 | ||||
-rw-r--r-- | OpenSim/Data/PGSQL/PGSQLGroupsData.cs | 10 |
3 files changed, 26 insertions, 4 deletions
diff --git a/OpenSim/Data/MySQL/MySQLGroupsData.cs b/OpenSim/Data/MySQL/MySQLGroupsData.cs index 8e39229..afa499e 100644 --- a/OpenSim/Data/MySQL/MySQLGroupsData.cs +++ b/OpenSim/Data/MySQL/MySQLGroupsData.cs | |||
@@ -88,7 +88,7 @@ namespace OpenSim.Data.MySQL | |||
88 | if (string.IsNullOrEmpty(pattern)) | 88 | if (string.IsNullOrEmpty(pattern)) |
89 | pattern = "1"; | 89 | pattern = "1"; |
90 | else | 90 | else |
91 | pattern = string.Format("Name LIKE '%{0}%'", pattern); | 91 | pattern = string.Format("Name LIKE '%{0}%'", MySqlHelper.EscapeString(pattern)); |
92 | 92 | ||
93 | return m_Groups.Get(string.Format("ShowInList=1 AND ({0}) ORDER BY Name LIMIT 100", pattern)); | 93 | return m_Groups.Get(string.Format("ShowInList=1 AND ({0}) ORDER BY Name LIMIT 100", pattern)); |
94 | } | 94 | } |
diff --git a/OpenSim/Data/PGSQL/PGSQLGenericTableHandler.cs b/OpenSim/Data/PGSQL/PGSQLGenericTableHandler.cs index 2151568..826c6fc 100644 --- a/OpenSim/Data/PGSQL/PGSQLGenericTableHandler.cs +++ b/OpenSim/Data/PGSQL/PGSQLGenericTableHandler.cs | |||
@@ -300,9 +300,27 @@ namespace OpenSim.Data.PGSQL | |||
300 | m_Realm, where); | 300 | m_Realm, where); |
301 | cmd.Connection = conn; | 301 | cmd.Connection = conn; |
302 | cmd.CommandText = query; | 302 | cmd.CommandText = query; |
303 | //m_log.WarnFormat("[PGSQLGenericTable]: SELECT {0} WHERE {1}", m_Realm, where); | ||
304 | |||
305 | conn.Open(); | ||
306 | return DoQuery(cmd); | ||
307 | } | ||
308 | } | ||
303 | 309 | ||
310 | public virtual T[] Get(string where, NpgsqlParameter parameter) | ||
311 | { | ||
312 | using (NpgsqlConnection conn = new NpgsqlConnection(m_ConnectionString)) | ||
313 | using (NpgsqlCommand cmd = new NpgsqlCommand()) | ||
314 | { | ||
315 | |||
316 | string query = String.Format("SELECT * FROM {0} WHERE {1}", | ||
317 | m_Realm, where); | ||
318 | cmd.Connection = conn; | ||
319 | cmd.CommandText = query; | ||
304 | //m_log.WarnFormat("[PGSQLGenericTable]: SELECT {0} WHERE {1}", m_Realm, where); | 320 | //m_log.WarnFormat("[PGSQLGenericTable]: SELECT {0} WHERE {1}", m_Realm, where); |
305 | 321 | ||
322 | cmd.Parameters.Add(parameter); | ||
323 | |||
306 | conn.Open(); | 324 | conn.Open(); |
307 | return DoQuery(cmd); | 325 | return DoQuery(cmd); |
308 | } | 326 | } |
diff --git a/OpenSim/Data/PGSQL/PGSQLGroupsData.cs b/OpenSim/Data/PGSQL/PGSQLGroupsData.cs index ed75b63..669e3c8 100644 --- a/OpenSim/Data/PGSQL/PGSQLGroupsData.cs +++ b/OpenSim/Data/PGSQL/PGSQLGroupsData.cs | |||
@@ -83,11 +83,15 @@ namespace OpenSim.Data.PGSQL | |||
83 | public GroupData[] RetrieveGroups(string pattern) | 83 | public GroupData[] RetrieveGroups(string pattern) |
84 | { | 84 | { |
85 | if (string.IsNullOrEmpty(pattern)) // True for where clause | 85 | if (string.IsNullOrEmpty(pattern)) // True for where clause |
86 | { | ||
86 | pattern = " true ORDER BY lower(\"Name\") LIMIT 100"; | 87 | pattern = " true ORDER BY lower(\"Name\") LIMIT 100"; |
88 | return m_Groups.Get(pattern); | ||
89 | } | ||
87 | else | 90 | else |
88 | pattern = string.Format(" lower(\"Name\") LIKE lower('%{0}%') ORDER BY lower(\"Name\") LIMIT 100", pattern); | 91 | { |
89 | 92 | pattern = " lower(\"Name\") LIKE lower('%:pattern%') ORDER BY lower(\"Name\") LIMIT 100"; | |
90 | return m_Groups.Get(pattern); | 93 | return m_Groups.Get(pattern, new NpgsqlParameter("pattern", pattern)); |
94 | } | ||
91 | } | 95 | } |
92 | 96 | ||
93 | public bool DeleteGroup(UUID groupID) | 97 | public bool DeleteGroup(UUID groupID) |