* Yet more inventory shelling

* Very initial MySQL work done
* Refactored some of the MySQL code - functions which are passed a reader are no longer getX() but now readX().
zircon^2
Adam Frisby 2007-05-31 14:05:19 +00:00
parent c955e2fe9b
commit a0305888bc
5 changed files with 76 additions and 24 deletions

View File

@ -62,7 +62,7 @@ namespace OpenGrid.Framework.Data.MySQL
List<SimProfileData> rows = new List<SimProfileData>(); List<SimProfileData> rows = new List<SimProfileData>();
while ((row = database.getSimRow(reader)) != null) while ((row = database.readSimRow(reader)) != null)
{ {
rows.Add(row); rows.Add(row);
} }
@ -98,7 +98,7 @@ namespace OpenGrid.Framework.Data.MySQL
System.Data.IDbCommand result = database.Query("SELECT * FROM regions WHERE regionHandle = ?handle", param); System.Data.IDbCommand result = database.Query("SELECT * FROM regions WHERE regionHandle = ?handle", param);
System.Data.IDataReader reader = result.ExecuteReader(); System.Data.IDataReader reader = result.ExecuteReader();
SimProfileData row = database.getSimRow(reader); SimProfileData row = database.readSimRow(reader);
reader.Close(); reader.Close();
result.Dispose(); result.Dispose();
@ -130,7 +130,7 @@ namespace OpenGrid.Framework.Data.MySQL
System.Data.IDbCommand result = database.Query("SELECT * FROM regions WHERE uuid = ?uuid", param); System.Data.IDbCommand result = database.Query("SELECT * FROM regions WHERE uuid = ?uuid", param);
System.Data.IDataReader reader = result.ExecuteReader(); System.Data.IDataReader reader = result.ExecuteReader();
SimProfileData row = database.getSimRow(reader); SimProfileData row = database.readSimRow(reader);
reader.Close(); reader.Close();
result.Dispose(); result.Dispose();

View File

@ -1,10 +1,11 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
using libsecondlife;
namespace OpenGrid.Framework.Data.MySQL namespace OpenGrid.Framework.Data.MySQL
{ {
class MySQLInventoryData class MySQLInventoryData : IInventoryData
{ {
public MySQLManager database; public MySQLManager database;
@ -23,7 +24,7 @@ namespace OpenGrid.Framework.Data.MySQL
public string getName() public string getName()
{ {
return "MySQL Logdata Interface"; return "MySQL Inventory Data Interface";
} }
public void Close() public void Close()
@ -35,5 +36,30 @@ namespace OpenGrid.Framework.Data.MySQL
{ {
return "0.1"; return "0.1";
} }
public List<InventoryItemBase> getInventoryInFolder(LLUUID folderID)
{
return null;
}
public List<InventoryFolderBase> getUserRootFolders(LLUUID user)
{
return null;
}
public List<InventoryFolderBase> getInventoryFolders(LLUUID parentID)
{
return null;
}
public InventoryItemBase getInventoryItem(LLUUID item)
{
return null;
}
public InventoryFolderBase getInventoryFolder(LLUUID folder)
{
return null;
}
} }
} }

View File

