| |||||||||||||||||
Source File | Conditionals | Statements | Methods | TOTAL | |||||||||||||
Seasar.Framework.Util\DataProviderUtil.cs | 10.0% | 25.0% | 50.0% | 20.8% |
|
1 | #region Copyright | |
2 | ||
3 | /* | |
4 | * Copyright 2005 the Seasar Foundation and the Others. | |
5 | * | |
6 | * Licensed under the Apache License, Version 2.0 (the "License"); | |
7 | * you may not use this file except in compliance with the License. | |
8 | * You may obtain a copy of the License at | |
9 | * | |
10 | * http://www.apache.org/licenses/LICENSE-2.0 | |
11 | * | |
12 | * Unless required by applicable law or agreed to in writing, software | |
13 | * distributed under the License is distributed on an "AS IS" BASIS, | |
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, | |
15 | * either express or implied. See the License for the specific language | |
16 | * governing permissions and limitations under the License. | |
17 | */ | |
18 | ||
19 | #endregion | |
20 | ||
21 | using System.Data; | |
22 | ||
23 | namespace Seasar.Framework.Util | |
24 | { | |
25 | /// <summary> | |
26 | /// DataProviderUtil | |
27 | /// </summary> | |
28 | public sealed class DataProviderUtil | |
29 | { | |
30 | /// <summary> | |
31 | /// コンストラクタ | |
32 | /// </summary> | |
33 | 0 | private DataProviderUtil() |
34 | { | |
35 | } | |
36 | ||
37 | /// <summary> | |
38 | /// バインド変数タイプを取得する | |
39 | /// </summary> | |
40 | /// <param name="cmd">コマンドオブジェクト</param> | |
41 | /// <returns>バインド変数タイプ</returns> | |
42 | 51 | public static BindVariableType GetBindVariableType(IDbCommand cmd) |
43 | { | |
44 | 51 | string name = cmd.GetType().Name; |
45 | 51 | if ("SqlCommand".Equals(name) || |
46 | "DB2Command".Equals(name)) | |
47 | { | |
48 | 51 | return BindVariableType.AtmarkWithParam; |
49 | } | |
50 | 0 | else if ("OracleCommand".Equals(name)) |
51 | { | |
52 | return BindVariableType.ColonWithParam; | |
53 | } | |
54 | else if ("MySqlCommand".Equals(name)) | |
55 | { | |
56 | return BindVariableType.QuestionWithParam; | |
57 | } | |
58 | else if ("NpgsqlCommand".Equals(name)) | |
59 | { | |
60 | return BindVariableType.ColonWithParamToLower; | |
61 | } | |
62 | else if ("FbCommand".Equals(name)) | |
63 | { | |
64 | return BindVariableType.Question; | |
65 | } | |
66 | else | |
67 | { | |
68 | return BindVariableType.Question; | |
69 | } | |
70 | } | |
71 | } | |
72 | } |
|