0
|
1 using System;
|
|
2 using System.Data;
|
|
3 using System.Data.OleDb;
|
|
4
|
|
5 namespace BLToolkit.Data.DataProvider
|
|
6 {
|
|
7 // Data Provider for DataDirect Sybase ADO Provider 4.2
|
|
8 //
|
|
9 public sealed class SybaseAdoDataProvider : OleDbDataProvider
|
|
10 {
|
|
11 public override bool DeriveParameters(IDbCommand command)
|
|
12 {
|
|
13 OleDbCommandBuilder.DeriveParameters((OleDbCommand)command);
|
|
14 return true;
|
|
15 }
|
|
16
|
|
17 public override object Convert(object value, ConvertType convertType)
|
|
18 {
|
|
19 switch (convertType)
|
|
20 {
|
|
21 case ConvertType.NameToQueryParameter:
|
|
22 return "?";
|
|
23
|
|
24 case ConvertType.NameToCommandParameter:
|
|
25 case ConvertType.NameToSprocParameter:
|
|
26 return value;
|
|
27 }
|
|
28
|
|
29 return base.Convert(value, convertType);
|
|
30 }
|
|
31
|
|
32 public override void AttachParameter(IDbCommand command, IDbDataParameter parameter)
|
|
33 {
|
|
34 if (parameter.Value is string && parameter.DbType == DbType.Guid)
|
|
35 parameter.DbType = DbType.AnsiString;
|
|
36
|
|
37 base.AttachParameter(command, parameter);
|
|
38 }
|
|
39
|
|
40 public override string Name
|
|
41 {
|
|
42 get { return "SybaseAdo"; }
|
|
43 }
|
|
44 }
|
|
45 }
|