forked from nhibernate/nhibernate-core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDB2DriverBase.cs
65 lines (57 loc) · 1.78 KB
/
DB2DriverBase.cs
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
using System;
using System.Data;
using System.Data.Common;
using NHibernate.Engine;
using NHibernate.SqlTypes;
namespace NHibernate.Driver
{
/// <summary>
/// A base for NHibernate Driver for using the IBM.Data.DB2 or IBM.Data.DB2.Core DataProvider.
/// </summary>
public abstract class DB2DriverBase : ReflectionBasedDriver
{
/// <param name="assemblyName"></param>
/// <exception cref="HibernateException">
/// Thrown when the <c>assemblyName</c> assembly can not be loaded.
/// </exception>
protected DB2DriverBase(string assemblyName) :
base(assemblyName, assemblyName, assemblyName + ".DB2Connection", assemblyName + ".DB2Command")
{
}
public override bool UseNamedPrefixInSql => false;
public override bool UseNamedPrefixInParameter => false;
public override string NamedPrefix => string.Empty;
public override bool SupportsMultipleOpenReaders => false;
/// <summary>
/// Gets a value indicating whether the driver [supports multiple queries].
/// </summary>
/// <value>
/// <c>true</c> if [supports multiple queries]; otherwise, <c>false</c>.
/// </value>
public override bool SupportsMultipleQueries => true;
/// <summary>
/// Gets the result sets command.
/// </summary>
/// <param name="session">The implementor of the session.</param>
/// <returns></returns>
public override IResultSetsCommand GetResultSetsCommand(ISessionImplementor session)
{
return new BasicResultSetsCommand(session);
}
protected override void InitializeParameter(DbParameter dbParam, string name, SqlType sqlType)
{
switch (sqlType.DbType)
{
case DbType.Guid:
dbParam.DbType = DbType.Binary;
break;
case DbType.Byte:
dbParam.DbType = DbType.Int16;
break;
default:
dbParam.DbType = sqlType.DbType;
break;
}
}
}
}