From 7a8a481f8801d9840a9ec05dd18adb2a1ccaebf7 Mon Sep 17 00:00:00 2001
From: Charles Krinke
Date: Sun, 17 May 2009 18:18:48 +0000
Subject: Thank you kindly, StrawberryFride, for a patch that: Adds maturity &
access logic for MSSQL platform to mirror that of MySQL as committed in 9502.
---
OpenSim/Data/MSSQL/MSSQLAssetData.cs | 39 ++++++++++++++++++------------------
1 file changed, 20 insertions(+), 19 deletions(-)
(limited to 'OpenSim/Data/MSSQL/MSSQLAssetData.cs')
diff --git a/OpenSim/Data/MSSQL/MSSQLAssetData.cs b/OpenSim/Data/MSSQL/MSSQLAssetData.cs
index 927b02b..e4fcb8a 100644
--- a/OpenSim/Data/MSSQL/MSSQLAssetData.cs
+++ b/OpenSim/Data/MSSQL/MSSQLAssetData.cs
@@ -27,6 +27,7 @@
using System;
using System.Data;
+using System.Data.SqlClient;
using System.Reflection;
using System.Collections.Generic;
using OpenMetaverse;
@@ -124,10 +125,11 @@ namespace OpenSim.Data.MSSQL
///
override protected AssetBase FetchStoredAsset(UUID assetID)
{
- using (AutoClosingSqlCommand command = m_database.Query("SELECT * FROM assets WHERE id = @id"))
+ string sql = "SELECT * FROM assets WHERE id = @id";
+ using (AutoClosingSqlCommand command = m_database.Query(sql))
{
command.Parameters.Add(m_database.CreateParameter("id", assetID));
- using (IDataReader reader = command.ExecuteReader())
+ using (SqlDataReader reader = command.ExecuteReader())
{
if (reader.Read())
{
@@ -157,11 +159,13 @@ namespace OpenSim.Data.MSSQL
{
return;
}
-
- using (AutoClosingSqlCommand command = m_database.Query(
- "INSERT INTO assets ([id], [name], [description], [assetType], [local], [temporary], [create_time], [access_time], [data])" +
- " VALUES " +
- "(@id, @name, @description, @assetType, @local, @temporary, @create_time, @access_time, @data)"))
+ string sql = @"INSERT INTO assets
+ ([id], [name], [description], [assetType], [local],
+ [temporary], [create_time], [access_time], [data])
+ VALUES
+ (@id, @name, @description, @assetType, @local,
+ @temporary, @create_time, @access_time, @data)";
+ using (AutoClosingSqlCommand command = m_database.Query(sql))
{
int now = (int)((System.DateTime.Now.Ticks - m_ticksToEpoch) / 10000000);
command.Parameters.Add(m_database.CreateParameter("id", asset.FullID));
@@ -184,14 +188,10 @@ namespace OpenSim.Data.MSSQL
/// the asset
override public void UpdateAsset(AssetBase asset)
{
- using (AutoClosingSqlCommand command = m_database.Query("UPDATE assets set id = @id, " +
- "name = @name, " +
- "description = @description," +
- "assetType = @assetType," +
- "local = @local," +
- "temporary = @temporary," +
- "data = @data where " +
- "id = @keyId;"))
+ string sql = @"UPDATE assets set id = @id, name = @name, description = @description, assetType = @assetType,
+ local = @local, temporary = @temporary, data = @data
+ WHERE id = @keyId;";
+ using (AutoClosingSqlCommand command = m_database.Query(sql))
{
command.Parameters.Add(m_database.CreateParameter("id", asset.FullID));
command.Parameters.Add(m_database.CreateParameter("name", asset.Name));
@@ -257,18 +257,19 @@ namespace OpenSim.Data.MSSQL
public override List FetchAssetMetadataSet(int start, int count)
{
List retList = new List(count);
-
- using (AutoClosingSqlCommand command = m_database.Query("SELECT (name,description,assetType,temporary,id), Row = ROW_NUMBER() OVER (ORDER BY (some column to order by)) WHERE Row >= @Start AND Row < @Start + @Count"))
+ string sql = @"SELECT (name,description,assetType,temporary,id), Row = ROW_NUMBER()
+ OVER (ORDER BY (some column to order by))
+ WHERE Row >= @Start AND Row < @Start + @Count";
+ using (AutoClosingSqlCommand command = m_database.Query(sql))
{
command.Parameters.Add(m_database.CreateParameter("start", start));
command.Parameters.Add(m_database.CreateParameter("count", count));
- using (IDataReader reader = command.ExecuteReader())
+ using (SqlDataReader reader = command.ExecuteReader())
{
while (reader.Read())
{
AssetMetadata metadata = new AssetMetadata();
- // Region Main
metadata.FullID = new UUID((Guid)reader["id"]);
metadata.Name = (string)reader["name"];
metadata.Description = (string)reader["description"];
--
cgit v1.1