Files
mono/mcs/class/System.Data/System.Data.SqlClient/SqlParameterCollection.cs
T
Daniel Morgan 6d551e483a 2002-05-21 Daniel Morgan <[email protected]>
* System.Data.SqlClient/ParmUtil.cs: added file - to
	provide utility for conversion of input parameters

	* System.Data.SqlClient/PostgresTypes.cs: added file -
	moved the PostgreHelper class to here.  May eventually
	move the internal class PostgresTypes that's inside the
	SqlConnection to here as well.
	Handling of PostgreSQL <-> .NET types need to be though
	out more. Also, the PostgreHelper has a method to convert
	from .NET types to a string which can be put into used in
	an SQL statement to execute against a PostgreSQL database.
	This is the beginnings of parameters support.  It currently
	only supports input parameters.  Still need to do output,
	input/output, and return parameters.

	* Test/TestSqlParameters.cs: new test to test the input
	parameters in System.Data.SqlClient against a
	PostgreSQL db.

	* System.Data.SqlClient/PostgresLibrary.cs: moved
	PostgresHelper class to file PostgresTypes.cs.  Also
	moved struct PostgresType there too.

	* System.Data.SqlClient/SqlCommand.cs: added input
	parameters support

	* System.Data.SqlClient/SqlParameter.cs: got
	SqlParameter to work

	* System.Data.SqlClient/SqlParameterCollection.cs: got
	SqlParameterCollection to work

	* Test/System.Data_test.build: added files to exclude
	from test build

	* System.Data.SqlClient/SqlConnection.cs: release resources
	no longer used

svn path=/trunk/mcs/; revision=4805
2002-05-21 01:29:30 +00:00

240 lines
4.6 KiB
C#

//
// System.Data.SqlClient.SqlParameterCollection.cs
//
// Author:
// Rodrigo Moya ([email protected])
// Daniel Morgan ([email protected])
//
// (C) Ximian, Inc 2002
//
using System;
using System.ComponentModel;
using System.Data;
using System.Data.Common;
using System.Collections;
namespace System.Data.SqlClient
{
/// <summary>
/// Collects all parameters relevant to a Command object
/// and their mappings to DataSet columns.
/// </summary>
// public sealed class SqlParameterCollection : MarshalByRefObject,
// IDataParameterCollection, IList, ICollection, IEnumerable
public sealed class SqlParameterCollection : IDataParameterCollection
{
private ArrayList parameterList = new ArrayList();
private Hashtable parameterNames = new Hashtable();
/*
[MonoTODO]
public void RemoveAt(string parameterName)
{
throw new NotImplementedException ();
}
[MonoTODO]
public int IndexOf(string parameterName)
{
throw new NotImplementedException ();
}
[MonoTODO]
public bool Contains(string parameterName)
{
return parameterNames.ContainsKey(parameterName);
}
*/
[MonoTODO]
public IEnumerator GetEnumerator()
{
throw new NotImplementedException ();
}
[MonoTODO]
public int Add( object value)
{
throw new NotImplementedException ();
}
[MonoTODO]
public SqlParameter Add(SqlParameter value)
{
parameterList.Add(value);
parameterNames.Add(value.ParameterName, parameterList.Add(value));
return value;
}
[MonoTODO]
public SqlParameter Add(string parameterName, object value)
{
throw new NotImplementedException ();
}
[MonoTODO]
public SqlParameter Add(string parameterName, SqlDbType sqlDbType)
{
throw new NotImplementedException ();
}
[MonoTODO]
public SqlParameter Add(string parameterName,
SqlDbType sqlDbType, int size)
{
throw new NotImplementedException ();
}
[MonoTODO]
public SqlParameter Add(string parameterName,
SqlDbType sqlDbType, int size, string sourceColumn)
{
throw new NotImplementedException ();
}
[MonoTODO]
public void Clear()
{
throw new NotImplementedException ();
}
[MonoTODO]
public bool Contains(object value)
{
throw new NotImplementedException ();
}
[MonoTODO]
public bool Contains(string value)
{
return parameterNames.ContainsKey(value);
}
[MonoTODO]
public void CopyTo(Array array, int index)
{
throw new NotImplementedException ();
}
[MonoTODO]
public int IndexOf(object value)
{
throw new NotImplementedException ();
}
[MonoTODO]
public int IndexOf(string parameterName)
{
throw new NotImplementedException ();
}
[MonoTODO]
public void Insert(int index, object value)
{
throw new NotImplementedException ();
}
[MonoTODO]
public void Remove(object value)
{
throw new NotImplementedException ();
}
[MonoTODO]
public void RemoveAt(int index)
{
throw new NotImplementedException ();
}
[MonoTODO]
public void RemoveAt(string parameterName)
{
throw new NotImplementedException ();
}
[MonoTODO]
public int Count {
get {
return parameterList.Count;
}
}
object IList.this[int index] {
[MonoTODO]
get {
return (SqlParameter) this[index];
}
[MonoTODO]
set {
this[index] = (SqlParameter) value;
}
}
public SqlParameter this[int index] {
get {
return (SqlParameter) parameterList[index];
}
set {
parameterList[index] = (SqlParameter) value;
}
}
object IDataParameterCollection.this[string parameterName] {
[MonoTODO]
get {
return (SqlParameter) this[parameterName];
}
[MonoTODO]
set {
this[parameterName] = (SqlParameter) value;
}
}
public SqlParameter this[string parameterName] {
get {
if(parameterNames.ContainsKey(parameterName))
return (SqlParameter) parameterList[(int)parameterNames[parameterName]];
else
throw new IndexOutOfRangeException("The specified name does not exist: " + parameterName);
}
set {
if(parameterNames.ContainsKey(parameterName))
parameterList[(int)parameterNames[parameterName]] = (SqlParameter) value;
else
throw new IndexOutOfRangeException("The specified name does not exist: " + parameterName);
}
}
bool IList.IsFixedSize {
get {
throw new NotImplementedException ();
}
}
bool IList.IsReadOnly {
get {
throw new NotImplementedException ();
}
}
bool ICollection.IsSynchronized {
get {
throw new NotImplementedException ();
}
}
object ICollection.SyncRoot {
get {
throw new NotImplementedException ();
}
}
}
}