@ -137,7 +137,7 @@ namespace OpenGrid.Framework.Data.MySQL
} }
} }
public SimProfileData getSimRow(IDataReader reader) public SimProfileData readSimRow(IDataReader reader)
{ {
SimProfileData retval = new SimProfileData(); SimProfileData retval = new SimProfileData();
@ -199,7 +199,7 @@ namespace OpenGrid.Framework.Data.MySQL
return retval; return retval;
} }
public UserAgentData getAgentRow(IDataReader reader) public UserAgentData readAgentRow(IDataReader reader)
{ {
UserAgentData retval = new UserAgentData(); UserAgentData retval = new UserAgentData();
@ -231,7 +231,7 @@ namespace OpenGrid.Framework.Data.MySQL
return retval; return retval;
} }
public UserProfileData getUserRow(IDataReader reader) public UserProfileData readUserRow(IDataReader reader)
{ {
UserProfileData retval = new UserProfileData(); UserProfileData retval = new UserProfileData();
@ -277,6 +277,32 @@ namespace OpenGrid.Framework.Data.MySQL
return retval; return retval;
} }
public List<InventoryFolderBase> readInventoryInFolder(IDataReader reader)
{
List<InventoryFolderBase> rows = new List<InventoryFolderBase>();
while(reader.Read())
{
try
{
InventoryFolderBase retval = new InventoryFolderBase();
retval.agentID = new libsecondlife.LLUUID((string)reader["agentID"]);
retval.parentID = new libsecondlife.LLUUID((string)reader["parentFolderID"]);
retval.folderID = new libsecondlife.LLUUID((string)reader["folderID"]);
retval.name = (string)reader["folderName"];
rows.Add(retval);
}
catch (Exception e)
{
Console.WriteLine(e.ToString());
}
}
return rows;
}
public bool insertLogRow(string serverDaemon, string target, string methodCall, string arguments, int priority, string logMessage) public bool insertLogRow(string serverDaemon, string target, string methodCall, string arguments, int priority, string logMessage)
{ {
string sql = "INSERT INTO logs (`target`, `server`, `method`, `arguments`, `priority`, `message`) VALUES "; string sql = "INSERT INTO logs (`target`, `server`, `method`, `arguments`, `priority`, `message`) VALUES ";

View File

@ -41,7 +41,7 @@ namespace OpenGrid.Framework.Data.MySQL
System.Data.IDbCommand result = database.Query("SELECT * FROM users WHERE username = ?first AND lastname = ?second", param); System.Data.IDbCommand result = database.Query("SELECT * FROM users WHERE username = ?first AND lastname = ?second", param);
System.Data.IDataReader reader = result.ExecuteReader(); System.Data.IDataReader reader = result.ExecuteReader();
UserProfileData row = database.getUserRow(reader); UserProfileData row = database.readUserRow(reader);
reader.Close(); reader.Close();
result.Dispose(); result.Dispose();
@ -69,7 +69,7 @@ namespace OpenGrid.Framework.Data.MySQL
System.Data.IDbCommand result = database.Query("SELECT * FROM users WHERE UUID = ?uuid", param); System.Data.IDbCommand result = database.Query("SELECT * FROM users WHERE UUID = ?uuid", param);
System.Data.IDataReader reader = result.ExecuteReader(); System.Data.IDataReader reader = result.ExecuteReader();
UserProfileData row = database.getUserRow(reader); UserProfileData row = database.readUserRow(reader);
reader.Close(); reader.Close();
result.Dispose(); result.Dispose();
@ -108,7 +108,7 @@ namespace OpenGrid.Framework.Data.MySQL
System.Data.IDbCommand result = database.Query("SELECT * FROM agents WHERE UUID = ?uuid", param); System.Data.IDbCommand result = database.Query("SELECT * FROM agents WHERE UUID = ?uuid", param);
System.Data.IDataReader reader = result.ExecuteReader(); System.Data.IDataReader reader = result.ExecuteReader();
UserAgentData row = database.getAgentRow(reader); UserAgentData row = database.readAgentRow(reader);
reader.Close(); reader.Close();
result.Dispose(); result.Dispose();

View File

@ -7,23 +7,23 @@ namespace OpenGrid.Framework.Data
{ {
public class InventoryItemBase public class InventoryItemBase
{ {
LLUUID inventoryID; public LLUUID inventoryID;
LLUUID assetID; public LLUUID assetID;
int type; public int type;
LLUUID parentFolderID; public LLUUID parentFolderID;
LLUUID avatarID; public LLUUID avatarID;
string inventoryName; public string inventoryName;
string inventoryDescription; public string inventoryDescription;
uint inventoryNextPermissions; public uint inventoryNextPermissions;
uint inventoryCurrentPermissions; public uint inventoryCurrentPermissions;
} }
public class InventoryFolderBase public class InventoryFolderBase
{ {
string name; public string name;
LLUUID agentID; public LLUUID agentID;
LLUUID parentID; public LLUUID parentID;
LLUUID folderID; public LLUUID folderID;
} }
public interface IInventoryData public interface IInventoryData