19 using System.Collections.Generic;
23 using System.Runtime.CompilerServices;
28 namespace Deveel.Data.Client {
34 throw new ArgumentNullException(
"command");
37 parameters =
new List<DeveelDbParameter>();
44 set { SetParameter(offset, value); }
49 set { SetParameter(name, value); }
53 get {
return Command.Connection.Settings.ParameterStyle; }
58 if (Contains(paramName))
59 throw new ArgumentException(
String.Format(
"The parameter '{0}' already exists in the collection.", paramName));
61 if (!
String.IsNullOrEmpty(paramName) ||
63 throw new ArgumentException(
"Cannot specify the name of the parameter.");
68 var dbType = GetDbType(value);
69 var sqlType = GetSqlType(value);
81 throw new NotImplementedException();
85 throw new NotImplementedException();
88 public override int Add(
object value) {
90 return AddParameter((DeveelDbParameter) value);
91 if (value is IDbDataParameter)
92 return AddDbDataParameter((IDbDataParameter) value);
94 return AddValue(value);
99 throw new ArgumentException(
"Cannot add an unnamed parameter in this context.");
101 var parameter = CreateParemeter(value);
102 parameters.Add(parameter);
103 return parameters.Count - 1;
107 AssertValidName(parameter.ParameterName);
111 dbParameter = (DeveelDbParameter) parameter;
113 dbParameter =
new DeveelDbParameter();
116 parameters.Add(dbParameter);
117 return parameters.Count - 1;
122 parameters.Add(parameter);
123 return parameters.Count - 1;
128 return Contains((
string) value);
129 if (value is IDbDataParameter)
130 return Contains(((IDbDataParameter) value).ParameterName);
141 return IndexOf((
string) value);
142 if (value is IDbDataParameter)
143 return IndexOf(((IDbDataParameter) value).ParameterName);
148 public override void Insert(
int index,
object value) {
149 throw new NotImplementedException();
152 public override void Remove(
object value) {
153 if (value is
string) {
154 var paramName = (string) value;
156 }
else if (value is
int) {
157 var index = (int) value;
159 }
else if (value is IDbDataParameter) {
160 var param = (IDbDataParameter) value;
161 throw new NotImplementedException();
166 if (index < 0 || index >= parameters.Count)
167 throw new ArgumentOutOfRangeException(
"index");
169 parameters.RemoveAt(index);
172 public override void RemoveAt(
string parameterName) {
173 var index = IndexOf(parameterName);
181 throw new NotImplementedException();
184 protected override void SetParameter(
string parameterName, DbParameter value) {
185 throw new NotImplementedException();
188 public override int Count {
189 get {
return parameters.Count; }
192 public override object SyncRoot {
196 public override bool IsFixedSize {
197 get {
return false; }
200 public override bool IsReadOnly {
201 get {
return false; }
204 public override bool IsSynchronized {
205 get {
return false; }
208 public override int IndexOf(
string parameterName) {
212 for (
int i = 0; i < parameters.Count; i++) {
213 if (parameters[i].ParameterName == parameterName)
221 return parameters.GetEnumerator();
225 throw new NotImplementedException();
229 throw new NotImplementedException();
236 return parameters.Any(x => x.ParameterName == value);
239 public override void CopyTo(Array array,
int index) {
240 throw new NotImplementedException();
244 foreach (var value
in values) {
override DbParameter GetParameter(string parameterName)
A long string in the system.
DeveelDbParameter CreateParemeter(object value)
int AddValue(object value)
override void RemoveAt(int index)
override int IndexOf(string parameterName)
override IEnumerator GetEnumerator()
override void SetParameter(int index, DbParameter value)
readonly List< DeveelDbParameter > parameters
override bool Contains(string value)
SqlTypeCode GetSqlType(object value)
override void AddRange(Array values)
override DbParameter GetParameter(int index)
override int IndexOf(object value)
override void Remove(object value)
override bool Contains(object value)
ParameterDirection
The possible directions of a procedure parameter.
void AssertValidName(string paramName)
override string ParameterName
override void CopyTo(Array array, int index)
int AddParameter(DeveelDbParameter parameter)
QueryParameterStyle
In a SQL query object, this is the form of parameters passed from the client side to the server side...
Defines the properties of a specific SQL Type and handles the values compatible.
DbType GetDbType(object value)
SqlTypeCode
Enumerates the codes of all SQL types handled by the system.
override void SetParameter(string parameterName, DbParameter value)
override void RemoveAt(string parameterName)
override void Insert(int index, object value)
DeveelDbParameterCollection(DeveelDbCommand command)
int AddDbDataParameter(IDbDataParameter parameter)
override int Add(object value)