Class Parameter
The Parameter class, representing a parameter kind of Argument. A parameter has a concrete value, which can be one of a number of possible types, such as an int or a string.
Implements
Inherited Members
Namespace: SuperOffice.Data.SQL
Assembly: SoDataBase.dll
Syntax
public sealed class Parameter : Argument, ICloneable
Constructors
Parameter(DBNull)
Initializes a new instance of the Parameter class.
Declaration
public Parameter(DBNull parameter)
Parameters
| Type | Name | Description |
|---|---|---|
| DBNull | parameter | NULL value to be stored |
Parameter(DBNull, bool)
Initializes a new instance of the Parameter class.
Declaration
public Parameter(DBNull parameter, bool useSqlParameter)
Parameters
| Type | Name | Description |
|---|---|---|
| DBNull | parameter | NULL value to be stored |
| bool | useSqlParameter | If true, a sql parameter will be added for this parameter when creating the query, otherwise the value will be added directly to the query |
Parameter(DateTime)
Initializes a new instance of the Parameter class.
Declaration
public Parameter(DateTime parameter)
Parameters
| Type | Name | Description |
|---|---|---|
| DateTime | parameter | DateTime value to be stored |
Remarks
The actual data type, such as dbDateTimeLocal, will be overridden by the Compare class once the parameter is combined with a field. Compare will transfer the type from the field to the parameter part of the comparison.
Parameter(DateTime, bool)
Initializes a new instance of the Parameter class.
Declaration
public Parameter(DateTime parameter, bool useSqlParameter)
Parameters
| Type | Name | Description |
|---|---|---|
| DateTime | parameter | DateTime value to be stored |
| bool | useSqlParameter | If true, a sql parameter will be added for this parameter when creating the query, otherwise the value will be added directly to the query |
Remarks
The actual data type, such as dbDateTimeLocal, will be overridden by the Compare class once the parameter is combined with a field. Compare will transfer the type from the field to the parameter part of the comparison.
Parameter(double)
Initializes a new instance of the Parameter class.
Declaration
public Parameter(double parameter)
Parameters
| Type | Name | Description |
|---|---|---|
| double | parameter | double value to be stored |
Parameter(double, bool)
Initializes a new instance of the Parameter class.
Declaration
public Parameter(double parameter, bool useSqlParameter)
Parameters
| Type | Name | Description |
|---|---|---|
| double | parameter | double value to be stored |
| bool | useSqlParameter | If true, a sql parameter will be added for this parameter when creating the query, otherwise the value will be added directly to the query |
Parameter(Stream)
Initializes a new instance of the Parameter class.
Declaration
public Parameter(Stream parameter)
Parameters
| Type | Name | Description |
|---|---|---|
| Stream | parameter | Stream to be stored |
Remarks
The stream will actually be accessed / read only when the SQL statement executes
Parameter(short, bool)
The Parameter class, representing a parameter kind of Argument. A parameter has a concrete value, which can be one of a number of possible types, such as an int or a string.
Declaration
public Parameter(short parameter, bool useSqlParameter)
Parameters
| Type | Name | Description |
|---|---|---|
| short | parameter | |
| bool | useSqlParameter |
Parameter(int)
Initializes a new instance of the Parameter class.
Declaration
public Parameter(int parameter)
Parameters
| Type | Name | Description |
|---|---|---|
| int | parameter | int value to be stored |
Parameter(int, bool)
Initializes a new instance of the Parameter class.
Declaration
public Parameter(int parameter, bool useSqlParameter)
Parameters
| Type | Name | Description |
|---|---|---|
| int | parameter | int value to be stored |
| bool | useSqlParameter | If true, a sql parameter will be added for this parameter when creating the query, otherwise the value will be added directly to the query |
Parameter(object)
Initializes a new instance of the Parameter class.
Declaration
public Parameter(object parameter)
Parameters
| Type | Name | Description |
|---|---|---|
| object | parameter | Enumerator value to be stored |
Remarks
The object passed in has to be an enumerator type
Exceptions
| Type | Condition |
|---|---|
| SoInvalidArgumentException | Thrown if parameter is not an enumerator. |
Parameter(object, FieldDataType)
Initializes a new instance of the Parameter class.
Declaration
public Parameter(object parameter, FieldDataType dataType)
Parameters
| Type | Name | Description |
|---|---|---|
| object | parameter | Object value to be stored |
| FieldDataType | dataType | Data type of object |
Parameter(object, FieldDataType, bool)
Initializes a new instance of the Parameter class.
Declaration
public Parameter(object parameter, FieldDataType dataType, bool useSqlParameter)
Parameters
| Type | Name | Description |
|---|---|---|
| object | parameter | Object value to be stored |
| FieldDataType | dataType | Data type of object |
| bool | useSqlParameter | If true, a sql parameter will be added for this parameter when creating the query, otherwise the value will be added directly to the query |
Parameter(object, bool)
Initializes a new instance of the Parameter class.
Declaration
public Parameter(object parameter, bool useSqlParameter)
Parameters
| Type | Name | Description |
|---|---|---|
| object | parameter | Enumerator value to be stored |
| bool | useSqlParameter | If true, a sql parameter will be added for this parameter when creating the query, otherwise the value will be added directly to the query |
Remarks
The object passed in has to be an enumerator type
Exceptions
| Type | Condition |
|---|---|
| SoInvalidArgumentException | Thrown if parameter is not an enumerator. |
Parameter(string)
Initializes a new instance of the Parameter class.
Declaration
public Parameter(string parameter)
Parameters
| Type | Name | Description |
|---|---|---|
| string | parameter | string value to be stored |
Parameter(string, bool)
Initializes a new instance of the Parameter class.
Declaration
public Parameter(string parameter, bool useSqlParameter)
Parameters
| Type | Name | Description |
|---|---|---|
| string | parameter | string value to be stored |
| bool | useSqlParameter | If true, a sql parameter will be added for this parameter when creating the query, otherwise the value will be added directly to the query |
Parameter(uint)
Initializes a new instance of the Parameter class.
Declaration
public Parameter(uint parameter)
Parameters
| Type | Name | Description |
|---|---|---|
| uint | parameter | uint value to be stored |
Parameter(uint, bool)
Initializes a new instance of the Parameter class.
Declaration
public Parameter(uint parameter, bool useSqlParameter)
Parameters
| Type | Name | Description |
|---|---|---|
| uint | parameter | uint value to be stored |
| bool | useSqlParameter | If true, a sql parameter will be added for this parameter when creating the query, otherwise the value will be added directly to the query |
Properties
Param
Get/Set values for object
Declaration
[Obsolete("Use Value", false)]
public object Param { get; set; }
Property Value
| Type | Description |
|---|---|
| object |
ParameterName
Name of the parameter in the parameter collection
Declaration
public string ParameterName { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
ParameterNameInSql
Name of the parameter in the generated sql
Declaration
public string ParameterNameInSql { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
UseSqlParameter
If true, the query for this parameter will use a SQl parameter. if false, no SQL Parameter will be used.
Declaration
public bool UseSqlParameter { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
Remarks
Default value is true
Value
Get/Set values for object
Declaration
public object Value { get; set; }
Property Value
| Type | Description |
|---|---|
| object |
Methods
Clone()
Deep copy of the Parameter object, except for BLOBs.
Declaration
public override object Clone()
Returns
| Type | Description |
|---|---|
| object | Clone of parameter |
Overrides
Remarks
BLOB data objects are not copied, and are instead shared between copies. This can cause trouble if you read one copy and expect the other to be unaffected. String parameter values are shared between copies as well, but since strings are immutable (read-only) objects, this is not a problem.
All other types of objects/values are copied, as are the names and aliases.CopyTo(IDbDataParameter)
Populate an exsisting IDbDataParameter object.
Declaration
public void CopyTo(IDbDataParameter parameter)
Parameters
| Type | Name | Description |
|---|---|---|
| IDbDataParameter | parameter | Object to populate. |
GetMainField()
This method returns null.
Declaration
public override FieldInfo GetMainField()
Returns
| Type | Description |
|---|---|
| FieldInfo | return null |
Overrides
ToString()
Declaration
public override string ToString()
Returns
| Type | Description |
|---|---|
| string |