blob: 024d29b4a2d6f3ae86f537c316136881a13a72e3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
|
using System;
using System.Data;
using NHibernate;
using NHibernate.SqlTypes;
using NHibernate.UserTypes;
using libsecondlife;
namespace OpenSim.Data.NHibernate
{
[Serializable]
public class LLUUIDUserType: IUserType
{
public object Assemble(object cached, object owner)
{
return cached;
}
bool IUserType.Equals(object uuid1, object uuid2)
{
return uuid1.Equals(uuid2);
}
public object DeepCopy(object uuid)
{
return uuid;
}
public object Disassemble(object uuid)
{
return uuid;
}
public int GetHashCode(object uuid)
{
return (uuid == null) ? 0 : uuid.GetHashCode();
}
public bool IsMutable
{
get { return false; }
}
public object NullSafeGet(System.Data.IDataReader rs, string[] names, object owner)
{
object uuid = null;
int ord = rs.GetOrdinal(names[0]);
if (!rs.IsDBNull(ord))
{
string first = (string)rs.GetString(ord);
uuid = new LLUUID(first);
}
return uuid;
}
public void NullSafeSet(System.Data.IDbCommand cmd, object obj, int index)
{
LLUUID uuid = (LLUUID)obj;
((IDataParameter)cmd.Parameters[index]).Value = uuid.ToString();
}
public object Replace(object original, object target, object owner)
{
return original;
}
public Type ReturnedType
{
get { return typeof(Guid); }
}
public SqlType[] SqlTypes
{
get { return new SqlType [] { NHibernateUtil.String.SqlType }; }
}
}
}
|