mirror of
https://github.com/opensim/opensim.git
synced 2026-07-31 13:55:35 +08:00
a few more changes to Xinventory service
This commit is contained in:
@@ -29,6 +29,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using log4net;
|
||||
#if CSharpSqlite
|
||||
using Community.CsharpSqlite.Sqlite;
|
||||
@@ -122,7 +123,44 @@ namespace OpenSim.Data.SQLite
|
||||
|
||||
public virtual T[] Get(string field, string key)
|
||||
{
|
||||
return Get(new string[] { field }, new string[] { key });
|
||||
List<string> terms = new List<string>();
|
||||
|
||||
using (SqliteCommand cmd = new SqliteCommand())
|
||||
{
|
||||
cmd.Parameters.Add(new SqliteParameter(":" + field, key));
|
||||
string query = String.Format("select * from {0} where `{1}` = :{1}",m_Realm, field);
|
||||
|
||||
cmd.CommandText = query;
|
||||
|
||||
return DoQuery(cmd);
|
||||
}
|
||||
}
|
||||
|
||||
public virtual T[] Get(string field, string[] keys)
|
||||
{
|
||||
int flen = keys.Length;
|
||||
if(flen == 0)
|
||||
return new T[0];
|
||||
|
||||
int flast = flen - 1;
|
||||
StringBuilder sb = new StringBuilder(1024);
|
||||
sb.AppendFormat("select * from {0} where {1} IN('", m_Realm, field);
|
||||
|
||||
using (SqliteCommand cmd = new SqliteCommand())
|
||||
{
|
||||
for (int i = 0 ; i < flen ; i++)
|
||||
{
|
||||
sb.Append(keys[i]);
|
||||
if(i < flast)
|
||||
sb.Append("','");
|
||||
else
|
||||
sb.Append("')");
|
||||
}
|
||||
|
||||
cmd.CommandText = sb.ToString();
|
||||
|
||||
return DoQuery(cmd);
|
||||
}
|
||||
}
|
||||
|
||||
public virtual T[] Get(string[] fields, string[] keys)
|
||||
|
||||
Reference in New Issue
Block a user