Files
mono/mcs/class/System.Data/System.Data.SqlClient/SqlParameter.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

228 lines
3.8 KiB
C#

//
// System.Data.SqlClient.SqlParameter.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.Runtime.InteropServices;
namespace System.Data.SqlClient
{
/// <summary>
/// Represents a parameter to a Command object, and optionally,
/// its mapping to DataSet columns; and is implemented by .NET
/// data providers that access data sources.
/// </summary>
//public sealed class SqlParameter : MarshalByRefObject,
// IDbDataParameter, IDataParameter, ICloneable
public sealed class SqlParameter : IDbDataParameter, IDataParameter
{
private string parmName;
private SqlDbType dbtype;
private DbType theDbType;
private object objValue;
private int size;
private string sourceColumn;
private ParameterDirection direction;
private bool isNullable;
private byte precision;
private byte scale;
private DataRowVersion sourceVersion;
private int offset;
[MonoTODO]
public SqlParameter () {
}
[MonoTODO]
public SqlParameter (string parameterName, object value) {
this.parmName = parameterName;
this.objValue = value;
}
[MonoTODO]
public SqlParameter(string parameterName, SqlDbType dbType) {
this.parmName = parameterName;
this.dbtype = dbType;
}
[MonoTODO]
public SqlParameter(string parameterName, SqlDbType dbType,
int size) {
this.parmName = parameterName;
this.dbtype = dbType;
this.size = size;
}
[MonoTODO]
public SqlParameter(string parameterName, SqlDbType dbType,
int size, string sourceColumn) {
this.parmName = parameterName;
this.dbtype = dbType;
this.size = size;
this.sourceColumn = sourceColumn;
}
[MonoTODO]
public SqlParameter(string parameterName, SqlDbType dbType,
int size, ParameterDirection direction,
bool isNullable, byte precision,
byte scale, string sourceColumn,
DataRowVersion sourceVersion, object value) {
this.parmName = parameterName;
this.dbtype = dbType;
this.size = size;
this.sourceColumn = sourceColumn;
this.direction = direction;
this.isNullable = isNullable;
this.precision = precision;
this.scale = scale;
this.sourceVersion = sourceVersion;
this.objValue = value;
}
[MonoTODO]
public DbType DbType {
get {
return theDbType;
}
set {
theDbType = value;
}
}
[MonoTODO]
public ParameterDirection Direction {
get {
return direction;
}
set {
direction = value;
}
}
[MonoTODO]
public bool IsNullable {
get {
return isNullable;
}
}
[MonoTODO]
public int Offset {
get {
return offset;
}
set {
offset = value;
}
}
[MonoTODO]
public string ParameterName {
get {
return parmName;
}
set {
parmName = value;
}
}
[MonoTODO]
public string SourceColumn {
get {
return sourceColumn;
}
set {
sourceColumn = value;
}
}
[MonoTODO]
public DataRowVersion SourceVersion {
get {
return sourceVersion;
}
set {
sourceVersion = value;
}
}
[MonoTODO]
public SqlDbType SqlDbType {
get {
return dbtype;
}
set {
dbtype = value;
}
}
[MonoTODO]
public object Value {
get {
return objValue;
}
set {
objValue = value;
}
}
[MonoTODO]
public byte Precision {
get {
return precision;
}
set {
precision = value;
}
}
[MonoTODO]
public byte Scale {
get {
return scale;
}
set {
scale = value;
}
}
[MonoTODO]
public int Size
{
get {
return size;
}
set {
size = value;
}
}
[MonoTODO]
public override string ToString() {
return parmName;
}
}
}