Add licensing info
[mono.git] / mcs / class / Mono.Data.SqliteClient / Mono.Data.SqliteClient / SqliteParameter.cs
1 // -*- c-basic-offset: 8; inent-tabs-mode: nil -*-
2 //
3 //  SqliteParameter.cs
4 //
5 //  Author(s): Vladimir Vukicevic  <vladimir@pobox.com>
6 //
7 //  Copyright (C) 2002  Vladimir Vukicevic
8 //
9
10 //
11 // Permission is hereby granted, free of charge, to any person obtaining
12 // a copy of this software and associated documentation files (the
13 // "Software"), to deal in the Software without restriction, including
14 // without limitation the rights to use, copy, modify, merge, publish,
15 // distribute, sublicense, and/or sell copies of the Software, and to
16 // permit persons to whom the Software is furnished to do so, subject to
17 // the following conditions:
18 // 
19 // The above copyright notice and this permission notice shall be
20 // included in all copies or substantial portions of the Software.
21 // 
22 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
23 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
24 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
25 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
26 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
27 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
28 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
29 //
30
31 using System;
32 using System.Data;
33
34 namespace Mono.Data.SqliteClient
35 {
36         public class SqliteParameter : IDbDataParameter
37         {
38                 string name;
39                 DbType type;
40                 string source_column;
41                 ParameterDirection direction;
42                 DataRowVersion row_version;
43                 object param_value;
44                 byte precision;
45                 byte scale;
46                 int size;
47
48                 public SqliteParameter ()
49                 {
50                         type = DbType.String;
51                         direction = ParameterDirection.Input;
52                 }
53
54                 public SqliteParameter (string name_in, DbType type_in)
55                 {
56                         name = name_in;
57                         type = type_in;
58                 }
59
60                 public SqliteParameter (string name_in, object param_value_in)
61                 {
62                         name = name_in;
63                         type = DbType.String;
64                         param_value = param_value_in;
65                         direction = ParameterDirection.Input;
66                 }
67
68                 public SqliteParameter (string name_in, DbType type_in, int size_in)
69                         : this (name_in, type_in)
70                 {
71                         size = size_in;
72                 }
73
74                 public SqliteParameter (string name_in, DbType type_in, int size, string src_column)
75                         : this (name_in ,type_in)
76                 {
77                         source_column = src_column;
78                 }
79
80                 public DbType DbType {
81                         get {
82                                 return type;
83                         }
84                         set {
85                                 type = value;
86                         }
87                 }
88
89                 public ParameterDirection Direction {
90                         get {
91                                 return direction;
92                         }
93                         set {
94                                 direction = value;
95                         }
96                 }
97
98                 public bool IsNullable {
99                         get {
100                                 // uhh..
101                                 return true;
102                         }
103                 }
104
105                 public string ParameterName {
106                         get {
107                                 return name;
108                         }
109                         set {
110                                 name = value;
111                         }
112                 }
113
114                 public string SourceColumn {
115                         get {
116                                 return source_column;
117                         }
118                         set {
119                                 source_column = value;
120                         }
121                 }
122
123                 public DataRowVersion SourceVersion {
124                         get {
125                                 return row_version;
126                         }
127                         set {
128                                 row_version = value;
129                         }
130                 }
131
132                 public object Value {
133                         get {
134                                 return param_value;
135                         }
136                         set {
137                                 param_value = value;
138                         }
139                 }
140
141                 public byte Precision {
142                         get {
143                                 return precision;
144                         }
145                         set {
146                                 precision = value;
147                         }
148                 }
149
150                 public byte Scale {
151                         get {
152                                 return scale;
153                         }
154                         set {
155                                 scale = value;
156                         }
157                 }
158
159                 public int Size {
160                         get {
161                                 return size;
162                         }
163                         set {
164                                 size = value;
165                         }
166                 }
167         }
168 }